aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Miklos Szeredi <mszeredi@suse.cz>2014-07-15 17:11:08 +0200
committerGravatar Miklos Szeredi <mszeredi@suse.cz>2014-07-15 17:36:43 +0200
commit57a93b3dacbf9259178dacff5d2fbb25427f3b86 (patch)
tree09b3436bcec7b391ccc810c3d905b9b3a0158983 /lib
parent52f46cfa682e284835807bcd60086a71b4365e91 (diff)
libfuse: add "time_gran" option
This allows the filesystem to specify the time granularity it supports when the kernel is responsible for updating times ("writeback_cache" option).
Diffstat (limited to 'lib')
-rwxr-xr-xlib/fuse_lowlevel.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
index 4284535..dc27cb5 100755
--- a/lib/fuse_lowlevel.c
+++ b/lib/fuse_lowlevel.c
@@ -1844,6 +1844,7 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
struct fuse_init_out outarg;
struct fuse_ll *f = req->f;
size_t bufsize = f->bufsize;
+ size_t outargsize = sizeof(outarg);
(void) nodeid;
if (f->debug) {
@@ -2017,6 +2018,8 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
outarg.max_background = f->conn.max_background;
outarg.congestion_threshold = f->conn.congestion_threshold;
}
+ if (f->conn.proto_minor >= 23)
+ outarg.time_gran = f->conn.time_gran;
if (f->debug) {
fprintf(stderr, " INIT: %u.%u\n", outarg.major, outarg.minor);
@@ -2028,9 +2031,15 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
outarg.max_background);
fprintf(stderr, " congestion_threshold=%i\n",
outarg.congestion_threshold);
+ fprintf(stderr, " time_gran=%u\n",
+ outarg.time_gran);
}
+ if (arg->minor < 5)
+ outargsize = FUSE_COMPAT_INIT_OUT_SIZE;
+ else if (arg->minor < 23)
+ outargsize = FUSE_COMPAT_22_INIT_OUT_SIZE;
- send_reply_ok(req, &outarg, arg->minor < 5 ? 8 : sizeof(outarg));
+ send_reply_ok(req, &outarg, outargsize);
}
static void do_destroy(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
@@ -2625,6 +2634,7 @@ static const struct fuse_opt fuse_ll_opts[] = {
{ "no_async_dio", offsetof(struct fuse_ll, no_async_dio), 1},
{ "writeback_cache", offsetof(struct fuse_ll, writeback_cache), 1},
{ "no_writeback_cache", offsetof(struct fuse_ll, no_writeback_cache), 1},
+ { "time_gran=%u", offsetof(struct fuse_ll, conn.time_gran), 0 },
FUSE_OPT_KEY("max_read=", FUSE_OPT_KEY_DISCARD),
FUSE_OPT_KEY("-h", KEY_HELP),
FUSE_OPT_KEY("--help", KEY_HELP),
@@ -2660,6 +2670,7 @@ static void fuse_ll_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"
);
}