aboutsummaryrefslogtreecommitdiffstats
path: root/include
AgeCommit message (Collapse)AuthorLines
2024-09-23add version check for the fuse_loop_cfg* operationsyangyun-2/+13
fuse_loop_cfg* operations are introduced in fuse version 312 and can not be used in an early version. Also fix some typo.
2024-09-12getattr: Make use of FUSE_GETATTR_FH in lowlevel examplesBernd Schubert-1/+1
High level examples were already using it, but not lowlevel. Also update the documentation.
2024-08-01synchronize fuse_kernel.h with linux-6.10Bernd Schubert-1/+17
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
2024-07-29Add MS_NOSYMFOLLOW compat definitionBernd Schubert-1/+8
After commit 54466d2c426b compilation was failing on my debian VM.
2024-07-14Add syslog and fatal signal handler featureBernd Schubert-0/+29
I see random ENOTCONN failures in xfstest generic/013 and generic/014 in my branch, but earliest on the 2nd run - takes ~12hours to get the issue, but then there are no further information logged. ENOTCONN points to a daemon crash - I need backtraces and a core dump. This adds optional handling of fatal signals to print a core dump and optional syslog logging with these new public functions: fuse_set_fail_signal_handlers() In addition to the existing fuse_set_signal_handlers(). This is not enabled together with fuse_set_signal_handlers(), as it is change in behavior and file systems might already have their own fatal handlers. fuse_log_enable_syslog Print logs to syslog instead of stderr fuse_log_close_syslog Close syslog (for now just does closelog()) Code in fuse_signals.c is also updated, to be an array of signals, and setting signal handlers is now down with a for-loop instead of one hand coded set_one_signal_handler() per signal.
2024-07-03Annotate ABI sensitivness for some data structuresBernd Schubert-5/+16
These are not all ABI sensitive data structures yet. Also some space vs tab indentation issues are corrected.
2024-07-03high-level: add fmask and dmask optionsgandalfs_cat-0/+8
dmask: umask applied to directories fmask: umask applied to non-directories to get "typical" permission bits for regular files (0644) and directories (0755), a single umask option is not sufficient (or well, it isn't the way fuse implements it) there is precident for separate umask and dmask options in other filesystems (see for example fat: https://github.com/torvalds/linux/tree/master/fs/fat) this addition should not affect backward-compatibility; the original umask option retains the same meaning, but non-zero fmask or dmask will override it.
2024-06-04Add support for no_interrupt (#956)yangyun50-1/+11
The function fuse_session_process_buf_int() would do much things for FUSE_INTERRUPT requests, even there are no FUSE_INTERRUPT requests: 1. check every non-FUSE_INTERRUPT request and add these requests to the linked list(se->list) under a big lock(se->lock). 2. the function fuse_free_req() frees every request and remove them from the linked list(se->list) under a bing lock(se->lock). These operations are not meaningful when there are no FUSE_INTERRUPT requests, and have a great impact on the performance of fuse filesystem because the big lock for each request. In some cases, FUSE_INTERRUPT requests are infrequent, even none at all. Besides, the user-defined filesystem may do nothing for FUSE_INTERRUPT requests. And the kernel side has the option "no_interrupt" in struct fuse_conn. This kernel option can be enabled by return ENOSYS in libfuse for the reply of FUSE_INTERRUPT request. But I don't find the code to enable the "no_interrupt" kernel option in libfuse. So add the no_interrupt support, and when this operaion is enabled: 1. remove the useless locking operaions and list operations. 2. return ENOSYS for the reply of FUSE_INTERRUPT request to inform the kernel to disable FUSE_INTERRUPT request.
2024-06-01Fix compatibility issue around fuse_custom_io->clone_fd (#953)legezywzh-2/+22
Fixes: 73cd124d0408 ("Add clone_fd to custom IO (#927)") Signed-off-by: Xiaoguang Wang <lege.wang@jaguarmicro.com>
2024-05-13Enable passthrough mode for read/write operations (#919)Amir Goldstein-4/+71
Add support for filesystem passthrough read/write of files. When the FUSE_PASSTHROUGH capability is enabled, the FUSE server may decide, while handling the "open" or "create" requests, if the given file can be accessed by that process in "passthrough" mode, meaning that all the further read and write operations would be forwarded by the kernel directly to the backing file rather than to the FUSE server. All requests other than read or write are still handled by the server. This allows for an improved performance on reads and writes, especially in the case of reads at random offsets, for which no (readahead) caching mechanism would help, reducing the performance gap between FUSE and native filesystem access. Extend also the passthrough_hp example with the new passthrough feature. This example opens a kernel backing file per FUSE inode on the first FUSE file open of that inode and closes the backing file on the release of the last FUSE file on that inode. All opens of the same inode passthrough to the same backing file. A combination of fi->direct_io and fi->passthrough is allowed. It means that read/write operations go directly to the server, but mmap is done on the backing file. This allows to open some fds of the inode in passthrough mode and some fd of the same inode in direct_io/passthrough_mmap mode. Signed-off-by: Alessio Balsini <balsini@android.com> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
2024-05-13Add in the libfuse version a program was compiled with (#942)Bernd Schubert-27/+143
The API stays the same, the libfuse version comes from inlined functions, which are defined fuse_lowlevel.h and fuse.h. As these inlined functions are defined in the header files they get added into the application, similar as if these were preprocessor macros. Macro vs inlined function is then just a style issue - I personally prefer the latter. fuse_session_new() -> static inlinei, in the application _fuse_session_new -> inside of libfuse fuse_new() -> static inline, in the application _fuse_new() -> inside of libfuse Note: Entirely untested is the fuse 30 api - we need a test for it. And we do not have any ABI tests at all. Signed-off-by: Bernd Schubert <bernd.schubert@fastmail.fm>
2024-05-10Handle NO_OPEN/NO_OPENDIR support automatically (#949)Josef Bacik-3/+22
If the file system doesn't provide a ->open or an ->opendir, and the kernel supports FUSE_CAP_NO_OPEN_SUPPORT or FUSE_CAP_NO_OPENDIR_SUPPORT, allow the implementation to set FUSE_CAP_NO_OPEN*_SUPPORT on conn->want in order to automatically get this behavior. Expand the documentation to be more explicit about the behavior of libfuse in the different cases WRT this capability. Signed-off-by: Josef Bacik <josef@toxicpanda.com>
2024-05-07fuse_common.h: fix warning on _Static_assert() (#939)CismonX-1/+1
_Static_assert() is an ISO C11 feature. Make the check more standard-conformant so that the compiler won't give pedantic warnings.
2024-04-22 Use single place to define the version and increase version to 3.17.0 (#932)Bernd Schubert-6/+0
* Use single place to define the version Defining the version in fuse_common.h, is removed, it is defined through meson and provided by "libfuse_config.h". I.e. it avoids to define the version twice - once in meson and once in fuse_common.h. Ideal would be to set integers in the meson file and create the version string from these integers. However, meson requires that "project" is the first meson.build keyword - with that it requires to set the version from a string and then major/minor/hotfix integers are created from string split. Signed-off-by: Bernd Schubert <bernd.schubert@fastmail.fm> * Increase the version to 3.17.0 This is to prepare the branch for the next release. Signed-off-by: Bernd Schubert <bernd.schubert@fastmail.fm> --------- Signed-off-by: Bernd Schubert <bernd.schubert@fastmail.fm>
2024-04-18Add clone_fd to custom IO (#927)legezywzh-0/+1
Define a new clone_fd() helper for fuse_custom_io, users can implement their own clone fd logic. Signed-off-by: Xiaoguang Wang <lege.wang@jaguarmicro.com>
2024-04-02Add more documentation for FUSE_CAP_EXPORT_SUPPORT (#917)Bernd Schubert-0/+5
Add more documentation for FUSE_CAP_EXPORT_SUPPORT Also remove the flag from passthrough_ll.c and passthrough_hp.cc as these implementations do _not_ handle that flag. They just cast fuse_ino_t to an inode and cause a heap buffer overflow for unknown objects (simplest reproducer are the examples in "man 2 open_by_handle_at", but to unmount/mount the file system after name_to_handle_at and before open_by_handle_at). Fixes https://github.com/libfuse/libfuse/issues/838 --------- Co-authored-by: Nikolaus Rath <Nikolaus@rath.org>
2024-03-29Add support for FUSE_CAP_HANDLE_KILLPRIV_V2Bernd Schubert-0/+17
This just adds in the basic handler, but does not use it yet in examples.
2024-03-27Fix FUSE_CAP_DIRECT_IO_ALLOW_MMAP - use new numerical valueBernd Schubert-1/+1
Commit 22741f5 accidentally re-used (1 << 27), which is already taken for FUSE_CAP_SETXATTR_EXT. Fortunately not part of any release yet.
2024-03-20Add FUSE_FILL_DIR_DEFAULTS enum (#903)FredyVia-0/+2
In order to use the fuse_fill_dir_t function in a C++ program, add the enum item: FUSE_FILL_DIR_DEFAULTS Without this change g++ compilation failed with example/hello.c:94:35: error: invalid conversion from ‘int’ to ‘fuse_fill_dir_flags’ [-fpermissive] 94 | filler(buf, ".", NULL, 0, 0); | ^ | | | int
2024-01-20Add processing for FUSE_CAP_HANDLE_KILLPRIV and disable it by defaultbigbrotherwei-1/+1
'FUSE_CAP_HANDLE_KILLPRIV' is not enabled by default anymore, as that would be a sudden security issue introduced by a new ABI and API compatible libfuse version.
2024-01-10Don't set FUSE_CAP_PARALLEL_DIROPS by defaultMiklos Szeredi-2/+0
Allowing parallel dir operations could result in a crash in a filesystem implementation that is not prepared for this. To be safe keep this flag off by default (this is not a regression, since there was no public release where this flag wasn't ignored). If the filesystem wants better performance, then it should set this flag explicitly. Fixes: c9905341ea34 ("Pass FUSE_PARALLEL_DIROPS to kernel (#861)") Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
2024-01-10Add FUSE_CAP_DIRECT_IO_ALLOW_MMAP and use in passthrough_hpBernd Schubert-0/+9
This is not called FUSE_CAP_DIRECT_IO_RELAX, as the kernel flag FUSE_DIRECT_IO_RELAX is supposed to be renamed to FUSE_DIRECT_IO_ALLOW_MMAP. The corresponding kernel patches just did not land yet.
2024-01-10Add in rename to FUSE_DIRECT_IO_ALLOW_MMAPBernd Schubert-4/+6
Add in the rename of FUSE_DIRECT_IO_RELAX to FUSE_DIRECT_IO_ALLOW_MMAP.
2024-01-10Synchronize fuse_kernel.h from current linux masterBernd Schubert-1/+62
2023-11-19Clarify fuse_lowlevel poll() docstring (#862)George Hilliard-7/+10
The original docstring was confusing; it was not clear that the ph must be retained indefinitely, nor was it clear that the client *also* needs to reply to the poll call immediately. Clarify this by explaining that it is only necessary to retain a single handle, that the client must retain ph, and that it must immediately call reply.
2023-10-28Update fuse_common.h (#855)Caian Benedicto-1/+1
2023-10-09Fixes typo in fuse.h (#844)Nikola Petrov-1/+1
2023-08-08Released fuse-3.16.1Nikolaus Rath-1/+1
2023-06-30Make expire only function fail if no kernel support (#789)HereThereBeDragons-15/+15
2023-06-29Clarify behavior of fuse_session_exit().Nikolaus Rath-3/+6
2023-06-09Released 3.15.0Nikolaus Rath-1/+1
2023-05-12Do not pass unsupported mount options to the kernel.Nikolaus Rath-0/+6
The filesystem daemon is responsible for implementing eg. st_atime updates, so passing options like relatime to the kernel results in them being silently ignored. Instead, such options need to be interpreted (and filtered out) by the filesystem daemon.
2023-04-11Update fuse_kernel.h to state of linux-6.3Bernd Schubert-13/+244
This syncs fuse_kernel.h to <linux-6.3>/include/uapi/linux/fuse.h Special handling is done for setxattr as in linux commit 52a4c95f4d24b struct fuse_setxattr_in was extended. Extended struct is only used when FUSE_SETXATTR_EXT is passed in FUSE_INIT reply.
2023-04-11Fix doxygen warning about parameter nameMatthias Goergens-1/+1
Before: ``` $ doxygen doc/Doxyfile /Users/matthias/prog/fuser/libfuse/include/fuse.h:934: warning: argument 'private_data' of command @param is not found in the argument list of fuse_new_31(struct fuse_args *args, const struct fuse_operations *op, size_t op_size, void *user_data) /Users/matthias/prog/fuser/libfuse/include/fuse.h:934: warning: The following parameter of fuse_new_31(struct fuse_args *args, const struct fuse_operations *op, size_t op_size, void *user_data) is not documented: parameter 'user_data' ```
2023-04-06Fix MS_LAZYTIME not defined on uclibc and move all MS_* and UMOUNT_* (#753)Giulio Benetti-0/+42
as well as <sys/mount.h> inclusion to new fuse_mount_compat.h file. Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
2023-03-29Fix typos and configure spellcheck for PRsYaroslav Halchenko-2/+2
2023-03-26Revert "upgrade of fuse_kernel.h based on Miklos expire_only kernel patch ↵Nikolaus Rath-190/+11
https://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git/commit/?h=for-next&id=53e949edb7692dce02220eba926c9d75ecbb47f7" This reverts commit 7f430a39db5a30979d75a906af891a38ebce1a3c because it breaks setxattr(). Fixes: #730
2023-03-03Enable parallel direct writes on the same file.Dharmendra singh-3/+22
Right now fuse kernel serializes direct writes on the same file. This serialization is good for such FUSE implementations which rely on the inode lock to avoid any data inconsistency issues but it hurts badly such FUSE implementations which have their own mechanism of dealing with cache/data integrity and can handle parallel direct writes on the same file. This patch allows parallel direct writes on the same file to be enabled with the help of a flag FOPEN_PARALLEL_DIRECT_WRITES. FUSE implementations which want to use this feature can set this flag during fuse init. Default behaviour remains same i.e no parallel direct writes on the same file. Corresponding fuse kernel patch(Merged). https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v6.2&id=153524053bbb0d27bb2e0be36d1b46862e9ce74c
2023-03-01Update description of keep_cache.Nikolaus Rath-5/+4
2023-02-17Released 3.14.0Nikolaus Rath-1/+1
2023-02-09fuse_lowlevel.h: add more setattr flagsXiubo Li-0/+8
Such as for the xfstest-dev's generic/684 test case it will clear suid and sgid if the fallocate request is commited by an unprivileged user. The kernel fuse passed the ATTR_KILL_SUID/ATTR_KILL_SGID flags to userspace but it will be dropped. Signed-off-by: Xiubo Li <xiubli@redhat.com>
2023-02-09Split config.h into private and public configBernd Schubert-7/+12
This addresses https://github.com/libfuse/libfuse/issues/729 commit db35a37def14b72181f3630efeea0e0433103c41 introduced a public config.h (rename to fuse_config.h to avoid conflicts) that was installed with the package and included by libfuse users through fuse_common.h. Probablem is that this file does not have unique defines so that they are unique to libfuse - on including the file conflicts with libfuse users came up. In principle all defines could be prefixed, but then most of them are internal for libfuse compilation only. So this splits out publically required defines to a new file 'libfuse_config.h' and changes back to include of "fuse_config.h" only when HAVE_LIBFUSE_PRIVATE_CONFIG_H is defined. This also renames HAVE_LIBC_VERSIONED_SYMBOLS to LIBFUSE_BUILT_WITH_VERSIONED_SYMBOLS, as it actually better explains for libfuse users what that variable is for.
2023-01-28Install a the configure_file (config.h) and use in headersBernd Schubert-0/+1
This addresses: https://github.com/libfuse/libfuse/issues/724 HAVE_LIBC_VERSIONED_SYMBOLS configures the library if to use versioned symbols and is set at meson configuration time. External filesystems (the main target, actually) include fuse headers and the preprocessor then acts on HAVE_LIBC_VERSIONED_SYMBOLS. Problem was now that 'config.h' was not distributed with libfuse and so HAVE_LIBC_VERSIONED_SYMBOLS was never defined with external tools and the preprocessor did the wrong decision. This commit also increases the the minimal meson version, as this depends on meson feature only available in 0.50 <quote 'meson' > WARNING: Project specifies a minimum meson_ version '>= 0.42' but uses features which were added in newer versions: * 0.50.0: {'install arg in configure_file'} </quote> Additionally the config file has been renamed to "fuse_config.h" to avoid clashes - 'config.h' is not very specific.
2023-01-15use off_t over __off64_tpsykose-4/+4
when -D_FILE_OFFSET_BITS=64 is defined, the off_t type is 64 bits wide already. the fuse_common.h header already checks for this, and errors when it is not, so be consistent with all the other uses of off_t. some libcs like musl do not have a 32-bit off_t type, and don't define __off64_t.
2023-01-13Released 3.13.0Nikolaus Rath-1/+1
2023-01-10Support application-defined I/O functions for FUSE fdTofik Sonono-0/+41
The io for FUSE requests and responses can now be further customized by allowing to write custom functions for reading/writing the responses. This includes overriding the splice io. The reason for this addition is that having a custom file descriptor is not sufficient to allow custom io. Different types of file descriptor require different mechanisms of io interaction. For example, some file descriptor communication has boundaries (SOCK_DGRAM, EOF, etc...), while other types of fd:s might be unbounded (SOCK_STREAMS, ...). For unbounded communication, you have to read the header of the FUSE request first, and then read the remaining packet data. Furthermore, the one read call does not necessarily return all the data expected, requiring further calls in a loop.
2023-01-06adding comments and capability discovery, enum for flags moved to top of fileHereThereBeDragons-4/+52
2023-01-06upgrade of fuse_kernel.h based on Miklos expire_only kernel patch ↵HereThereBeDragons-11/+190
https://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git/commit/?h=for-next&id=53e949edb7692dce02220eba926c9d75ecbb47f7
2023-01-06Initial patch provided by Miklos Szeredi <mszeredi@redhat.com>HereThereBeDragons-1/+15
2023-01-04Fixes when HAVE_LIBC_VERSIONED_SYMBOLS is not definedBernd Schubert-0/+12
fuse_loop_mt and fuse_new had not been defined when HAVE_LIBC_VERSIONED_SYMBOLS had not been set and additionally, fuse_new_31 was missing in the version script and was therefore an unusable symbol. This also adds a test for unset HAVE_LIBC_VERSIONED_SYMBOLS.