diff options
author | Nikolaus Rath <Nikolaus@rath.org> | 2016-10-10 20:21:45 -0700 |
---|---|---|
committer | Nikolaus Rath <Nikolaus@rath.org> | 2016-10-13 10:35:12 -0700 |
commit | 17b23ac3a5149eeb4d38d4830d9c5c80059ffdc3 (patch) | |
tree | 18d16899ce2e988d3c8221713eae794346b0c190 /lib | |
parent | fcc7eb01914ffdec3b83ec4fb77f71fa08284a36 (diff) |
Move session options into sub-struct
The session options are used only once to determine the proper
conn->want flags. It is nice to have them clearly separated from the
other struct fuse_session members that are used throughout the life of
the file system.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fuse_i.h | 21 | ||||
-rw-r--r-- | lib/fuse_lowlevel.c | 57 |
2 files changed, 40 insertions, 38 deletions
diff --git a/lib/fuse_i.h b/lib/fuse_i.h index c8aa279..9f11da7 100644 --- a/lib/fuse_i.h +++ b/lib/fuse_i.h @@ -41,14 +41,7 @@ struct fuse_notify_req { struct fuse_notify_req *prev; }; -struct fuse_session { - char *mountpoint; - volatile int exited; - int fd; - struct mount_opts *mo; - - int debug; - int allow_root; +struct session_opts { int atomic_o_trunc; int no_remote_posix_lock; int no_remote_flock; @@ -66,9 +59,18 @@ struct fuse_session { int no_async_dio; int writeback_cache; int no_writeback_cache; - int clone_fd; int async_read; int sync_read; +}; + +struct fuse_session { + char *mountpoint; + volatile int exited; + int fd; + struct mount_opts *mo; + struct session_opts opts; + int debug; + int allow_root; struct fuse_lowlevel_ops op; int got_init; struct cuse_data *cuse_data; @@ -84,6 +86,7 @@ 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_lowlevel.c b/lib/fuse_lowlevel.c index d07eed5..0085863 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -1809,8 +1809,8 @@ static void do_fallocate(fuse_req_t req, fuse_ino_t nodeid, const void *inarg) fuse_reply_err(req, ENOSYS); } -static void apply_want_options(struct fuse_session *opts, - struct fuse_conn_info *conn) +static void apply_want_options(struct session_opts *opts, + struct fuse_conn_info *conn) { #define LL_ENABLE(cond,cap) \ if (cond) conn->want |= (cap) @@ -1949,7 +1949,7 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg) /* Apply command-line options (so that init() handler has an idea about user preferences */ - apply_want_options(f, &f->conn); + apply_want_options(&f->opts, &f->conn); /* Allow file-system to overwrite defaults */ if (f->op.init) @@ -1957,7 +1957,7 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg) /* Now explicitly overwrite file-system's decision with command-line options */ - apply_want_options(f, &f->conn); + apply_want_options(&f->opts, &f->conn); /* Always enable big writes, this is superseded by the max_write option */ @@ -2571,30 +2571,30 @@ static const struct fuse_opt fuse_ll_opts[] = { LL_OPTION("max_readahead=%u", conn.max_readahead, 0), LL_OPTION("max_background=%u", conn.max_background, 0), LL_OPTION("congestion_threshold=%u", conn.congestion_threshold, 0), - LL_OPTION("sync_read", sync_read, 1), - LL_OPTION("async_read", async_read, 1), - LL_OPTION("atomic_o_trunc", atomic_o_trunc, 1), - LL_OPTION("no_remote_lock", no_remote_posix_lock, 1), - LL_OPTION("no_remote_lock", no_remote_flock, 1), - LL_OPTION("no_remote_flock", no_remote_flock, 1), - LL_OPTION("no_remote_posix_lock", no_remote_posix_lock, 1), - LL_OPTION("splice_write", splice_write, 1), - LL_OPTION("no_splice_write", no_splice_write, 1), - LL_OPTION("splice_move", splice_move, 1), - LL_OPTION("no_splice_move", no_splice_move, 1), - LL_OPTION("splice_read", splice_read, 1), - LL_OPTION("no_splice_read", no_splice_read, 1), - LL_OPTION("auto_inval_data", auto_inval_data, 1), - LL_OPTION("no_auto_inval_data", no_auto_inval_data, 1), - LL_OPTION("readdirplus=no", no_readdirplus, 1), - LL_OPTION("readdirplus=yes", no_readdirplus, 0), - LL_OPTION("readdirplus=yes", no_readdirplus_auto, 1), - LL_OPTION("readdirplus=auto", no_readdirplus, 0), - LL_OPTION("readdirplus=auto", no_readdirplus_auto, 0), - LL_OPTION("async_dio", async_dio, 1), - LL_OPTION("no_async_dio", no_async_dio, 1), - LL_OPTION("writeback_cache", writeback_cache, 1), - LL_OPTION("no_writeback_cache", no_writeback_cache, 1), + LL_OPTION("sync_read", opts.sync_read, 1), + LL_OPTION("async_read", opts.async_read, 1), + LL_OPTION("atomic_o_trunc", opts.atomic_o_trunc, 1), + LL_OPTION("no_remote_lock", opts.no_remote_posix_lock, 1), + LL_OPTION("no_remote_lock", opts.no_remote_flock, 1), + LL_OPTION("no_remote_flock", opts.no_remote_flock, 1), + LL_OPTION("no_remote_posix_lock", opts.no_remote_posix_lock, 1), + LL_OPTION("splice_write", opts.splice_write, 1), + LL_OPTION("no_splice_write", opts.no_splice_write, 1), + LL_OPTION("splice_move", opts.splice_move, 1), + LL_OPTION("no_splice_move", opts.no_splice_move, 1), + LL_OPTION("splice_read", opts.splice_read, 1), + LL_OPTION("no_splice_read", opts.no_splice_read, 1), + LL_OPTION("auto_inval_data", opts.auto_inval_data, 1), + LL_OPTION("no_auto_inval_data", opts.no_auto_inval_data, 1), + LL_OPTION("readdirplus=no", opts.no_readdirplus, 1), + LL_OPTION("readdirplus=yes", opts.no_readdirplus, 0), + LL_OPTION("readdirplus=yes", opts.no_readdirplus_auto, 1), + LL_OPTION("readdirplus=auto", opts.no_readdirplus, 0), + LL_OPTION("readdirplus=auto", opts.no_readdirplus_auto, 0), + LL_OPTION("async_dio", opts.async_dio, 1), + LL_OPTION("no_async_dio", opts.no_async_dio, 1), + 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 @@ -2831,7 +2831,6 @@ struct fuse_session *fuse_session_new(struct fuse_args *args, } se->conn.max_write = UINT_MAX; se->conn.max_readahead = UINT_MAX; - se->atomic_o_trunc = 0; /* Parse options */ mo = parse_mount_opts(args); |