From 5698ee09cf7a8495da70659ffae1eaec9f57db27 Mon Sep 17 00:00:00 2001 From: Nikolaus Rath Date: Sun, 2 Oct 2016 11:30:43 -0700 Subject: 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. --- lib/fuse.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'lib/fuse.c') diff --git a/lib/fuse.c b/lib/fuse.c index 47b72d0..bd7dc27 100644 --- a/lib/fuse.c +++ b/lib/fuse.c @@ -4631,7 +4631,7 @@ void fuse_stop_cleanup_thread(struct fuse *f) } } -struct fuse *fuse_new(struct fuse_chan *ch, struct fuse_args *args, +struct fuse *fuse_new(struct fuse_args *args, const struct fuse_operations *op, size_t op_size, void *user_data) { @@ -4721,13 +4721,13 @@ struct fuse *fuse_new(struct fuse_chan *ch, struct fuse_args *args, or --version argument in `args` */ f->se = fuse_session_new(args, &llop, sizeof(llop), f); if (f->se == NULL) { + /* If we've printed help before, add module help at + * the end */ if (f->conf.help) fuse_lib_help_modules(); goto out_free_fs; } - fuse_session_add_chan(f->se, ch); - if (f->conf.debug) { fprintf(stderr, "nopath: %i\n", f->conf.nopath); } @@ -4837,12 +4837,11 @@ void fuse_destroy(struct fuse *f) fuse_delete_context_key(); } -struct fuse_chan *fuse_mount(const char *mountpoint, struct fuse_args *args) -{ - return fuse_session_mount(mountpoint, args); +int fuse_mount(struct fuse *f, const char *mountpoint) { + return fuse_session_mount(fuse_get_session(f), mountpoint); } -void fuse_unmount(const char *mountpoint, struct fuse_chan *ch) -{ - fuse_session_unmount(mountpoint, ch); + +void fuse_unmount(struct fuse *f) { + return fuse_session_unmount(fuse_get_session(f)); } -- cgit v1.2.3