XAttr Functions

XAttr functions provide methods for inspecting extended attributes on files.

Description

arcapix.fs.gpfs.clib.xattr.get_all_xattrs(gpfs_file_t fileDesc)

Get all extended attributes on a file.

Parameters

fileDesc (int) – descriptor of an open file

Return type

dict

arcapix.fs.gpfs.clib.xattr.get_xattr(gpfs_file_t fileDesc, name)

Get the value for an extended attribute on a file.

Parameters
  • fileDesc (int) – descriptor of an open file

  • name (str) – name of the extended attribute to retrieve

Return type

str

arcapix.fs.gpfs.clib.xattr.list_xattrs(gpfs_file_t fileDesc)

Get a list of names of any extended attributes on a file.

Parameters

fileDesc (int) – descriptor of an open file

Return type

list of str

Examples

Lookup extended attributes

>>> from arcapix.fs.gpfs.clib.file import get_all_xattrs
>>>
>>> with open('/mmfs1/test.txt', 'r') as f:
...     print(get_all_xattrs(f.fileno()))
...
{'user.foo': 'bar'}