#define FUSE_KERNEL_VERSION 7
/** Minor version number of this interface */
-#define FUSE_KERNEL_MINOR_VERSION 7
+#define FUSE_KERNEL_MINOR_VERSION 8
/** The node ID of the root inode */
#define FUSE_ROOT_ID 1
#define FUSE_ASYNC_READ (1 << 0)
#define FUSE_POSIX_LOCKS (1 << 1)
+/**
+ * Release flags
+ */
+#define FUSE_RELEASE_FLUSH (1 << 0)
+
enum fuse_opcode {
FUSE_LOOKUP = 1,
FUSE_FORGET = 2, /* no reply */
struct fuse_release_in {
__u64 fh;
__u32 flags;
- __u32 padding;
+ __u32 release_flags;
+ __u64 lock_owner;
};
struct fuse_flush_in {
return res;
}
+static int fuse_do_flush(struct fuse *f, fuse_req_t req, const char *path,
+ struct fuse_file_info *fi)
+{
+ int res;
+ struct fuse_intr_data d;
+ fuse_prepare_interrupt(f, req, &d);
+ res = f->op.flush(path, fi);
+ fuse_finish_interrupt(f, req, &d);
+ return res;
+}
+
static int fuse_do_statfs(struct fuse *f, fuse_req_t req, const char *path,
struct statvfs *buf)
{
char *path;
struct node *node;
int unlink_hidden = 0;
+ int err = 0;
pthread_rwlock_rdlock(&f->tree_lock);
path = get_path(f, ino);
if (f->conf.debug) {
- printf("RELEASE[%llu] flags: 0x%x\n", (unsigned long long) fi->fh,
- fi->flags);
+ printf("RELEASE%s[%llu] flags: 0x%x\n", fi->flush ? "+FLUSH" : "",
+ (unsigned long long) fi->fh, fi->flags);
fflush(stdout);
}
+ if (fi->flush && path && f->op.flush)
+ err = fuse_do_flush(f, req, path, fi);
if (f->op.release)
fuse_compat_release(f, req, path, fi);
free(path);
pthread_rwlock_unlock(&f->tree_lock);
- reply_err(req, 0);
+ reply_err(req, err);
}
static void fuse_fsync(fuse_req_t req, fuse_ino_t ino, int datasync,
fflush(stdout);
}
err = -ENOSYS;
- if (f->op.flush) {
- struct fuse_intr_data d;
- fuse_prepare_interrupt(f, req, &d);
- err = f->op.flush(path, fi);
- fuse_finish_interrupt(f, req, &d);
- }
+ if (f->op.flush)
+ err = fuse_do_flush(f, req, path, fi);
free(path);
}
if (f->op.lock) {