FUSE API Functions

llfuse.init(ops, mountpoint, list args)

Initialize and mount FUSE file system

ops has to be an instance of the Operations class (or another class defining the same methods).

args has to be a list of strings. Valid options are listed under struct fuse_opt fuse_mount_opts[] (mount.c:82) and struct fuse_opt fuse_ll_opts[] (fuse_lowlevel_c:2209).

llfuse.main(single=False)

Run FUSE main loop

If single is True, all requests will be handled sequentially by the thread that has called main. If single is False, multiple worker threads will be started and work on requests concurrently.

llfuse.close(unmount=True)

Unmount file system and clean up

If unmount is False, only clean up operations are peformed, but the file system is not unmounted. As long as the file system process is still running, all requests will hang. Once the process has terminated, these (and all future) requests fail with ESHUTDOWN.

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 the os.setxattr function from the standard library, the method provided by llfuse is also available for non-Linux systems.

llfuse.getxattr(path, name, 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 the os.setxattr function from the standard library, the method provided by 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.invalidate_inode(inode, attr_only=False)

Invalidate cache for inode

Instructs the FUSE kernel module to forgot cached attributes and data (unless attr_only is True) for inode. This operation is carried out asynchronously, i.e. the method may return before the kernel has executed the request.

llfuse.invalidate_entry(inode_p, name)

Invalidate directory entry

Instructs the FUSE kernel module to forget about the directory entry name in the directory with inode inode_p. This operation is carried out asynchronously, i.e. the method may return before the kernel has executed the request.

llfuse.get_ino_t_bits()

Return number of bits available for inode numbers

Attempts to use inode values that need more bytes will result in OverflowError.

llfuse.get_off_t_bits()

Return number of bytes available for file offsets

Attempts to use values whose representation needs more bytes will result in OverflowError.

Table Of Contents

Previous topic

Getting started

Next topic

Data Structures