diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fuse.c | 10 | ||||
-rwxr-xr-x | lib/fuse_lowlevel.c | 36 | ||||
-rw-r--r-- | lib/fuse_versionscript | 2 | ||||
-rw-r--r-- | lib/helper.c | 35 |
4 files changed, 48 insertions, 35 deletions
@@ -4836,3 +4836,13 @@ void fuse_destroy(struct fuse *f) free(f); fuse_delete_context_key(); } + +struct fuse_chan *fuse_mount(const char *mountpoint, struct fuse_args *args) +{ + return fuse_session_mount(mountpoint, args); +} + +void fuse_unmount(const char *mountpoint, struct fuse_chan *ch) +{ + fuse_session_unmount(mountpoint, ch); +} diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index 8b08f3a..ad10175 100755 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -2938,6 +2938,42 @@ out: return NULL; } +struct fuse_chan *fuse_session_mount(const char *mountpoint, + struct fuse_args *args) +{ + struct fuse_chan *ch; + int fd; + + /* + * Make sure file descriptors 0, 1 and 2 are open, otherwise chaos + * would ensue. + */ + do { + fd = open("/dev/null", O_RDWR); + if (fd > 2) + close(fd); + } while (fd >= 0 && fd <= 2); + + fd = fuse_kern_mount(mountpoint, args); + if (fd == -1) + return NULL; + + ch = fuse_chan_new(fd); + if (!ch) + fuse_kern_unmount(mountpoint, fd); + + return ch; +} + +void fuse_session_unmount(const char *mountpoint, struct fuse_chan *ch) +{ + if (mountpoint) { + int fd = ch ? fuse_chan_clearfd(ch) : -1; + fuse_kern_unmount(mountpoint, fd); + fuse_chan_put(ch); + } +} + #ifdef linux int fuse_req_getgroups(fuse_req_t req, int size, gid_t list[]) { diff --git a/lib/fuse_versionscript b/lib/fuse_versionscript index 716330f..9c29669 100644 --- a/lib/fuse_versionscript +++ b/lib/fuse_versionscript @@ -42,6 +42,7 @@ FUSE_3.0 { fuse_lowlevel_new; fuse_main_real; fuse_mount; + fuse_session_mount; fuse_new; fuse_opt_insert_arg; fuse_reply_lock; @@ -49,6 +50,7 @@ FUSE_3.0 { fuse_req_interrupted; fuse_session_remove_chan; fuse_unmount; + fuse_session_unmount; fuse_fs_access; fuse_fs_bmap; fuse_fs_chmod; diff --git a/lib/helper.c b/lib/helper.c index 6a55269..cd1a54b 100644 --- a/lib/helper.c +++ b/lib/helper.c @@ -227,41 +227,6 @@ int fuse_daemonize(int foreground) return 0; } -struct fuse_chan *fuse_mount(const char *mountpoint, struct fuse_args *args) -{ - struct fuse_chan *ch; - int fd; - - /* - * Make sure file descriptors 0, 1 and 2 are open, otherwise chaos - * would ensue. - */ - do { - fd = open("/dev/null", O_RDWR); - if (fd > 2) - close(fd); - } while (fd >= 0 && fd <= 2); - - fd = fuse_kern_mount(mountpoint, args); - if (fd == -1) - return NULL; - - ch = fuse_chan_new(fd); - if (!ch) - fuse_kern_unmount(mountpoint, fd); - - return ch; -} - -void fuse_unmount(const char *mountpoint, struct fuse_chan *ch) -{ - if (mountpoint) { - int fd = ch ? fuse_chan_clearfd(ch) : -1; - fuse_kern_unmount(mountpoint, fd); - fuse_chan_put(ch); - } -} - static struct fuse *fuse_setup(int argc, char *argv[], const struct fuse_operations *op, size_t op_size, char **mountpoint, int *multithreaded, void *user_data) |