aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Nikolaus Rath <Nikolaus@rath.org>2016-10-17 21:28:31 -0700
committerGravatar Nikolaus Rath <Nikolaus@rath.org>2016-10-20 14:04:37 -0700
commit30243ca7ad4e86fa75704fd2f75d7fbaed89118a (patch)
tree027a1d51c90c5e925e97efc7e8e3451f937a1dad /lib
parentbcb8568a46a4522d85f9eed626468d98b542e8d8 (diff)
Accept zero value for fuse_conn_info options
This may not make sense for all options, but it's good practice.
Diffstat (limited to 'lib')
-rw-r--r--lib/helper.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/helper.c b/lib/helper.c
index a76c19d..31640b6 100644
--- a/lib/helper.c
+++ b/lib/helper.c
@@ -74,15 +74,24 @@ struct fuse_conn_info_opts {
unsigned max_background;
unsigned congestion_threshold;
unsigned time_gran;
+ int set_max_write;
+ int set_max_readahead;
+ int set_max_background;
+ int set_congestion_threshold;
+ int set_time_gran;
};
#define CONN_OPTION(t, p, v) \
{ t, offsetof(struct fuse_conn_info_opts, p), v }
static const struct fuse_opt conn_info_opt_spec[] = {
CONN_OPTION("max_write=%u", max_write, 0),
+ CONN_OPTION("max_write=", set_max_write, 1),
CONN_OPTION("max_readahead=%u", max_readahead, 0),
+ CONN_OPTION("max_readahead=", set_max_readahead, 1),
CONN_OPTION("max_background=%u", max_background, 0),
+ CONN_OPTION("max_background=", set_max_background, 1),
CONN_OPTION("congestion_threshold=%u", congestion_threshold, 0),
+ CONN_OPTION("congestion_threshold=", set_congestion_threshold, 1),
CONN_OPTION("sync_read", sync_read, 1),
CONN_OPTION("async_read", async_read, 1),
CONN_OPTION("atomic_o_trunc", atomic_o_trunc, 1),
@@ -108,6 +117,7 @@ static const struct fuse_opt conn_info_opt_spec[] = {
CONN_OPTION("writeback_cache", writeback_cache, 1),
CONN_OPTION("no_writeback_cache", no_writeback_cache, 1),
CONN_OPTION("time_gran=%u", time_gran, 0),
+ CONN_OPTION("time_gran=", set_time_gran, 1),
FUSE_OPT_END
};
@@ -329,15 +339,15 @@ out1:
void fuse_apply_conn_info_opts(struct fuse_conn_info_opts *opts,
struct fuse_conn_info *conn)
{
- if(opts->max_write)
+ if(opts->set_max_write)
conn->max_write = opts->max_write;
- if(opts->max_background)
+ if(opts->set_max_background)
conn->max_background = opts->max_background;
- if(opts->congestion_threshold)
+ if(opts->set_congestion_threshold)
conn->congestion_threshold = opts->congestion_threshold;
- if(opts->time_gran)
+ if(opts->set_time_gran)
conn->time_gran = opts->time_gran;
- if(opts->max_readahead)
+ if(opts->set_max_readahead)
conn->max_readahead = opts->max_readahead;
#define LL_ENABLE(cond,cap) \