FUSE API Functions¶
-
llfuse.
init
(ops, mountpoint, options=default_options)¶ 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 set of strings.
default_options
provides some reasonable defaults. It is recommended to use these options as a basis and add or remove options as necessary. For example:my_opts = set(llfuse.default_options) my_opts.add('allow_other') my_opts.discard('default_permissions') llfuse.init(ops, mountpoint, my_apts)
Valid options are listed under
struct fuse_opt fuse_mount_opts[]
(mount.c:82) andstruct fuse_opt fuse_ll_opts[]
(fuse_lowlevel_c:2626).
-
llfuse.
main
(workers=None)¶ Run FUSE main loop
workers specifies the number of threads that will process requests concurrently. If workers is
None
, llfuse will pick a reasonable number bigger than one. If workers is1
all requests will be processed by the thread callingmain
.This function will also start additional threads for internal purposes (even if workers is
1
). These (and all worker threads) are guaranteed to have terminated whenmain
returns.While this function is running, special signal handlers will be installed for the SIGTERM, SIGINT (Ctrl-C), SIGHUP and SIGPIPE signals. SIGPIPE will be ignored, while the other three signals will cause request processing to stop and the function to return. SIGINT (Ctrl-C) will thus not result in a
KeyboardInterrupt
exception while this function is runnnig.When the function returns because the file system has received an unmount request it will return
None
. If it returns because it has received a signal, it will return the signal number.
-
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.
invalidate_inode
(fuse_ino_t 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
(fuse_ino_t 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.
notify_store
(inode, offset, data)¶ Store data in kernel page cache
Sends data for the kernel to store it in the page cache for inode at offset. If this provides data beyond the current file size, the file is automatically extended.
If this function raises an exception, the store may still have completed partially.
-
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
.