diff options
author | Nikolaus Rath <Nikolaus@rath.org> | 2016-10-10 21:29:36 -0700 |
---|---|---|
committer | Nikolaus Rath <Nikolaus@rath.org> | 2016-10-13 10:35:12 -0700 |
commit | 2bfa342cdadbcb3d4421dd752bbe1e63e0f6430f (patch) | |
tree | 50965d9492dd23f52a5274add9b322baa6d7a396 /lib | |
parent | 17b23ac3a5149eeb4d38d4830d9c5c80059ffdc3 (diff) |
Make -o clone_fd into a parameter of session_loop_mt().
This option really affects the behavior of the session loop, not the
low-level interface. Therefore, it does not belong in the fuse_session
object.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cuse_lowlevel.c | 2 | ||||
-rw-r--r-- | lib/fuse.c | 4 | ||||
-rw-r--r-- | lib/fuse_i.h | 1 | ||||
-rw-r--r-- | lib/fuse_loop_mt.c | 8 | ||||
-rw-r--r-- | lib/fuse_lowlevel.c | 4 | ||||
-rw-r--r-- | lib/helper.c | 4 |
6 files changed, 12 insertions, 11 deletions
diff --git a/lib/cuse_lowlevel.c b/lib/cuse_lowlevel.c index c9aa47d..49fc7d4 100644 --- a/lib/cuse_lowlevel.c +++ b/lib/cuse_lowlevel.c @@ -350,7 +350,7 @@ int cuse_lowlevel_main(int argc, char *argv[], const struct cuse_info *ci, return 1; if (multithreaded) - res = fuse_session_loop_mt(se); + res = fuse_session_loop_mt(se, 0); else res = fuse_session_loop(se); @@ -4378,7 +4378,7 @@ int fuse_loop(struct fuse *f) return fuse_session_loop(f->se); } -int fuse_loop_mt(struct fuse *f) +int fuse_loop_mt(struct fuse *f, int clone_fd) { if (f == NULL) return -1; @@ -4387,7 +4387,7 @@ int fuse_loop_mt(struct fuse *f) if (res) return -1; - res = fuse_session_loop_mt(fuse_get_session(f)); + res = fuse_session_loop_mt(fuse_get_session(f), clone_fd); fuse_stop_cleanup_thread(f); return res; } diff --git a/lib/fuse_i.h b/lib/fuse_i.h index 9f11da7..5ed23c7 100644 --- a/lib/fuse_i.h +++ b/lib/fuse_i.h @@ -86,7 +86,6 @@ struct fuse_session { uint64_t notify_ctr; struct fuse_notify_req notify_list; size_t bufsize; - int clone_fd; }; struct fuse_chan { diff --git a/lib/fuse_loop_mt.c b/lib/fuse_loop_mt.c index e6e2263..54fb56d 100644 --- a/lib/fuse_loop_mt.c +++ b/lib/fuse_loop_mt.c @@ -47,6 +47,7 @@ struct fuse_mt { sem_t finish; int exit; int error; + int clone_fd; }; static struct fuse_chan *fuse_chan_new(int fd) @@ -265,13 +266,13 @@ static int fuse_loop_start_thread(struct fuse_mt *mt) w->mt = mt; w->ch = NULL; - if (mt->se->clone_fd) { + if (mt->clone_fd) { w->ch = fuse_clone_chan(mt); if(!w->ch) { /* Don't attempt this again */ fprintf(stderr, "fuse: trying to continue " "without -o clone_fd.\n"); - mt->se->clone_fd = 0; + mt->clone_fd = 0; } } @@ -299,7 +300,7 @@ static void fuse_join_worker(struct fuse_mt *mt, struct fuse_worker *w) free(w); } -int fuse_session_loop_mt(struct fuse_session *se) +int fuse_session_loop_mt(struct fuse_session *se, int clone_fd) { int err; struct fuse_mt mt; @@ -307,6 +308,7 @@ int fuse_session_loop_mt(struct fuse_session *se) memset(&mt, 0, sizeof(struct fuse_mt)); mt.se = se; + mt.clone_fd = clone_fd; mt.error = 0; mt.numworker = 0; mt.numavail = 0; diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index 0085863..33e0ae5 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -2596,7 +2596,6 @@ static const struct fuse_opt fuse_ll_opts[] = { LL_OPTION("writeback_cache", opts.writeback_cache, 1), LL_OPTION("no_writeback_cache", opts.no_writeback_cache, 1), LL_OPTION("time_gran=%u", conn.time_gran, 0), - LL_OPTION("clone_fd", clone_fd, 1), FUSE_OPT_END }; @@ -2627,8 +2626,7 @@ void fuse_lowlevel_help(void) " -o readdirplus=S control readdirplus use (yes|no|auto)\n" " -o [no_]async_dio asynchronous direct I/O\n" " -o [no_]writeback_cache asynchronous, buffered writes\n" -" -o time_gran=N time granularity in nsec\n" -" -o clone_fd clone fuse device file descriptors\n\n"); +" -o time_gran=N time granularity in nsec\n\n"); } void fuse_session_destroy(struct fuse_session *se) diff --git a/lib/helper.c b/lib/helper.c index cc5cefc..ea06d81 100644 --- a/lib/helper.c +++ b/lib/helper.c @@ -45,6 +45,7 @@ static const struct fuse_opt fuse_helper_opts[] = { FUSE_HELPER_OPT("subtype=", nodefault_subtype), FUSE_OPT_KEY("fsname=", FUSE_OPT_KEY_KEEP), FUSE_OPT_KEY("subtype=", FUSE_OPT_KEY_KEEP), + FUSE_HELPER_OPT("clone_fd", clone_fd), FUSE_OPT_END }; @@ -56,6 +57,7 @@ void fuse_cmdline_help(void) " -d -o debug enable debug output (implies -f)\n" " -f foreground operation\n" " -s disable multi-threaded operation\n" + " -o clone_fd use separate fuse device fd for each thread\n" "\n"); } @@ -246,7 +248,7 @@ int fuse_main_real(int argc, char *argv[], const struct fuse_operations *op, if (opts.singlethread) res = fuse_loop(fuse); else - res = fuse_loop_mt(fuse); + res = fuse_loop_mt(fuse, opts.clone_fd); if (res) res = 1; |