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

Class CFSNode

object --+
         |
        CFSNode
Known Subclasses:

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

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]
  exists
Is True as long as the underlying configFS object exists.
  path
Get the configFS object path.

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

 

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

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, readable=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), return all files despite their writability. If True, return only writable files. If False, return only non-writable files.
  • readable (bool or None) - If None (default), return all files despite their readability. If True, return only readable files. If False, return only non-readable files.
Returns:
List of file names filtered according to their read/write perms.

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.

get_attribute(self, attribute)

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

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.

list_attributes(self, writable=None, readable=None)

 
Parameters:
  • writable (bool or None) - If None (default), return all files despite their writability. If True, return only writable files. If False, return only non-writable files.
  • readable (bool or None) - If None (default), return all files despite their readability. If True, return only readable files. If False, return only non-readable files.
Returns:
A list of existing attribute names as strings.

list_parameters(self, writable=None, readable=None)

 
Parameters:
  • writable (bool or None) - If None (default), return all parameters despite their writability. If True, return only writable parameters. If False, return only non-writable parameters.
  • readable (bool or None) - If None (default), return all parameters despite their readability. If True, return only readable parameters. If False, return only non-readable parameters.
Returns:
The list of existing RFC-3720 parameter names.

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.

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.

Property Details [hide private]

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)

path

Get the configFS object path.

Get Method:
_get_path(self)