libfuse: fuse_config Struct Reference

libfuse

Data Fields
fuse_config Struct Reference

`#include <fuse.h>`

## Data Fields
int32_t | set_gid
int32_t | set_uid
int32_t | set_mode
double | entry_timeout
double | negative_timeout
double | attr_timeout
int32_t | intr
int32_t | intr_signal
int32_t | remember
int32_t | hard_remove
int32_t | use_ino
int32_t | readdir_ino
int32_t | direct_io
int32_t | kernel_cache
int32_t | auto_cache
int32_t | nullpath_ok
int32_t | show_help
uint32_t | fmask
int32_t | no_rofd_flush
int32_t | parallel_direct_writes
uint32_t | flags
uint64_t | reserved [48]

## Detailed Description

Configuration of the high-level API

This structure is initialized from the arguments passed to fuse_new(), and then passed to the file system's init() handler which should ensure that the configuration is compatible with the file system implementation.

Note: this data structure is ABI sensitive, new options have to be appended at the end of the structure

Definition at line 101 of file fuse.h.

## Field Documentation

## ◆ attr_timeout

double fuse_config::attr_timeout

The timeout in seconds for which file/directory attributes (as returned by e.g. the `getattr` handler) are cached.

Definition at line 143 of file fuse.h.

## ◆ auto_cache

int32_t fuse_config::auto_cache

This option is an alternative to `kernel_cache`. Instead of unconditionally keeping cached data, the cached data is invalidated on open(2) if if the modification time or the size of the file has changed since it was last opened.

Definition at line 253 of file fuse.h.

## ◆ direct_io

int32_t fuse_config::direct_io

This option disables the use of page cache (file content cache) in the kernel for this filesystem. This has several affects:

1. Each read(2) or write(2) system call will initiate one or more read or write operations, data will not be cached in the kernel.
2. The return value of the read() and write() system calls will correspond to the return values of the read and write operations. This is useful for example if the file size is not known in advance (before reading it).

Internally, enabling this option causes fuse to set the `direct_io` field of `struct fuse_file_info` - overwriting any value that was put there by the file system.

Definition at line 226 of file fuse.h.

## ◆ entry_timeout

double fuse_config::entry_timeout

The timeout in seconds for which name lookups will be cached.

Definition at line 127 of file fuse.h.

## ◆ flags

uint32_t fuse_config::flags

Reserved for future use.

Definition at line 318 of file fuse.h.

## ◆ fmask

uint32_t fuse_config::fmask

`fmask` and `dmask` function the same way as `umask`, but apply to files and directories separately. If non-zero, `fmask` and `dmask` take precedence over the `umask` setting.

Definition at line 288 of file fuse.h.

## ◆ hard_remove

int32_t fuse_config::hard_remove

The default behavior is that if an open file is deleted, the file is renamed to a hidden file (.fuse_hiddenXXX), and only removed when the file is finally released. This relieves the filesystem implementation of having to deal with this problem. This option disables the hiding behavior, and files are removed immediately in an unlink operation (or in a rename operation which overwrites an existing file).

It is recommended that you not use the hard_remove option. When hard_remove is set, the following libc functions fail on unlinked files (returning errno of ENOENT): read(2), write(2), fsync(2), close(2), f*xattr(2), ftruncate(2), fstat(2), fchmod(2), fchown(2)

Definition at line 185 of file fuse.h.

## ◆ intr

int32_t fuse_config::intr

Allow requests to be interrupted

Definition at line 148 of file fuse.h.

## ◆ intr_signal

int32_t fuse_config::intr_signal

Specify which signal number to send to the filesystem when a request is interrupted. The default is hardcoded to USR1.

Definition at line 155 of file fuse.h.

## ◆ kernel_cache

int32_t fuse_config::kernel_cache

This option disables flushing the cache of the file contents on every open(2). This should only be enabled on filesystems where the file data is never changed externally (not through the mounted FUSE filesystem). Thus it is not suitable for network filesystems and other intermediate filesystems.

NOTE: if this option is not specified (and neither direct_io) data is still cached after the open(2), so a read(2) system call will not always initiate a read operation.

Internally, enabling this option causes fuse to set the `keep_cache` field of `struct fuse_file_info` - overwriting any value that was put there by the file system.

Definition at line 245 of file fuse.h.

## ◆ negative_timeout

double fuse_config::negative_timeout

The timeout in seconds for which a negative lookup will be cached. This means, that if file did not exist (lookup returned ENOENT), the lookup will only be redone after the timeout, and the file/directory will be assumed to not exist until then. A value of zero means that negative lookups are not cached.

Definition at line 137 of file fuse.h.

## ◆ no_rofd_flush

int32_t fuse_config::no_rofd_flush

By default, fuse waits for all pending writes to complete and calls the FLUSH operation on close(2) of every fuse fd. With this option, wait and FLUSH are not done for read-only fuse fd, similar to the behavior of NFS/SMB clients.

Definition at line 297 of file fuse.h.

## ◆ nullpath_ok

int32_t fuse_config::nullpath_ok

If this option is given the file-system handlers for the following operations will not receive path information: read, write, flush, release, fallocate, fsync, readdir, releasedir, fsyncdir, lock, ioctl and poll.

For the truncate, getattr, chmod, chown and utimens operations the path will be provided only if the struct fuse_file_info argument is NULL.

Definition at line 273 of file fuse.h.

## ◆ parallel_direct_writes

int32_t fuse_config::parallel_direct_writes

Allow parallel direct-io writes to operate on the same file.

FUSE implementations which do not handle parallel writes on same file/region should NOT enable this option at all as it might lead to data inconsistencies.

For the FUSE implementations which have their own mechanism of cache/data integrity are beneficiaries of this setting as it now open doors to parallel writes on the same file (without enabling this setting, all direct writes on the same file are serialized, resulting in huge data bandwidth loss).

Definition at line 312 of file fuse.h.

## ◆ readdir_ino

int32_t fuse_config::readdir_ino

If use_ino option is not given, still try to fill in the d_ino field in readdir(2). If the name was previously looked up, and is still in the cache, the inode number found there will be used. Otherwise it will be set to -1. If use_ino option is given, this option is ignored.

Definition at line 207 of file fuse.h.

## ◆ remember

int32_t fuse_config::remember

Normally, FUSE assigns inodes to paths only for as long as the kernel is aware of them. With this option inodes are instead remembered for at least this many seconds. This will require more memory, but may be necessary when using applications that make use of inode numbers.

A number of -1 means that inodes will be remembered for the entire life-time of the file-system process.

Definition at line 167 of file fuse.h.

## ◆ reserved

uint64_t fuse_config::reserved

Reserved for future use.

Definition at line 323 of file fuse.h.

## ◆ set_gid

int32_t fuse_config::set_gid

If `set_gid` is non-zero, the st_gid attribute of each file is overwritten with the value of `gid`.

Definition at line 106 of file fuse.h.

## ◆ set_mode

int32_t fuse_config::set_mode

If `set_mode` is non-zero, the any permissions bits set in `umask` are unset in the st_mode attribute of each file.

Definition at line 120 of file fuse.h.

## ◆ set_uid

int32_t fuse_config::set_uid

If `set_uid` is non-zero, the st_uid attribute of each file is overwritten with the value of `uid`.

Definition at line 113 of file fuse.h.

## ◆ show_help

int32_t fuse_config::show_help

These 3 options are used by libfuse internally and should not be touched.

Definition at line 279 of file fuse.h.

## ◆ use_ino

int32_t fuse_config::use_ino

Honor the st_ino field in the functions getattr() and fill_dir(). This value is used to fill in the st_ino field in the stat(2), lstat(2), fstat(2) functions and the d_ino field in the readdir(2) function. The filesystem does not have to guarantee uniqueness, however some applications rely on this value being unique for the whole filesystem.

Note that this does not affect the inode that libfuse and the kernel use internally (also called the "nodeid").

Definition at line 198 of file fuse.h.

The documentation for this struct was generated from the following files:

- fuse-3.17.4/include/fuse.h
- fuse-3.18.1/include/fuse.h
- include/fuse.h