diff options
author | Nikolaus Rath <Nikolaus@rath.org> | 2016-10-02 11:30:43 -0700 |
---|---|---|
committer | Nikolaus Rath <Nikolaus@rath.org> | 2016-10-02 13:56:40 -0700 |
commit | 5698ee09cf7a8495da70659ffae1eaec9f57db27 (patch) | |
tree | 798a58a4f49d7f82e3f948463daad4405173483e /lib/fuse.c | |
parent | f164e9b8ca319dd1279384ff495b5fa91e778d9e (diff) | |
download | libfuse-5698ee09cf7a8495da70659ffae1eaec9f57db27.tar.gz |
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.
Diffstat (limited to 'lib/fuse.c')
-rw-r--r-- | lib/fuse.c | 17 |
1 files changed, 8 insertions, 9 deletions
@@ -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)); } |