Utility Functions

The following functions do not necessarily translate to calls to the FUSE library. They are provided because they’re potentially useful when implementing file systems in Python.

llfuse.setxattr(path, name, value, namespace=u'user')

Set extended attribute

path and name have to be of type str. In Python 3.x, they may contain surrogates. value has to be of type bytes.

Under FreeBSD, the namespace parameter may be set to system or user to select the namespace for the extended attribute. For other platforms, this parameter is ignored.

In contrast to the os.setxattr function from the standard library, the method provided by Python-LLFUSE is also available for non-Linux systems.

llfuse.getxattr(path, name, size_t size_guess=128, namespace=u'user')

Get extended attribute

path and name have to be of type str. In Python 3.x, they may contain surrogates. Returns a value of type bytes.

If the caller knows the approximate size of the attribute value, it should be supplied in size_guess. If the guess turns out to be wrong, the system call has to be carried out three times (the first call will fail, the second determines the size and the third finally gets the value).

Under FreeBSD, the namespace parameter may be set to system or user to select the namespace for the extended attribute. For other platforms, this parameter is ignored.

In contrast to the os.getxattr function from the standard library, the method provided by Python-LLFUSE is also available for non-Linux systems.

llfuse.listdir(path)

Like os.listdir, but releases the GIL.

This function returns an iterator over the directory entries in path. The returned values are of type str in both Python 2.x and 3.x.

In Python 2.x str is equivalent to bytes so all names can be represented. In Python 3.x, surrogate escape coding (cf. PEP 383) is used for directory names that do not have a string representation.

llfuse.get_sup_groups(pid)

Return supplementary group ids of pid

This function is relatively expensive because it has to read the group ids from /proc/[pid]/status. For the same reason, it will also not work on systems that do not provide a /proc file system.

Returns a set.