aboutsummaryrefslogtreecommitdiff
path: root/lib/fuse.c
Commit message (Collapse)AuthorAge
* Remove unused member of 'struct fuse_dh'Gravatar Rostislav Skudnov2018-07-25
|
* Fix readdir() bug when a non-zero offset is specified in filler (#269)Gravatar Rostislav2018-07-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bug occurs when a filesystem client reads a directory until the end, seeks using seekdir() to some valid non-zero position and calls readdir(). A valid 'struct dirent *' is expected, but NULL is returned instead. Pseudocode demonstrating the bug: DIR *dp = opendir("some_dir"); struct dirent *de = readdir(dp); /* Get offset of the second entry */ long offset = telldir(dp); /* Read directory until the end */ while (de) de = readdir(de); seekdir(dp, offset); de = readdir(dp); /* de must contain the second entry, but NULL is returned instead */ The reason of the bug is that when the end of directory is reached, the kernel calls FUSE_READDIR op with an offset at the end of directory, so the filesystem's .readdir callback never calls the filler function, and we end up with dh->filled set to 1. After seekdir(), FUSE_READDIR is called again with a new offset, but this time the filesystem's .readdir callback is never called, and an empty reply is returned. Fix by setting dh->filled to 1 only when zero offsets are given to filler function.
* rename: perform user mode dir loop check when not done in kernelGravatar Bill Zissimooulos2018-05-18
| | | | Fix conditionals as per maintainer's request.
* rename: perform user mode dir loop check when not done in kernelGravatar Bill Zissimooulos2018-05-18
| | | | | | | | | | | | Linux performs the dir loop check (rename(a, a/b/c) or rename(a/b/c, a), etc.) in kernel. Unfortunately other systems do not perform this check (e.g. FreeBSD). This results in a deadlock in get_path2, because libfuse did not expect to handle such cases. We add a check_dir_loop function that performs the dir loop check in user mode and enable it on systems that need it.
* Fix uninitialised read in fuse_new_30() (#231) (#234)Gravatar Ashley Pittman2018-02-09
| | | | | | | Ensure that conf is always zero before it's read from to prevent sporadic failure at startup if higher layers were build against version 3.0 Signed-off-by: Ashley Pittman <ashley.m.pittman@intel.com>
* Backed out d92bf83Gravatar Nikolaus Rath2017-11-03
| | | | | | | | | This change is bogus. fuse_module_factory_t is already a pointer type. Additionally, if dlsym returns NULL, then you will be dereferencing it causing a segfault. In my testing, a segfault will happen even if dlsym returns successfully. Thanks to Michael Theall for spotting!
* Adding pointer dereferencing after calling dlsym()Gravatar Sangwoo Moon2017-09-27
| | | | | | dlsym() resolves the location of the loaded symbol, therefore dlsym() returns the type (fuse_module_factory_t *), not (fuse_module_factory_t). Added pinter dereferencing to correctly refer the factory function.
* fuse_lib_ioctl(): don't call memcpy with NULL argumentGravatar Nikolaus Rath2017-09-25
| | | | | This was detected by using clang's undefined behavior sanitizer, but didn't seem to cause problems in practice.
* Make *_loop_mt() available in version 3.0 againGravatar Nikolaus Rath2017-09-19
| | | | | | The old versions of these symbols were defined with version tag FUSE_3.0, so this is what we have to use in the .symver directive.
* Don't use external symbol names in internal filesGravatar Nikolaus Rath2017-09-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fuse_session_loop_mt() and fuse_loop_mt() symbols are only visible when linking against the shared object. The code in lib/, however, is compiled *into* the shared object and should thus use the internal names of these functions. Surprisingly enough, the code still worked before - but only when link time optimization was disabled. Unfortunately, we still can't compile with LTO because it seems that enabling LTO somehow makes the tagged symbols vanish. Without lto, we have: $ nm lib/libfuse3.so | grep fuse_new 0000000000011070 T fuse_new_30 0000000000010a00 t fuse_new_31 0000000000011070 T fuse_new@FUSE_3.0 0000000000010a00 T fuse_new@@FUSE_3.1 and with LTO: $ nm lib/libfuse3.so | grep fuse_new 0000000000019a70 T fuse_new_30 0000000000019270 t fuse_new_31 See also issue #198.
* Add idle_threads mount option.Gravatar Joseph Dodge2017-08-24
|
* Allow inode cache invalidation in high-level APIGravatar SÅ‚awek Rudnicki2017-08-24
| | | | | | | | | | | We re-introduce the functionality of invalidating the caches for an inode specified by path by adding a new routine fuse_invalidate_path. This is useful for network-based file systems which use the high-level API, enabling them to notify the kernel about external changes. This is a revival of Miklos Szeredi's original code for the fuse_invalidate routine.
* Allow building without iconv.Gravatar Nikolaus Rath2017-08-22
| | | | cfg.has('HAVE_ICONV') was always true.
* directly call fuse_new_31() instead of fuse_new() internallyGravatar userwithuid2017-08-14
| | | | this fixes building with lto, which failed since commit 503e32d01e4db00e90d7acfd81ab05386559069f
* fuse_lib_init(): don't set FUSE_CAP_EXPORT_SUPPORT unconditionallyGravatar Nikolaus Rath2017-08-11
| | | | FreeBSD kernel does not support this.
* Only declare fuse_new_30() when FUSE_USE_VERSION == 30Gravatar Nikolaus Rath2017-07-13
| | | | | This function shouldn't be called when using a newer fuse version, so we should not define it in that case.
* fuse_new_30(): call fuse_new_31(), not fuse_new()Gravatar Nikolaus Rath2017-07-13
| | | | | | | I believe this function call is resolved by the compiler, not the linker, so this seems safer. Thanks to Chris Clayton for spotting this.
* Fixup symbol versioning for GCC 4.xGravatar Nikolaus Rath2017-07-08
| | | | | GCC 4.8 doesn't like to rename fuse_new_30 to fuse_new, if we also define an implementation for fuse_new.
* Added public fuse_lib_help(), bumped minor versionGravatar Nikolaus Rath2017-07-08
|
* Fix comparison of integers of different signsGravatar Angelo G. Del Regno2017-06-05
| | | | | | | | Some variables of different size and sign were getting compared without any safe casting. The build system also throws warnings at this and, being this library used for filesystems, it's really important to ensure stability.
* Set default options before parsingGravatar Tej Chajed2017-04-14
|
* Optimize fuse_fs_read. (#145)Gravatar amosonn2017-03-03
| | | Redundant copy when only op.read is available removed.
* Added debug logging to chmodGravatar Nikolaus Rath2016-10-24
|
* Fix segfault in debug logging codeGravatar Nikolaus Rath2016-10-24
| | | | fi may be NULL, so we need to protect against this.
* Turn fuse_operations.nopath_flag into fuse_config.nullpath_okGravatar Nikolaus Rath2016-10-20
| | | | | | Modifying struct fuse_config in the init() handler is the canonical way to adjust file-system implementation specific settings. There is no need to have flags in struct fuse_operations.
* fuse_new(): don't accept options that don't make sense for end-usersGravatar Nikolaus Rath2016-10-20
| | | | | | Several options (use_ino, etc) depend on the file system implementation. Allowing them to be set from the command line makes no sense.
* Pass struct fuse_config to high-level init() handler.Gravatar Nikolaus Rath2016-10-20
|
* Make --help output more suitable for end-userGravatar Nikolaus Rath2016-10-15
| | | | | | | We now only list options that are potentially useful for an end-user (and unlikely to accidentally break a file system). The full list of FUSE options has been moved to the documentation of the fuse_new() and fuse_session_new() functions.
* Removed -o nopath - it never did anythingGravatar Nikolaus Rath2016-10-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We are overriding this setting with the flag in struct fuse_operations: $ example/hello -f -d ~/tmp/mnt FUSE library version: 3.0.0pre0 nopath: 0 unique: 1, opcode: INIT (26), nodeid: 0, insize: 56, pid: 0 INIT: 7.25 flags=0x0007fffb max_readahead=0x00020000 INIT: 7.23 flags=0x00006031 max_readahead=0x00020000 max_write=0x00020000 max_background=0 congestion_threshold=0 time_gran=0 unique: 1, success, outsize: 80 $ example/hello -f -d ~/tmp/mnt -o nopath FUSE library version: 3.0.0pre0 nopath: 0 unique: 1, opcode: INIT (26), nodeid: 0, insize: 56, pid: 0 INIT: 7.25 flags=0x0007fffb max_readahead=0x00020000 INIT: 7.23 flags=0x00006031 max_readahead=0x00020000 max_write=0x00020000 max_background=0 congestion_threshold=0 time_gran=0 unique: 1, success, outsize: 80
* Pass fuse_file_info to getattr, chown, chmod, truncate, utimens handlersGravatar Nikolaus Rath2016-10-15
| | | | | | This obsoletes the ftruncate & fgetattr handlers. Fixes #58.
* Unify handling of fuse_conn_info optionsGravatar Nikolaus Rath2016-10-15
| | | | | | Instead of using command line options to modify struct fuse_conn_info before and after calling the init() handler, we now give the file system explicit control over this.
* Make -o clone_fd into a parameter of session_loop_mt().Gravatar Nikolaus Rath2016-10-13
| | | | | | This option really affects the behavior of the session loop, not the low-level interface. Therefore, it does not belong in the fuse_session object.
* Clarified purpose of helper.c, moved *version() to fuse.cGravatar Nikolaus Rath2016-10-04
|
* Merge master fuse_chan into fuse_session.Gravatar Nikolaus Rath2016-10-03
| | | | | | | | | | | | | | | | | | This is a code simplification patch. - It confines most of the implementation channel implementation into fuse_loop_mt (which is its only user). - It makes it more obvious in the code that channels are only ever used when using -o clone_fd and multi-threaded main loop. - It simplies the definition of both struct fuse_session and struct fuse_chan. - Theoretically it should result in (minuscule) performance improvements when not using -o clone_fd. - Overall, it removes a lot more lines of source code than it adds :-).
* Merged fuse_mt.c into fuse.cGravatar Nikolaus Rath2016-10-02
| | | | There is no point in having a separate file for a 10 line function.
* Extended per-file comments.Gravatar Nikolaus Rath2016-10-02
| | | | | This should make more clear what file contains code for what purpose.
* Don't handle --help and --version in fuse_session_new().Gravatar Nikolaus Rath2016-10-02
| | | | | | | | | | | | | | | | | | | Help and version messages can be generated using the new fuse_lowlevel_help(), fuse_lowlevel_version(), fuse_mount_help(), and fuse_mount_version() functions. The fuse_parse_cmdline() function has been made more powerful to do this automatically, and is now explicitly intended only for low-level API users. This is a code simplication patch. We don't have to parse for --help and --version in quite as many places, and we no longer have a low-level initialization function be responsible for the (super-high level) task of printing a program usage message. In the high-level API, we can now handle the command line parsing earlier and avoid running other initialization code if we're just going to abort later on.
* Add section headings for --help outputGravatar Nikolaus Rath2016-10-02
| | | | Also, do not include "General options" in usage message.
* Turn struct fuse_chan into an implementation detailGravatar Nikolaus Rath2016-10-02
| | | | | | | | | | | | | | | | | | | | | The only struct fuse_chan that's accessible to the user application is the "master" channel that is returned by fuse_mount and stored in struct fuse_session. When using the multi-threaded main loop with the "clone_fd" option, each worker thread gets its own struct fuse_chan. However, none of these are available to the user application, nor do they hold references to struct fuse_session (the pointer is always null). Therefore, any presence of struct fuse_chan can be removed without loss of functionality by relying on struct fuse_session instead. This reduces the number of API functions and removes a potential source of confusion (since the new API no longer looks as if it might be possible to add multiple channels to one session, or to share one channel between multiple sessions). Fixes issue #17.
* Renamed fuse_lowlevel_new() to fuse_session_new().Gravatar Nikolaus Rath2016-10-02
|
* Introduce separate mount/umount functions for low-level API.Gravatar Nikolaus Rath2016-10-02
|
* Turned fuse_session_{process,receive}_buf into wrapper functions.Gravatar Nikolaus Rath2016-10-02
|
* Improve documentation of argument parsing.Gravatar Nikolaus Rath2016-10-01
|
* Whitespace cleanup.Gravatar Nikolaus Rath2016-03-29
| | | | | | Applied (whitespace-cleanup) to each file. Having whitespace changes in the VCS is ugly, but it ensures that in the future committers can run this function to *avoid* commiting any whitespace.
* Inlined fuse_chan_fdGravatar Nikolaus Rath2016-03-29
|
* libfuse: fix handling of '.' and '..' in highlevel readdirplusGravatar Miklos Szeredi2015-02-26
|
* libfuse: highlevel API: fix directory file handle passed to ioctl() methodGravatar Miklos Szeredi2014-07-21
| | | | Reported by Eric Biggers
* libfuse: add flags to ->rename()Gravatar Miklos Szeredi2014-07-15
| | | | See renameat2() system call in linux-3.15 and later kernels.
* Initilaize stat buffer passed to ->getattr() and ->fgetattr()Gravatar Miklos Szeredi2014-03-26
| | | | | | to zero in all cases. Reported by Daniel Iwan.
* libfuse: implement readdirplus for high-level APIGravatar Eric Wong2014-03-05
| | | | | | | | | | Reuse the old "readdir" callback, but add a flags argument, that has FUSE_READDIR_PLUS in case this is a "plus" version. Filesystems can safely ignore this flag, but if they want they can add optimizations based on it: i.e. only retrieve the full attributes in PLUS mode. The filler function is also given a flags argument and the filesystem can set FUSE_FILL_DIR_PLUS if all the attributes in "stat" are valid.