diff options
author | Ulf Lilleengen <lulf@pvv.ntnu.no> | 2008-09-03 09:35:58 +0200 |
---|---|---|
committer | Ulf Lilleengen <lulf@pvv.ntnu.no> | 2008-09-03 09:35:58 +0200 |
commit | c1ac6a3f5e69b75a922385d78e380c209fd2911c (patch) | |
tree | 596680508a480e1538ff83d569f9af6de0767690 /src | |
parent | 5f83ed096a8f0e19cd4658258c07630d17c4b488 (diff) |
- Implement flush and fsync.
Diffstat (limited to 'src')
-rwxr-xr-x | src/mfs_vnops.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/mfs_vnops.c b/src/mfs_vnops.c index 4e1915e..549ebb1 100755 --- a/src/mfs_vnops.c +++ b/src/mfs_vnops.c @@ -238,19 +238,31 @@ static int mfs_truncate(const char *path, off_t size) static int mfs_flush(const char *path, struct fuse_file_info *fi) { + int fd; + DEBUG("flushing path %s\n", path); if (strcmp(path, "/.config") == 0) { return (0); } - return (-1); + fd = (int)fi->fh; + /* Fd is not valid, return flush error. */ + if (fd < 0) + return (-ENOENT); + return (0); } static int mfs_fsync(const char *path, int datasync, struct fuse_file_info *fi) { + int fd; + DEBUG("fsync path %s\n", path); - return (0); + fd = (int)fi->fh; + /* Fd is not valid, return fsync error. */ + if (fd < 0) + return (-ENOENT); + return (fsync(fd)); } static int mfs_release(const char *path, struct fuse_file_info *fi) @@ -330,6 +342,7 @@ static struct fuse_operations mfs_ops = { .mknod = mfs_mknod, .create = mfs_create, .truncate = mfs_truncate, + .flush = mfs_flush, .fsync = mfs_fsync, .chmod = mfs_chmod, .release = mfs_release, |