Package rtslib :: Module node :: Class CFSNode
[hide private]
[frames] | no frames]

Class CFSNode

source code

object --+
         |
        CFSNode
Known Subclasses:

Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
_get_path(self) source code
 
_create_in_cfs_ine(self, mode)
Creates the configFS node if it does not already exist, depending on the mode.
source code
 
_exists(self) source code
 
_check_self(self) source code
 
_list_files(self, path, writable=None)
List files under a path depending on their owner's write permissions.
source code
 
list_parameters(self, writable=None)
Returns: The list of existing RFC-3720 parameter names.
source code
 
list_attributes(self, writable=None)
Returns: A list of existing attribute names as strings.
source code
 
set_attribute(self, attribute, value)
Sets the value of a named attribute.
source code
 
get_attribute(self, attribute)
Returns: The named attribute's value, as a string.
source code
 
set_parameter(self, parameter, value)
Sets the value of a named RFC-3720 parameter.
source code
 
get_parameter(self, parameter)
Returns: The named parameter value as a string.
source code
 
delete(self)
If the underlying configFS object does not exist, this method does nothing.
source code
 
dump(self) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  configfs_dir = '/sys/kernel/config/target'
Properties [hide private]
  path
Get the configFS object path.
  exists
Is True as long as the underlying configFS object exists.

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

_create_in_cfs_ine(self, mode)

source code 

Creates the configFS node if it does not already exist, depending on the mode. any -> makes sure it exists, also works if the node already does exist lookup -> make sure it does NOT exist create -> create the node which must not exist beforehand

_list_files(self, path, writable=None)

source code 

List files under a path depending on their owner's write permissions.

Parameters:
  • path (str) - The path under which the files are expected to be. If the path itself is not a directory, an empty list will be returned.
  • writable (bool or None) - If None (default), returns all parameters, if True, returns read-write parameters, if False, returns just the read-only parameters.
Returns:
List of file names filtered according to their write perms.

list_parameters(self, writable=None)

source code 
Parameters:
  • writable (bool or None) - If None (default), returns all parameters, if True, returns read-write parameters, if False, returns just the read-only parameters.
Returns:
The list of existing RFC-3720 parameter names.

list_attributes(self, writable=None)

source code 
Parameters:
  • writable (bool or None) - If None (default), returns all attributes, if True, returns read-write attributes, if False, returns just the read-only attributes.
Returns:
A list of existing attribute names as strings.

set_attribute(self, attribute, value)

source code 

Sets the value of a named attribute. The attribute must exist in configFS.

Parameters:
  • attribute (string) - The attribute's name. It is case-sensitive.
  • value (string) - The attribute's value.

get_attribute(self, attribute)

source code 
Parameters:
  • attribute - The attribute's name. It is case-sensitive.
Returns:
The named attribute's value, as a string.

set_parameter(self, parameter, value)

source code 

Sets the value of a named RFC-3720 parameter. The parameter must exist in configFS.

Parameters:
  • parameter (string) - The RFC-3720 parameter's name. It is case-sensitive.
  • value (string) - The parameter's value.

get_parameter(self, parameter)

source code 
Parameters:
  • parameter (string) - The RFC-3720 parameter's name. It is case-sensitive.
Returns:
The named parameter value as a string.

delete(self)

source code 

If the underlying configFS object does not exist, this method does nothing. If the underlying configFS object exists, this method attempts to delete it.


Property Details [hide private]

path

Get the configFS object path.

Get Method:
_get_path(self)

exists

Is True as long as the underlying configFS object exists. If the underlying configFS objects gets deleted either by calling the delete() method, or by any other means, it will be False.

Get Method:
_exists(self)