summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2008-10-14 14:37:48 +0000
committerMiklos Szeredi <miklos@szeredi.hu>2008-10-14 14:37:48 +0000
commitb7af77dc1dfb5eb91eb408a0aeaf30783b5974ab (patch)
tree32d22ec0beb32b8fd99f9ce4cd14e8dcd53ca82c
parent78e42c17a69736ff19ae3a6a198bbd2bbee01202 (diff)
downloadfuse-b7af77dc1dfb5eb91eb408a0aeaf30783b5974ab.tar.gz
Pass current file flags to read and write operations
-rw-r--r--ChangeLog4
-rw-r--r--include/fuse.h3
-rw-r--r--lib/fuse.c12
-rw-r--r--lib/fuse_lowlevel.c11
4 files changed, 24 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 3f699ff..7c34017 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2008-10-14 Miklos Szeredi <miklos@szeredi.hu>
+
+ * Pass current file flags to read and write operations
+
2008-07-24 Miklos Szeredi <miklos@szeredi.hu>
* Clean up debug output in highlevel lib
diff --git a/include/fuse.h b/include/fuse.h
index 409851a..8d47bc5 100644
--- a/include/fuse.h
+++ b/include/fuse.h
@@ -80,6 +80,9 @@ typedef int (*fuse_dirfil_t) (fuse_dirh_t h, const char *name, int type,
*
* Changed in fuse 2.8.0 (regardless of API version)
* Previously, paths were limited to a length of PATH_MAX.
+ *
+ * See http://fuse.sourceforge.net/wiki/ for more information. There
+ * is also a snapshot of the relevant wiki pages in the doc/ folder.
*/
struct fuse_operations {
/** Get file attributes.
diff --git a/lib/fuse.c b/lib/fuse.c
index 805833e..9c5dd0f 100644
--- a/lib/fuse.c
+++ b/lib/fuse.c
@@ -1230,9 +1230,11 @@ int fuse_fs_read(struct fuse_fs *fs, const char *path, char *buf, size_t size,
int res;
if (fs->debug)
- fprintf(stderr, "read[%llu] %lu bytes from %llu\n",
+ fprintf(stderr,
+ "read[%llu] %lu bytes from %llu flags: 0x%x\n",
(unsigned long long) fi->fh,
- (unsigned long) size, (unsigned long long) off);
+ (unsigned long) size, (unsigned long long) off,
+ fi->flags);
res = fs->op.read(path, buf, size, off, fi);
@@ -1257,10 +1259,12 @@ int fuse_fs_write(struct fuse_fs *fs, const char *path, const char *buf,
int res;
if (fs->debug)
- fprintf(stderr, "write%s[%llu] %lu bytes to %llu\n",
+ fprintf(stderr,
+ "write%s[%llu] %lu bytes to %llu flags: 0x%x\n",
fi->writepage ? "page" : "",
(unsigned long long) fi->fh,
- (unsigned long) size, (unsigned long long) off);
+ (unsigned long) size, (unsigned long long) off,
+ fi->flags);
res = fs->op.write(path, buf, size, off, fi);
diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
index 048b2cc..df88f26 100644
--- a/lib/fuse_lowlevel.c
+++ b/lib/fuse_lowlevel.c
@@ -648,6 +648,10 @@ static void do_read(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
memset(&fi, 0, sizeof(fi));
fi.fh = arg->fh;
fi.fh_old = fi.fh;
+ if (req->f->conn.proto_minor >= 9) {
+ fi.lock_owner = arg->lock_owner;
+ fi.flags = arg->flags;
+ }
req->f->op.read(req, nodeid, arg->size, arg->offset, &fi);
} else
fuse_reply_err(req, ENOSYS);
@@ -664,10 +668,13 @@ static void do_write(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
fi.fh_old = fi.fh;
fi.writepage = arg->write_flags & 1;
- if (req->f->conn.proto_minor < 9)
+ if (req->f->conn.proto_minor < 9) {
param = ((char *) arg) + FUSE_COMPAT_WRITE_IN_SIZE;
- else
+ } else {
+ fi.lock_owner = arg->lock_owner;
+ fi.flags = arg->flags;
param = PARAM(arg);
+ }
if (req->f->op.write)
req->f->op.write(req, nodeid, param, arg->size,