aboutsummaryrefslogtreecommitdiffstats
path: root/lib/fuse_lowlevel.c
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2008-02-08 17:46:57 +0000
committerMiklos Szeredi <miklos@szeredi.hu>2008-02-08 17:46:57 +0000
commitda077510ef8e57f84f199e9845c912806de53b74 (patch)
tree5384c2c537611762b862edff451832988842d6b2 /lib/fuse_lowlevel.c
parent30ece080006087a7e615cce3f7fc51b6d8a5d5bf (diff)
downloadandroid_external_fuse-da077510ef8e57f84f199e9845c912806de53b74.tar.gz
android_external_fuse-da077510ef8e57f84f199e9845c912806de53b74.tar.bz2
android_external_fuse-da077510ef8e57f84f199e9845c912806de53b74.zip
Add support for atomic open(O_TRUNC)
Diffstat (limited to 'lib/fuse_lowlevel.c')
-rw-r--r--lib/fuse_lowlevel.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
index d1ef7b2..75906b9 100644
--- a/lib/fuse_lowlevel.c
+++ b/lib/fuse_lowlevel.c
@@ -1008,9 +1008,12 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
f->conn.async_read = arg->flags & FUSE_ASYNC_READ;
if (arg->max_readahead < f->conn.max_readahead)
f->conn.max_readahead = arg->max_readahead;
+ if (f->conn.atomic_o_trunc)
+ f->conn.atomic_o_trunc = arg->flags & FUSE_ATOMIC_O_TRUNC;
} else {
f->conn.async_read = 0;
f->conn.max_readahead = 0;
+ f->conn.atomic_o_trunc = 0;
}
if (bufsize < FUSE_MIN_READ_BUFFER) {
@@ -1034,6 +1037,8 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
outarg.flags |= FUSE_ASYNC_READ;
if (f->op.getlk && f->op.setlk)
outarg.flags |= FUSE_POSIX_LOCKS;
+ if (f->conn.atomic_o_trunc)
+ outarg.flags |= FUSE_ATOMIC_O_TRUNC;
outarg.max_readahead = f->conn.max_readahead;
outarg.max_write = f->conn.max_write;
@@ -1214,6 +1219,7 @@ static struct fuse_opt fuse_ll_opts[] = {
{ "max_readahead=%u", offsetof(struct fuse_ll, conn.max_readahead), 0 },
{ "async_read", offsetof(struct fuse_ll, conn.async_read), 1 },
{ "sync_read", offsetof(struct fuse_ll, conn.async_read), 0 },
+ { "atomic_o_trunc", offsetof(struct fuse_ll, conn.atomic_o_trunc), 1},
FUSE_OPT_KEY("max_read=", FUSE_OPT_KEY_DISCARD),
FUSE_OPT_KEY("-h", KEY_HELP),
FUSE_OPT_KEY("--help", KEY_HELP),
@@ -1231,10 +1237,11 @@ static void fuse_ll_version(void)
static void fuse_ll_help(void)
{
fprintf(stderr,
-" -o max_write=N set maximum size of write requests\n"
-" -o max_readahead=N set maximum readahead\n"
-" -o async_read perform reads asynchronously (default)\n"
-" -o sync_read perform reads synchronously\n");
+" -o max_write=N set maximum size of write requests\n"
+" -o max_readahead=N set maximum readahead\n"
+" -o async_read perform reads asynchronously (default)\n"
+" -o sync_read perform reads synchronously\n"
+" -o atomic_o_trunc enable atomic open+truncate support\n");
}
static int fuse_ll_opt_proc(void *data, const char *arg, int key,
@@ -1306,6 +1313,7 @@ struct fuse_session *fuse_lowlevel_new_common(struct fuse_args *args,
f->conn.async_read = 1;
f->conn.max_write = UINT_MAX;
f->conn.max_readahead = UINT_MAX;
+ f->conn.atomic_o_trunc = 0;
list_init_req(&f->list);
list_init_req(&f->interrupts);
fuse_mutex_init(&f->lock);