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

Class CFSNode

object --+
         |
        CFSNode
Known Subclasses:

Instance Methods [hide private]
 
__init__(self)
 
__eq__(self, other)
 
__ne__(self, other)
 
_get_path(self)
 
_create_in_cfs_ine(self, mode)
Creates the configFS node if it does not already exist, depending on the mode.
 
_exists(self)
 
_check_self(self)
 
_list_files(self, path, writable=None)
List files under a path depending on their owner's write permissions.
 
list_parameters(self, writable=None)
Returns: The list of existing RFC-3720 parameter names.
 
list_attributes(self, writable=None)
Returns: A list of existing attribute names as strings.
 
set_attribute(self, attribute, value)
Sets the value of a named attribute.
 
get_attribute(self, attribute)
Returns: The named attribute's value, as a string.
 
set_parameter(self, parameter, value)
Sets the value of a named RFC-3720 parameter.
 
get_parameter(self, parameter)
Returns: The named parameter value as a string.
 
delete(self)
If the underlying configFS object does not exist, this method does nothing.
 
dump(self)
Class Variables [hide private]
  configfs_dir = '/sys/kernel/config/target'
  path = property(_get_path, doc= "Get the configFS object path.")
  exists = property(_exists, doc= "Is True as long as the underl...
Method Details [hide private]

__init__(self)
(Constructor)

 
Overrides: object.__init__
(inherited documentation)

_create_in_cfs_ine(self, mode)

 

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)

 

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)

 
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)

 
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)

 

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)

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

set_parameter(self, parameter, value)

 

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)

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

delete(self)

 

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


Class Variable Details [hide private]

exists

Value:
property(_exists, doc= "Is True as long as the underlying configFS obj\
ect exists. "+ "If the underlying configFS objects gets deleted "+ "ei\
ther by calling the delete() method, or by any "+ "other means, it wil\
l be False.")