Pass current file flags to read and write operations

This commit is contained in:
Miklos Szeredi
2008-10-14 14:37:48 +00:00
parent 78e42c17a6
commit b7af77dc1d
4 changed files with 24 additions and 6 deletions
+4
View File
@@ -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
+3
View 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.
+8 -4
View 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);
+9 -2
View 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,