aboutsummaryrefslogtreecommitdiffstats
path: root/example/passthrough.c
AgeCommit message (Collapse)AuthorLines
2025-07-16Add statx supportJoanne Koong-0/+21
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-07-13example/passthrough: tidy up passthrough_helpers.hCismonX-4/+0
Add header guards, include system headers as needed, and declare helper functions as inline. This ensures that the helper header could be properly included. Signed-off-by: CismonX <admin@cismon.net>
2025-07-13example/passthrough: refactor fallocateCismonX-8/+1
Move fallocate implementation to passthrough_helpers.h, so that it could be reused by multiple passthrough examples. Signed-off-by: CismonX <admin@cismon.net>
2025-06-27license: s/COPYING/GPL2.txt, s/COPYING.LIB/LGPL2.txtizxl007-1/+1
Signed-off-by: izxl007 <zeng.zheng@zte.com.cn>
2025-01-03example/passthrough: Enable testing of readdirplus without fill offsetsAmir Goldstein-6/+13
passthrough example supports the --plus command line argument to reply to readdirplus with fill_dir_plus and unspecified (0) fill offsets. As explained in this comment: https://github.com/libfuse/libfuse/pull/896#issuecomment-1978917041 passthrough example needs a few more changes to be able to test commit dd95d13a ("fix readdirplus when filler is called with zero offset (#896)) With the changes in this commit, readdirplus without fill offsets can be tested to verify the readdirplus fix above with command line: passthrough --plus -o auto_cache,modules=subdir,subdir=/src /mnt Signed-off-by: Amir Goldstein <amir73il@gmail.com>
2024-02-26Enable direct IO for passthrough examples when open has flag O_DIRECTyangyun-0/+8
Shared locks (parallel_direct_writes) cannot be enabled for O_DIRECT, as O_DIRECT may be set past file open time with fcntl(fd, F_SETFD, ...). Kernel side fuse has precautions for shared lock direct-IO (direct_io in libfuse), as it needs an exclusive inode lock when direct and page cache IO happend at the same time. In order to enjoy the parallel_direct_writes feature (i.e., get a shared lock, not exclusive lock) for writes to the same file), direct_io is needed. The feature direct_io is corresponding to FOPEN_DIRECT_IO in fuse kernel. FOPEN_DIRECT_IO and O_DIRECT are not entirely the same as described above. So enable direct_io (i.e., FOPEN_DIRECT_IO in fuse kernel) to enjoy parallel direct_writes. Some patches related to FOPEN_DIRECT_IO and O_DIRECT are below: https://lore.kernel.org/all/753d6823-e984-4730-a126-d66b65ea772c@ddn.com
2024-02-23passthrough_example: make parallel_direct_writes more clearlyyangyun-2/+7
Move the parallel_direct_writes enable action to the init function in high level API, it is more recommended just like commit 8ee553dac. Besides, add some comments to show that the feature parallel_direct_writes is depend on the feature direct_io (refer to kernel side patch series to consolidate direct IO, link: https://lwn.net/ml/linux-fsdevel/ 20230918150313.3845114-1-bschubert@ddn.com for the reason).
2023-10-11Enabled parallel direct IO writes for passthrough examplesBernd Schubert-0/+2
All these passthrough examples don't need writes to be serialized. Actually, most file systems probably handle non serialized parallel direct writes - the FOPEN_PARALLEL_DIRECT_WRITES flag is just to avoid a regression for those file system that rely on serialized DIO writes in fuse kernel. Passthrough file system forward the IO to another file system, which actually handles that internally - serialized in fuser kernel is not needed.
2023-01-28Install a the configure_file (config.h) and use in headersBernd Schubert-4/+0
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.
2021-03-18Fix returning d_ino and d_type by readdir(3) in non-plus modeJean-Pierre André-2/+16
When not using the readdir_plus mode, the d_type was not returned, and the use_ino flag was not used for returning d_ino. This patch fixes the returned values for d_ino and d_type by readdir(3) The test for the returned value of d_ino has been adjusted to also take the d_type into consideration and to check the returned values in both basic readdir and readdir_plus modes. This is done by executing the passthrough test twice. Co-authored-by: Jean-Pierre André <jpandre@users.sourceforge.net>
2021-02-03Fix returning inode numbers from readdir() in offset==0 mode. (#584)Martin Pärtel-1/+1
- Test added for all passthrough examples. - passthrough.c uses offset==0 mode. The others don't. - passthrough.c changed to set FUSE_FILL_DIR_PLUS to make the test pass. - This fixes #583.
2021-01-01Fix FUSE_COPY_FILE_RANGE in the passthrough example (#575)Alan Somers-2/+4
Only close the file descriptors if they were just opened. Otherwise, the second FUSE_COPY_FILE_RANGE operation on any given file will fail with EBADF.
2020-03-13State GPL version in comment (#485)Dr. David Alan Gilbert-1/+1
IN a bunch of comments we say 'under the terms of the GNU GPL', make it clear this is GPLv2 (as LICENSE says). Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2020-01-30examples: mark ops variables constant (#496)zsugabubus-1/+1
2019-11-03Implement lseek operation (#457)Yuri Per-0/+23
2019-05-15passthrough: fix unix-domain sockets on FreeBSD (#413)Alan Somers-10/+7
FreeBSD doesn't allow creating sockets using mknod(2). Instead, one has to use socket(2) and bind(2). Add appropriate logic to the examples and add a test case.
2018-11-19examples: add copy_file_range() support to passthrough(_fh)Niels de Vos-0/+45
The passthrough example filesystem can be used for validating the API and the implementation in the FUSE kernel module.
2017-07-08Added public fuse_lib_help(), bumped minor versionNikolaus Rath-1/+1
2017-05-31Revert "example/passthrough.c: add debugging code for issue #157."Nikolaus Rath-9/+2
This reverts commit 179fa13b40387645e722089873079488f9dbe3d8.
2017-05-25example/passthrough.c: add debugging code for issue #157.Nikolaus Rath-2/+9
2017-04-07passthrough: implemented create()Nikolaus Rath-0/+14
This allows calls like open(file, O_CREAT|O_RDONLY, 0200) which would otherwise fail because we cannot open the file after mknod() has created it with 0200 permissions.
2017-04-07example/passthrough: use fi->fh for read, write, fallocateNikolaus Rath-7/+21
No reason not to use it. May even be a little faster and will consume less resources :-).
2017-04-07passthrough:truncate(): work on file descriptor when possibleNikolaus Rath-2/+4
This allows truncating an open file even if write permission was removed after open() (which is the expected behavior).
2017-04-07example/passthrough: close open files in release()Nikolaus Rath-5/+2
That way we can use the file descriptor for other operations.
2017-04-07passthrough, passthrough_fh: disable attribute cachingNikolaus Rath-0/+12
Required for better hardlink handling, see comments in patch.
2016-12-04Fix a grammatical error.Jay Hankins-1/+1
2016-10-28Clean-up doxygen documentationNikolaus Rath-4/+3
Fixes: #81.
2016-10-20fuse_new(): don't accept options that don't make sense for end-usersNikolaus Rath-0/+9
Several options (use_ino, etc) depend on the file system implementation. Allowing them to be set from the command line makes no sense.
2016-10-15Pass fuse_file_info to getattr, chown, chmod, truncate, utimens handlersNikolaus Rath-5/+15
This obsoletes the ftruncate & fgetattr handlers. Fixes #58.
2016-10-09Renamed some examples to make their function more obviousNikolaus Rath-0/+432
Also, added more comments for the same purpose.