Pass current file flags to read and write operations
authorMiklos Szeredi <miklos@szeredi.hu>
Tue, 14 Oct 2008 14:37:48 +0000 (14:37 +0000)
committerMiklos Szeredi <miklos@szeredi.hu>
Tue, 14 Oct 2008 14:37:48 +0000 (14:37 +0000)
ChangeLog
include/fuse.h
lib/fuse.c
lib/fuse_lowlevel.c

index 3f699ff85c0d52b2be6e3a2acb6275eb529364f9..7c34017203e539016996e3de0bbf6e8617e330ca 100644 (file)
--- 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
index 409851a882852c03afd92dc43eb84c3d30acffd7..8d47bc5c199343e10633ebcf64eb1315b282fdf6 100644 (file)
@@ -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.
index 805833e074bdc8b3cc607d0d69bae56f56cc79ab..9c5dd0fd765f2cd22f736dceefb432f73e49d7fd 100644 (file)
@@ -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);
 
index 048b2ccb76736bb0e6b0bf3e97a965945ca3622e..df88f26a4860590f40847edcf6492bbd2472aabd 100644 (file)
@@ -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,