aboutsummaryrefslogtreecommitdiffstats
path: root/include
AgeCommit message (Collapse)AuthorLines
2025-09-16libfuse: don't put HAVE_STATX in a public headerDarrick J. Wong-4/+0
fuse.h and fuse_lowlevel.h are already forward declaring struct statx, there is no need for HAVE_STATX anymore. HAVE_STATX also bears the risk to conflict with an application define. Alternatively it would have been possible to change to HAVE_FUSE_STATX. Get rid of the conditionals in the public header files and also remove HAVE_STATX definition from the public libfuse_config.h. Edit by Bernd: Commit message and removal of HAVE_STATX from public libfuse_config.h. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
2025-09-13libfuse: fix COPY_FILE_RANGE interfaceMiklos Szeredi-1/+11
The FUSE protocol uses struct fuse_write_out to convey the return value of copy_file_range, which is restricted to uint32_t. But the COPY_FILE_RANGE interface supports a 64-bit size copies. Currently the number of bytes copied is silently truncated to 32-bit, which is unfortunate at best. Implement the COPY_FILE_RANGE_64 interface which is identical to the old one, except the number of bytes copied is returned in a 64-bit value. The library interface remains the same. If the kernel does not support the new interface or the server is running as a 32-bit process, limit the copy size to size to UINT_MAX - 4096. Edit by Bernd: Keep ioctl_64bit and add use new bit is_copy_file_range_64 to keep flags separated from each other - easier code readability IMO. Reported-by: Florian Weimer <fweimer@redhat.com> Closes: https://lore.kernel.org/all/lhuh5ynl8z5.fsf@oldenburg.str.redhat.com/ Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Signed-off-by: Bernd Schubert <bschubert@ddn.com>
2025-08-22Allow applications to retrieve the req payload (io-uring only)Bernd Schubert-0/+18
With io-uring the req owns the payload buffer, the application can directly access it and copy data into it. fuse_buf_copy_one() already has a check for dstmem == srcmem and skips data copies. fuse_reply_data fuse_reply_data_uring fuse_buf_copy fuse_buf_copy_one Signed-off-by: Bernd Schubert <bschubert@ddn.com>
2025-08-19tests: move struct size assertions into a testCismonX-10/+0
These checks are meant for libfuse maintainers only, and should not be exposed to users. Signed-off-by: CismonX <admin@cismon.net>
2025-07-16Add statx supportJoanne Koong-1/+52
This commit adds libfuse support for FUSE_STATX requests on linux distributions. Currently, statx is only supported on linux. To make the interface a ergonomic as possible (eg using native 'struct statx' vs 'struct fuse_statx'), this implementation gates the 'struct statx' changes by #ifdef linux. Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
2025-06-27license: s/COPYING/GPL2.txt, s/COPYING.LIB/LGPL2.txtizxl007-6/+6
Signed-off-by: izxl007 <zeng.zheng@zte.com.cn>
2025-06-18fuse: add support to FUSE_NOTIFY_INC_EPOCHLuis Henriques-1/+19
This patch adds support for the FUSE INC_EPOCH notify. This new operation simply increments the FUSE connection epoch value, allowing to invalidate all the dentries next time they are revalidated. Signed-off-by: Luis Henriques <luis@igalia.com>
2025-05-20conn->want conversion: Fix fuse_apply_conn_info_opts()Bernd Schubert-19/+31
fuse_apply_conn_info_opts() was applying to 'want_ext', which would cause conflicts with 'want' if the application applied its own flags to 'conn->want'. Solution is: - to move fuse_{set,unset,get}_feature_flag and convert_to_conn_want_ext() to fuse_lowlevel.c and to define them as part of the public API, although convert_to_conn_want_ext() should not be used - it is currently needed to be a public function due as it needs to be defined for the tests. Related to https://github.com/libfuse/libfuse/issues/1171 and https://github.com/libfuse/libfuse/pull/1172. Closes: https://github.com/libfuse/libfuse/issues/1171 Signed-off-by: Bernd Schubert <bschubert@ddn.com>
2025-04-30Support request timeoutsJoanne Koong-1/+7
This adds the libfuse changes needed to support request timeouts. A timeout may be set by the server in its init call. If a request is not completed by the timeout, the connection will be aborted by the kernel. Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
2025-04-30Update include/fuse_kernel.h to version 7.43Joanne Koong-2/+8
Sync include/fuse_kernel.h with the most up to date fuse uapi headers in the kernel. Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
2025-04-28Add fuse_req_is_uring() to check if a req comes through io-uringBernd Schubert-0/+5
This might be useful to optimize code paths. For example, with io-uring the request buffer is valid until the request is replied to, while without io-uring the request buffer is only valid in current thread context. Signed-off-by: Bernd Schubert <bschubert@ddn.com>
2025-04-28fuse_common.h: Prefix flags with 1ULBernd Schubert-29/+29
Ensure it is correctly stored in an unsigned 32 bit int. Signed-off-by: Bernd Schubert <bschubert@ddn.com>
2025-04-28Synchronize fuse_kernel.h with linux-6.14Bernd Schubert-2/+101
Also add FUSE_CAP_OVER_IO_URING Signed-off-by: Bernd Schubert <bschubert@ddn.com>
2025-04-09lib: remove second fuse_main_real_versioned declarationBen Dooks-3/+0
Newer gccs now use -Werror=redundant-decls which means that anyone including fuse.h is getting an error of: /usr/include/fuse3/fuse.h:959:5: error: redundant redeclaration of ‘fuse_main_real_versioned’ [-Werror=redundant-decls] 959 | int fuse_main_real_versioned(int argc, char *argv[], | ^~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/fuse3/fuse.h:885:5: note: previous declaration of ‘fuse_main_real_versioned’ with type ‘int(int, char **, const struct fuse_operations *, size_t, struct libfuse_version *, void *)’ {aka ‘int(int, char **, const struct fuse_operations *, long unsigned int, struct libfuse_version *, void *)’} 885 | int fuse_main_real_versioned(int argc, char *argv[], | ^~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
2025-04-04Fix static_assert build failure with C++ version < 11Giulio Benetti-3/+1
At the moment build fails due to lack of static_assert: https://gitlab.com/jolivain/buildroot/-/jobs/9606292537 this means that the check per date is not enough, so let's use meson to check if static_assert() is present or not and simplify fuse_static_assert() definition by only checking HAVE_STATIC_ASSERT. Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
2025-03-19Fix a comment typo "passed to the filesystem.n"Bernd Schubert-1/+1
Closes: https://github.com/libfuse/libfuse/issues/1168 Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
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>
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-17Add 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-09Rename 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-09Make 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-09Rename 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-01-13Update 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-01-06Make 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-01-06Avoid 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-01-03Fix 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.