diff options
author | Anatol Pomozov <anatol.pomozov@gmail.com> | 2012-04-22 18:49:35 -0700 |
---|---|---|
committer | Miklos Szeredi <mszeredi@suse.cz> | 2012-06-18 13:32:43 +0200 |
commit | 96ac0e5d76db3714b7c8d37956f6e6b1d804a01a (patch) | |
tree | 4cd918bccb54e30edca0dadbe2b44a43b7ef1c91 /lib/fuse_lowlevel.c | |
parent | 46b9c3326d50aebe52c33d63885b83a47a2e74ea (diff) | |
download | android_external_fuse-96ac0e5d76db3714b7c8d37956f6e6b1d804a01a.tar.gz android_external_fuse-96ac0e5d76db3714b7c8d37956f6e6b1d804a01a.tar.bz2 android_external_fuse-96ac0e5d76db3714b7c8d37956f6e6b1d804a01a.zip |
Add FALLOCATE operation
fallocate filesystem operation preallocates media space for the given file.
If fallocate returns success then any subsequent write to the given range
never fails with 'not enough space' error.
Diffstat (limited to 'lib/fuse_lowlevel.c')
-rw-r--r-- | lib/fuse_lowlevel.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index 2282ccf..305bbbf 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -1717,6 +1717,20 @@ static void do_poll(fuse_req_t req, fuse_ino_t nodeid, const void *inarg) } } +static void do_fallocate(fuse_req_t req, fuse_ino_t nodeid, const void *inarg) +{ + struct fuse_fallocate_in *arg = (struct fuse_fallocate_in *) inarg; + struct fuse_file_info fi; + + memset(&fi, 0, sizeof(fi)); + fi.fh = arg->fh; + + if (req->f->op.fallocate) + req->f->op.fallocate(req, nodeid, arg->mode, arg->offset, arg->length, &fi); + else + fuse_reply_err(req, ENOSYS); +} + static void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg) { struct fuse_init_in *arg = (struct fuse_init_in *) inarg; @@ -2267,6 +2281,7 @@ static struct { [FUSE_BMAP] = { do_bmap, "BMAP" }, [FUSE_IOCTL] = { do_ioctl, "IOCTL" }, [FUSE_POLL] = { do_poll, "POLL" }, + [FUSE_FALLOCATE] = { do_fallocate, "FALLOCATE" }, [FUSE_DESTROY] = { do_destroy, "DESTROY" }, [FUSE_NOTIFY_REPLY] = { (void *) 1, "NOTIFY_REPLY" }, [FUSE_BATCH_FORGET] = { do_batch_forget, "BATCH_FORGET" }, |