diff options
author | Meng Lu Wang <mwang@ddn.com> | 2025-04-10 16:58:57 +0800 |
---|---|---|
committer | Bernd Schubert <bernd@bsbernd.com> | 2025-04-15 20:17:49 +0200 |
commit | d66ca89e86a72fa5ad48d88ef5570062a79397be (patch) | |
tree | 0c4efd98acdb5c69b9b4ee24af0357f1b95b4618 /lib/mount.c | |
parent | 0d4a6281c297aeb200dc30664372fc252fff0f99 (diff) | |
download | libfuse-d66ca89e86a72fa5ad48d88ef5570062a79397be.tar.gz |
mount: Add FUSE_KERN_DEVICE env variable to specify fuse kernel device
For kernel development it might be necessary to load a module with
renamed symbols and renamed /dev/<devicenode>. Reason is that for
example ubuntu kernels have fuse compiled in and it is not possible
to replace it at run time. And fuse might also be used for other file
systems - a different device node is then needed. Also consolidate
device path handling and remove unnecessary string duplication in
mount_fuse() in fusermount.c.
Signed-off-by: Meng Lu Wang <mwang@ddn.com>
Diffstat (limited to 'lib/mount.c')
-rw-r--r-- | lib/mount.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/mount.c b/lib/mount.c index 6ed4444..34e5dd4 100644 --- a/lib/mount.c +++ b/lib/mount.c @@ -49,6 +49,7 @@ #define FUSERMOUNT_PROG "fusermount3" #define FUSE_COMMFD_ENV "_FUSE_COMMFD" #define FUSE_COMMFD2_ENV "_FUSE_COMMFD2" +#define FUSE_KERN_DEVICE_ENV "FUSE_KERN_DEVICE" #ifndef MS_DIRSYNC #define MS_DIRSYNC 128 @@ -506,7 +507,7 @@ static int fuse_mount_sys(const char *mnt, struct mount_opts *mo, const char *mnt_opts) { char tmp[128]; - const char *devname = "/dev/fuse"; + const char *devname = getenv(FUSE_KERN_DEVICE_ENV) ?: "/dev/fuse"; char *source = NULL; char *type = NULL; struct stat stbuf; @@ -528,7 +529,9 @@ static int fuse_mount_sys(const char *mnt, struct mount_opts *mo, fd = open(devname, O_RDWR | O_CLOEXEC); if (fd == -1) { if (errno == ENODEV || errno == ENOENT) - fuse_log(FUSE_LOG_ERR, "fuse: device not found, try 'modprobe fuse' first\n"); + fuse_log(FUSE_LOG_ERR, + "fuse: device %s not found. Kernel module not loaded?\n", + devname); else fuse_log(FUSE_LOG_ERR, "fuse: failed to open %s: %s\n", devname, strerror(errno)); |