diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2006-02-21 18:31:29 +0000 |
---|---|---|
committer | Miklos Szeredi <miklos@szeredi.hu> | 2006-02-21 18:31:29 +0000 |
commit | 6bab4809f38fcd67330d1383657e84bdd33ab43c (patch) | |
tree | a965265b230e6a2ec1cc5a32d6b6a6ee3b088612 /example | |
parent | e109e285e0dc76c86830d9242084cd7638ff5752 (diff) | |
download | android_external_fuse-6bab4809f38fcd67330d1383657e84bdd33ab43c.tar.gz android_external_fuse-6bab4809f38fcd67330d1383657e84bdd33ab43c.tar.bz2 android_external_fuse-6bab4809f38fcd67330d1383657e84bdd33ab43c.zip |
fix
Diffstat (limited to 'example')
-rw-r--r-- | example/fusexmp_fh.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/example/fusexmp_fh.c b/example/fusexmp_fh.c index 3ff6c9d..89fe8ff 100644 --- a/example/fusexmp_fh.c +++ b/example/fusexmp_fh.c @@ -311,6 +311,23 @@ static int xmp_statfs(const char *path, struct statvfs *stbuf) return 0; } +static int xmp_flush(const char *path, struct fuse_file_info *fi) +{ + int res; + + (void) path; + /* This is called from every close on an open file, so call the + close on the underlying filesystem. But since flush may be + called multiple times for an open file, this must not really + close the file. This is important if used on a network + filesystem like NFS which flush the data/metadata on close() */ + res = close(dup(fi->fh)); + if (res == -1) + return -errno; + + return 0; +} + static int xmp_release(const char *path, struct fuse_file_info *fi) { (void) path; @@ -401,6 +418,7 @@ static struct fuse_operations xmp_oper = { .read = xmp_read, .write = xmp_write, .statfs = xmp_statfs, + .flush = xmp_flush, .release = xmp_release, .fsync = xmp_fsync, #ifdef HAVE_SETXATTR |