diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2003-12-12 14:06:41 +0000 |
---|---|---|
committer | Miklos Szeredi <miklos@szeredi.hu> | 2003-12-12 14:06:41 +0000 |
commit | 5e43f2c00c1ce3a9ee3ed9c2b5a9b32dabbb6e60 (patch) | |
tree | f2b700316c0ec296d18aee045fe098880602664b /lib/fuse.c | |
parent | e4cf733e1c0a1a959f2f3c4f1951ad35da58011e (diff) | |
download | libfuse-5e43f2c00c1ce3a9ee3ed9c2b5a9b32dabbb6e60.tar.gz |
added fsync operation
Diffstat (limited to 'lib/fuse.c')
-rw-r--r-- | lib/fuse.c | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -40,6 +40,7 @@ static const char *opname(enum fuse_opcode opcode) case FUSE_WRITE: return "WRITE"; case FUSE_STATFS: return "STATFS"; case FUSE_RELEASE: return "RELEASE"; + case FUSE_FSYNC: return "FSYNC"; default: return "???"; } } @@ -866,6 +867,24 @@ static void do_statfs(struct fuse *f, struct fuse_in_header *in) send_reply(f, in, res, &arg, sizeof(arg)); } +static void do_fsync(struct fuse *f, struct fuse_in_header *in, + struct fuse_fsync_in *inarg) +{ + int res; + char *path; + + res = -ENOENT; + path = get_path(f, in->ino); + if(path != NULL) { + /* fsync is not mandatory, so don't return ENOSYS */ + res = 0; + if(f->op.fsync) + res = f->op.fsync(path, inarg->datasync); + free(path); + } + send_reply(f, in, res, NULL, 0); +} + static void free_cmd(struct fuse_cmd *cmd) { free(cmd->buf); @@ -960,6 +979,10 @@ void __fuse_process_cmd(struct fuse *f, struct fuse_cmd *cmd) do_statfs(f, in); break; + case FUSE_FSYNC: + do_fsync(f, in, (struct fuse_fsync_in *) inarg); + break; + default: send_reply(f, in, -ENOSYS, NULL, 0); } |