aboutsummaryrefslogtreecommitdiffstats
path: root/include
AgeCommit message (Collapse)AuthorLines
2025-03-14fuse_common.h: Convert back FUSE_CAP_ from enum to definesBernd Schubert-322/+315
Some applications use that for detection of features between distributions/libfuse version. Closes: https://github.com/libfuse/libfuse/issues/1163 Signed-off-by: Bernd Schubert <bschubert@ddn.com> (cherry picked from commit 3ae5ca7443348aabad9bc71b9d5b0999f8292379)
2025-02-18Avoid nested function declarations in helper functionsBernd Schubert-43/+26
libfuse-3.17 introduced several functions that should only be called via inlined helper functions, never directly. To enforce this, these functions were declared within the inlined functions. However, this triggers the compiler warning "-Werror=nested-externs". While this warning is valid, the nested declarations were intentional to prevent direct usage of these functions. Rather than suppressing the warning with pragmas, move these function declarations outside the helper functions while maintaining the intended access restrictions through other means. Closes: https://github.com/libfuse/libfuse/issues/1134 Signed-off-by: Bernd Schubert <bschubert@ddn.com>
2025-02-18Add comment for fuse_passthrough_open()Maksim Harbachou-0/+2
See https://github.com/libfuse/libfuse/issues/1125 Signed-off-by: Maksim Harbachou <maksim.harbachou@resilio.com>
2025-02-10fuse_new version fixes: Change to fuse_new_versionedBernd Schubert-33/+10
Another additon for https://github.com/libfuse/libfuse/issues/1092 Use _fuse_new_versioned() instead of _fuse_new_317 and actually also remove symbol versioning for it - we don't need it. Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
2025-02-10fuse_new: Fix non symboled call to _fuse_new_317Bernd Schubert-1/+1
Acidentally the wrong non-existing function was ccalled. Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
2025-02-10Rename to fuse_session_new_versionedBernd Schubert-18/+7
Similar previous renames to fuse_main_real_versioned, but here for the low level fuse_session_new. Also remove symbol versioned as part of "fuse_session_new" as that function is not part of the official API/ABI and to allow easier access with dlopen/dlsym. Also switch back to a macro fuse_session_new, just in case some code has some expectations on that. Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
2025-02-10Make fuse_main a macro again and wrap that to fuse_main_fnBernd Schubert-3/+5
As suggested by Bill in Issue #1092 make fuse_main a macro again, just in case some applications expect it to be a macro. Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
2025-02-10Rename fuse_main_real_317 to fuse_main_real_versionedBernd Schubert-12/+15
As suggested by Bill in Issue #1092, rename to _versioned so that applications using dlopen/dlvsym better understand the meaning of this function. Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
2025-02-10Update doxygen/comments for fuse_reply_open/fuse_reply_createBernd Schubert-2/+4
Comments for fuse_reply_open and fuse_reply_create and with that doxygen had not been updated for parallel_direct_writes and others. Signed-off-by: Bernd Schubert <bschubert@ddn.com>
2025-02-10Make fuse_main_real() not symboledBernd Schubert-12/+29
Addresses https://github.com/libfuse/libfuse/issues/1092 We actually don't need to make fuse_main_real() symboled, as it is not part of the official API. The inlined function now always calls into fuse_main_real_317 and the compat ABI function (which should also be available for dlopen/dlsym) is now always compiled, independent if the compiler/linker support versioned symbols. Additionally, fuse_main_real() is also declared as inlined function and a warning message is created when that function is called. Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
2025-02-10Avoid global declarion of internal functions that are new in 3.17Bernd Schubert-28/+23
_fuse_new() is not supposed to be called by external users outside of internal functions or static inlined functions. This also removes several functions from lib/fuse_versionscript which where added and exported by commit 58f85bfa9b7d ("Add in the libfuse version a program...) as these are libfuse internal only. Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
2025-02-10Fix libfuse build with FUSE_USE_VERSION 30Amir Goldstein-1/+3
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
2024-12-30Convert FUSE_CAP defines to enum fuse_capabilityBernd Schubert-315/+322
Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
2024-12-30Add 64-bit conn::{capable,want}_ext fieldsBernd Schubert-4/+36
The previous fields are left for ABI compatibility, although it is not beautiful to add that complexity when we have to increase the so-version as we had ABI breakage anyway. example/printcap is simplified to use an array, as every line would have needed to be modified anyway. Missing 'FUSE_CAP_PASSTHROUGH' was added. Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
2024-12-30Use uint32_t for libfuse_versionBernd Schubert-4/+4
Should be used internally only, but is still in a common file - we better use arch independent values. Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
2024-12-30struct fuse_file_info extensionBernd Schubert-1/+17
Add a flags and reserved fields to struct fuse_file_info and add a static assert on the size. Also add another static assert for 'struct fuse_conn_info' Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
2024-12-30Use single bit for struct fuse_file_info::no_interruptBernd Schubert-1/+4
Now that we know the exact size of the integer we can use a single bit and reserve the other bits. Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
2024-12-30Use (u)int32_t for struct fuse_conn_infoBernd Schubert-16/+16
Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
2024-12-30Add padding3 in struct fuse_file_infoBernd Schubert-0/+1
pahole was showing a 4 byte hole - add another padding to fill that hole. Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
2024-12-30Use (u)int32_t for struct fuse_file_infoBernd Schubert-10/+10
Enforce 32 bit integers for #struct fuse_file_info'. Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
2024-12-30Use (u)int32_t for struct fuse_config and extend the structBernd Schubert-24/+34
Enforce 32-bit integers for struct fuse_config and add future ABI fields to that struct. Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
2024-12-30Restore compat ABI in 'struct fuse_config'Bernd Schubert-8/+8
This fixes commit dad15aee26835 "Add no_rofd_flush mount option" and restores the ABI by moving the no_rofd_flush field. Given that there were already several releases with this commit we will still need an so version bump. Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
2024-12-30Restore compat ABI in 'struct fuse_file_info'Bernd Schubert-19/+20
This fixes commit a5eb7f2 "Enable parallel direct writes on the same file" and restores the ABI by moving the parallel_direct_writes bit. Given that there were already several releases with this commit we will still need an so version bump. Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
2024-11-27support FUSE_TMPFILE in the low level APIHorst Birthelmer-0/+23
Note that name hashes and using paths as parameters makes it very hard to support anonymous files in the high level API. Known Issues: - tests have to bail out when O_TMPFILE is not supported. This will always be the case with high level passthrough implementations. - test_create_and_link_tmpfile has to be skipped due to unidentified problems with github runner
2024-11-21Reallocate fuse_session buffer transparently for extended max writesJoanne Koong-0/+9
A previous PR supported extended max writes (eg write requests larger than 1 MB) by initializing the fuse session buffer size to use the max_pages_limit set in /proc/sys/fs/fuse. However, this is a huge problem for machines where multiple fuse servers may be running but only one server needs large writes. In this case, a lot of memory will be wasted and will lead to OOM issues. This PR does a reallocation of the session buffer transparently if the server set "se->conn.max_write" to a value larger than 1 MiB. This is only for buffers that are "owned" by libfuse - if the server wishes to provide its own allocated buffer for receiving/processing requests, then it should ensure that buffer is allocated to the proper size from the start. Local testing showed: echo 65535 | sudo tee /proc/sys/fs/fuse/max_pages_limit dd if=/dev/urandom of=hello_file bs=6M count=2 write requests: write request size is 5242880 write request size is 1048576 write request size is 5242880 write request size is 1048576
2024-11-13Add FUSE_CAP_NO_EXPORT and use it in passthrough_hpBernd Schubert-0/+8
This should stop some more xfstest test failures.
2024-11-13Add fuse_set_feature_flag() / fuse_unset_feature_flagBernd Schubert-0/+18
Simplify setting feature flags a bit by adding a helper function. Also move the check for valid flags into a funtion we can re-use in a later patch.
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.