Ifile Functions

The ifile module provides methods for opening and reading Filesystem objects by inode number.

These methods could be used to make backups of a Filesystem or iterate selective areas of the Filesystem.


These objects require root permission to create


arcapix.fs.gpfs.clib.ifile.get_flags_strings(int flags)

Get strings for direntx flags integer.

Used to convert the d_flags value of direntx as returned by ireaddir`()

Returns:One or more of (JUNCTION, IJUNCTION, ORPHAN, NONE)
Return type:list of str
arcapix.fs.gpfs.clib.ifile.get_type_string(int type)

Get the type string for a direntx type integer.

Used to convert the d_type value of direntx as returned by ireaddir`()

Returns:One of (REG, DIR, LNK, DEL, OTHER)
Return type:str
arcapix.fs.gpfs.clib.ifile.iclose(ifile file)

Close an ifile object.

Parameters:fileifile to close
class arcapix.fs.gpfs.clib.ifile.ifile

The ifile object acts as a wrapper for the gpfs_ifile_t pointer.

arcapix.fs.gpfs.clib.ifile.iopen(fssnap_handle fssnap, gpfs_ino64_t ino, int flags=0)

Open an ifile object for the given inode.

  • fsnap (fssnap_handle) – fssnap handle identifying a filesystem or snapshot
  • ino (int) – Inode number of the file object to open
  • flags (int) – flags indicating open mode (default=0, readonly)

an open ifile object

Return type:


arcapix.fs.gpfs.clib.ifile.iread(ifile file, int buffersize, gpfs_off64_t offset=0)

Read bytes from an open ifile.

  • fileifile to read from. This should correspond to a regular file.
  • buffersize (int) – number of bytes to read
  • offset (int) – offset in file to start reading from (in bytes)

bytes read

Return type:


arcapix.fs.gpfs.clib.ifile.ireaddir(ifile idir)

Read entries from a directory.

This method can be used to iterate over the file objects in a directory.

>>> for ent in iter(lambda: ireaddir(idir), None):
...     # do stuff
Parameters:idirifile to read from. This should correspond to a directory.
Returns:a directory entry representing a file in the directory
Return type:direntx

Get the target of a Symlink by inode number.

  • fssnap (fssnap_handle) – Filesystem of snapshot to look in
  • ino (int) – inode number of the symlink to read
Return type: