summaryrefslogtreecommitdiff
path: root/sdcard
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2012-05-25 15:01:21 -0700
committerJeff Brown <jeffbrown@google.com>2012-06-04 13:13:57 -0700
commit6fd921ae03a0fa17acfe118753ecd76d25f02e10 (patch)
tree6079693a1e42655ce7ce8aa0896503442591bfe8 /sdcard
parent847158476c1b7662eeec77808d8ecdbb329e6f28 (diff)
Implement FUSE_FSYNC request.
This request is needed for application correctness, without which data corruption may result. Bug: 6488845 Change-Id: I3d676c2e40f6e6b37d5d270c7cb40f1bf8c1fa47
Diffstat (limited to 'sdcard')
-rw-r--r--sdcard/sdcard.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/sdcard/sdcard.c b/sdcard/sdcard.c
index 4fff9422c..2b78482df 100644
--- a/sdcard/sdcard.c
+++ b/sdcard/sdcard.c
@@ -853,7 +853,21 @@ void handle_fuse_request(struct fuse *fuse,
return;
}
-// case FUSE_FSYNC:
+ case FUSE_FSYNC: {
+ const struct fuse_fsync_in *req = data;
+ int is_data_sync = req->fsync_flags & 1;
+ struct handle *h = id_to_ptr(req->fh);
+ int res;
+ TRACE("FSYNC %p(%d) is_data_sync=%d\n", h, h->fd, is_data_sync);
+ res = is_data_sync ? fdatasync(h->fd) : fsync(h->fd);
+ if (res < 0) {
+ fuse_status(fuse, hdr->unique, -errno);
+ return;
+ }
+ fuse_status(fuse, hdr->unique, 0);
+ return;
+ }
+
// case FUSE_SETXATTR:
// case FUSE_GETXATTR:
// case FUSE_LISTXATTR: