From 44ca63546ca3b2da8f8d372790a402a802bee072 Mon Sep 17 00:00:00 2001 From: Nikolaus Rath Date: Mon, 10 Oct 2016 15:13:59 -0700 Subject: [PATCH] Factored out LL_OPTIONS macro --- lib/fuse_lowlevel.c | 70 +++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index 8bf457a..299d4a8 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -2553,41 +2553,43 @@ clear_pipe: goto out_free; } +#define LL_OPTION(n,o,v) \ + { n, offsetof(struct fuse_session, o), v } + static const struct fuse_opt fuse_ll_opts[] = { - { "debug", offsetof(struct fuse_session, debug), 1 }, - { "-d", offsetof(struct fuse_session, debug), 1 }, - { "allow_root", offsetof(struct fuse_session, allow_root), 1 }, - { "max_write=%u", offsetof(struct fuse_session, conn.max_write), 0 }, - { "max_readahead=%u", offsetof(struct fuse_session, conn.max_readahead), 0 }, - { "max_background=%u", offsetof(struct fuse_session, conn.max_background), 0 }, - { "congestion_threshold=%u", - offsetof(struct fuse_session, conn.congestion_threshold), 0 }, - { "sync_read", offsetof(struct fuse_session, sync_read), 1 }, - { "async_read", offsetof(struct fuse_session, async_read), 1 }, - { "atomic_o_trunc", offsetof(struct fuse_session, atomic_o_trunc), 1}, - { "no_remote_lock", offsetof(struct fuse_session, no_remote_posix_lock), 1}, - { "no_remote_lock", offsetof(struct fuse_session, no_remote_flock), 1}, - { "no_remote_flock", offsetof(struct fuse_session, no_remote_flock), 1}, - { "no_remote_posix_lock", offsetof(struct fuse_session, no_remote_posix_lock), 1}, - { "splice_write", offsetof(struct fuse_session, splice_write), 1}, - { "no_splice_write", offsetof(struct fuse_session, no_splice_write), 1}, - { "splice_move", offsetof(struct fuse_session, splice_move), 1}, - { "no_splice_move", offsetof(struct fuse_session, no_splice_move), 1}, - { "splice_read", offsetof(struct fuse_session, splice_read), 1}, - { "no_splice_read", offsetof(struct fuse_session, no_splice_read), 1}, - { "auto_inval_data", offsetof(struct fuse_session, auto_inval_data), 1}, - { "no_auto_inval_data", offsetof(struct fuse_session, no_auto_inval_data), 1}, - { "readdirplus=no", offsetof(struct fuse_session, no_readdirplus), 1}, - { "readdirplus=yes", offsetof(struct fuse_session, no_readdirplus), 0}, - { "readdirplus=yes", offsetof(struct fuse_session, no_readdirplus_auto), 1}, - { "readdirplus=auto", offsetof(struct fuse_session, no_readdirplus), 0}, - { "readdirplus=auto", offsetof(struct fuse_session, no_readdirplus_auto), 0}, - { "async_dio", offsetof(struct fuse_session, async_dio), 1}, - { "no_async_dio", offsetof(struct fuse_session, no_async_dio), 1}, - { "writeback_cache", offsetof(struct fuse_session, writeback_cache), 1}, - { "no_writeback_cache", offsetof(struct fuse_session, no_writeback_cache), 1}, - { "time_gran=%u", offsetof(struct fuse_session, conn.time_gran), 0 }, - { "clone_fd", offsetof(struct fuse_session, clone_fd), 1 }, + LL_OPTION("debug", debug, 1), + LL_OPTION("-d", debug, 1), + LL_OPTION("allow_root", allow_root, 1), + LL_OPTION("max_write=%u", conn.max_write, 0), + 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("time_gran=%u", conn.time_gran, 0), + LL_OPTION("clone_fd", clone_fd, 1), FUSE_OPT_END }; -- 2.30.2