Commit Graph

52 Commits

Author SHA1 Message Date
Joanne Koong
535808c4d9 Add libfuse util strtol wrapper
Add a wrapper around strtol for more rigorous error checking
and convert uses of atoi and strtol to use this instead.
2024-10-11 13:15:38 +02:00
Bernd Schubert
45effd5db8
[libFuse 3.16.2]Compilation failure on freeBSD #936 (#938)
Despite the creation of the header file fuse_config.h during LibFUSE
version 3.16.2's Meson build process, the BSD mount_bsd.c file continues to reference config.h. Consequently, this discrepancy results in compilation failures.

FIX : Point the mount_bsd.c to correct header.
2024-04-25 17:09:05 +02:00
Giulio Benetti
c60a90b739
Fix MS_LAZYTIME not defined on uclibc and move all MS_* and UMOUNT_* (#753)
as well as <sys/mount.h> inclusion to new fuse_mount_compat.h file.

Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
2023-04-06 12:37:57 +01:00
Alan Somers
b9c584370a Use the -o intr mount option on FreeBSD (#462)
FUSE file systems normally indicate their interruptibility by returning
ENOSYS to the first FUSE_INTERRUPT operation.  But that causes two
problems for file systems that aren't interruptible:

1) A process may block on a signal, even if another thread could've
handled the signal.  The kernel must know whether the FUSE thread is
interruptible before deciding which thread should receive a signal.

2) The protocol allows a FUSE daemon to simply ignore FUSE_INTERRUPT
operations.  From the kernel's point of view, that is indistinguishable
from a FUSE_INTERRUPT operation arriving after the original operation
had already completed.  Thus, the kernel can't interpret an ignored
FUSE_INTERRUPT as an indication that the daemon is non-interruptible.

With the -o nointr mount option, no FUSE_INTERRUPT operations will ever
be sent.  Most FUSE file systems should require no modifications to take
advantage of this mount option.
2019-11-03 09:44:12 +00:00
Stefan Hajnoczi
317181e8ea Introduce callback for logging
Introduce an API for custom log handler functions.  This allows libfuse
applications to send messages to syslog(3) or other logging systems.
See include/fuse_log.h for details.

Convert libfuse from fprintf(stderr, ...) to log_fuse(level, ...).  Most
messages are error messages with FUSE_LOG_ERR log level.  There are also
some debug messages which now use the FUSE_LOG_DEBUG log level.

Note that lib/mount_util.c is used by both libfuse and fusermount3.
Since fusermount3 does not link against libfuse, we cannot call
fuse_log() from lib/mount_util.c.  This file will continue to use
fprintf(stderr, ...) until someone figures out how to split it up.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2019-09-04 15:59:18 +01:00
Roman Bogorodskiy
11d9ed614f Fix mounting on FreeBSD
Currently, mounting on FreeBSD fails like this:

 mount_fusefs: ZZZZ<snip> on /mountpoint: No such file or directory

This happens because right after doing argv[a++] = fdnam it's
getting freed before calling execvp().

So move this free() call after execvp(). Also, when asprintf()
fails for fdnam, close device fd before calling exit().
2018-11-11 19:40:25 +00:00
Nikolaus Rath
a6c7eab4cc fuse_kern_unmount(): close fd before calling umount
This is what the Linux version does, and it fixes a
timeout under FreeBSD when the kernel sends a FUSE_DESTROY
request that is never answered.
2017-09-11 11:19:06 +01:00
Nikolaus Rath
d7ab8be330 fuse_kern_unmount(): fix variable type. 2017-08-11 10:32:39 +02:00
Nikolaus Rath
8771b17229 Fix unused variable warnings under FreeBSD. 2017-08-11 10:32:39 +02:00
Nikolaus Rath
cbf19044da Simply #ifdefs
mount_bsd.c is only used when compiling for *BSD, and FreeBSD
is the only BSD that supports FUSE. So there really is no need
to check if this file is compiled under FreeBSD.
2017-08-03 17:21:06 +02:00
Baptiste Daroussin
91ab3b53a3 FreeBSD: use unmount(2) and add missing FreeBSD mount option 2017-08-03 16:40:36 +02:00
itsdeepak
845ecf0905 Memory leak fixed in file : mount_bsd.c 2016-12-23 18:35:13 -08:00
Nikolaus Rath
4175f969bd Make handling of -oallow_root easier to understand
-oallow_root is handled in userspace, and requires passing -oallow_other
 to the kernel. This patch should make the code easier to understand and
 avoid the confusion that gave rise to issue #86.
2016-11-22 16:34:21 -08:00
Nikolaus Rath
e885e84f79 Add max_read to fuse_conn_info
Eventually, this setting should be negotiated in the filesystem's init()
handler (like e.g. max_write). However, this requires corresponding
changes in the FUSE kernel module. In preparation for this (and to allow
a transition period) we already allow (and require) filesystems to set
the value in the init() handler in addition to the mount option.

The end-goal is tracked in issue #91.
2016-10-27 21:38:42 -07:00
Nikolaus Rath
199fc0f833 Inlined fuse_mount_help() into fuse_lowlevel_help().
Both the BSD and Linux implementation actually accept mostly the same
FUSE-specific mount options. Up to now, the BSD help function appended
the output of ``mount_fusefs --help``, but looking at
http://www.unix.com/man-page/freebsd/8/mount_fusefs/ this is likely more
confusing than helpful (since the user is not actually invoking
mount_fusefs directly, most of the options don't make sense).
2016-10-16 14:28:47 -07:00
Nikolaus Rath
b16650830d Make --help output more suitable for end-user
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.
2016-10-15 19:46:57 -07:00
Nikolaus Rath
0bef21e854 Removed -o nonempty option
This brings the default behavior in-line with that of the
regular `mount` command.
2016-10-15 18:53:45 -07:00
Nikolaus Rath
d6217bb2a0 Drop -o large_read mount option
This was only relevant for 2.4 kernels. Fixes #92.
2016-10-15 18:49:52 -07:00
Nikolaus Rath
595f7c3906 fuse_mount_help(): clarify that listed options are FUSE specific
We also accept a number of mount options that are common to
all  file systems (nosuid, nodev, ro, etc).
2016-10-04 19:40:06 -07:00
Nikolaus Rath
d968b4ddae Extended per-file comments.
This should make more clear what file contains code for what
purpose.
2016-10-02 21:20:44 -07:00
Nikolaus Rath
b4c3478b16 Add section headings for --help output
Also, do not include "General options" in usage message.
2016-10-02 20:51:15 -07:00
Nikolaus Rath
5698ee09cf Turn struct fuse_chan into an implementation detail
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.
2016-10-02 13:56:40 -07:00
Nikolaus Rath
e20e5c9ae5 Improve documentation of argument parsing. 2016-10-01 11:24:46 -07:00
Nikolaus Rath
eb61e2b18f Dropped fuse_unmount_compat22
This function was for backwards compatibility in FUSE 2.x, and
is no longer exposed by FUSE 3.
2016-09-27 20:45:26 -07:00
Nikolaus Rath
01c663699a Whitespace cleanup.
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.
2016-03-29 13:18:17 -07:00
Miklos Szeredi
9ffe64abe1 Print help on stdout instead of stderr 2013-07-26 16:20:28 +02:00
Miklos Szeredi
e6e7a249c5 libfuse: remove "-D_FILE_OFFSET_BITS=64" from fuse.pc
add AC_SYS_LARGEFILE to your configure.ac instead.
2013-07-24 17:09:26 +02:00
Miklos Szeredi
af57c73304 libfuse: fix multiple close of device fd
- fuse_kern_unmount closes handle (e.g. 19)
- a thread in my process opens a file - the OS assigns newly freed
handle (i.e. 19)
- fuse_kern_chan_destroy closes the same handle (i.e. 19)
- a thread in my process opens another file - the OS assigns newly
freed handle (i.e. 19)
- * MAYHEM *

Reported by Dan Greenfield
2013-06-20 11:43:02 +02:00
Miklos Szeredi
966d97b1f8 Remove old symbol versions 2012-07-19 18:47:51 +02:00
Miklos Szeredi
da077510ef Add support for atomic open(O_TRUNC) 2008-02-08 17:46:57 +00:00
Csaba Henk
6889e443c5 lib/mount_bsd.c: fix typo 2008-02-05 03:47:26 +00:00
Csaba Henk
cb1d7c5164 lib/mount_bsd.c: add "-onosync_unmount" kernel option 2008-02-05 03:07:47 +00:00
Csaba Henk
00bddfe650 lib/mount_bsd.c: prettify option specifications 2008-02-03 22:29:09 +00:00
Csaba Henk
634fe87761 lib/mount_bsd.c: get rid of all the hacks, we really need nothing just a forced unmount 2008-02-03 20:13:32 +00:00
Csaba Henk
7b3f3a8c2b lib/mount_bsd.c: ditch the kvm(8) stuff and fix unmounting in a simple and sensible way 2008-02-03 15:00:22 +00:00
Csaba Henk
de09413190 lib/mount_bsd.c: string formatting fixes, exit if mounting has failed 2008-02-03 12:07:56 +00:00
Csaba Henk
56ebfa593c lib/mount_bsd.c: add support for the subtype option 2008-01-07 10:54:24 +00:00
Csaba Henk
97bedd8989 lib/mount_bsd.c: fix up/refine device closing vs. unmount 2008-01-06 15:34:10 +00:00
Csaba Henk
18ecc2bff8 lib/mount_bsd.c: Close device before unmount.
Cf. lib/mount.c rev. 1.43.
2008-01-03 12:13:54 +00:00
Csaba Henk
fdfba078f6 lib/mount_bsd.c: fix some warnings 2008-01-03 11:08:44 +00:00
Miklos Szeredi
cdb8b79bad change indenting 2007-12-12 14:25:40 +00:00
Miklos Szeredi
918f0ad95b Disable old symbol versions if __UCLIBC__ is defined 2007-12-12 11:53:38 +00:00
Miklos Szeredi
7d62647d7a Clarify licence version to be "LGPLv2" for the library 2007-10-16 15:12:09 +00:00
Csaba Henk
2efe48fc77 run mount util foregrounded on FreeBSD if kernel features backgrounded init 2006-04-22 22:46:52 +00:00
Csaba Henk
baa49d21aa More "no" prefixes for FreBSD mount routine 2006-04-06 00:12:44 +00:00
Miklos Szeredi
6f385414b2 fix 2006-03-17 15:05:40 +00:00
Csaba Henk
ee588c01dc pass device file descriptor to fuse_unmount 2006-03-01 09:40:35 +00:00
Miklos Szeredi
d66b72864c merge fuse_2_5_bugfix 2006-02-02 15:15:21 +00:00
Miklos Szeredi
cb402b018c whitespace fixes 2006-01-09 14:44:23 +00:00
Miklos Szeredi
35676b053b fix 2006-01-09 10:13:28 +00:00