aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/cuse_lowlevel.c11
-rw-r--r--lib/fuse_i.h2
-rw-r--r--lib/fuse_lowlevel.c766
3 files changed, 608 insertions, 171 deletions
diff --git a/lib/cuse_lowlevel.c b/lib/cuse_lowlevel.c
index 5387f84..a25711b 100644
--- a/lib/cuse_lowlevel.c
+++ b/lib/cuse_lowlevel.c
@@ -192,9 +192,11 @@ static int cuse_reply_init(fuse_req_t req, struct cuse_init_out *arg,
return fuse_send_reply_iov_nofree(req, 0, iov, 3);
}
-void cuse_lowlevel_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+void _cuse_lowlevel_init(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *req_payload)
{
- struct fuse_init_in *arg = (struct fuse_init_in *) inarg;
+ const struct fuse_init_in *arg = op_in;
+ (void)req_payload;
struct cuse_init_out outarg;
struct fuse_session *se = req->se;
struct cuse_data *cd = se->cuse_data;
@@ -263,6 +265,11 @@ void cuse_lowlevel_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
fuse_free_req(req);
}
+void cuse_lowlevel_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+{
+ _cuse_lowlevel_init(req, nodeid, inarg, NULL);
+}
+
struct fuse_session *cuse_lowlevel_setup(int argc, char *argv[],
const struct cuse_info *ci,
const struct cuse_lowlevel_ops *clop,
diff --git a/lib/fuse_i.h b/lib/fuse_i.h
index 1f59944..89a5c6f 100644
--- a/lib/fuse_i.h
+++ b/lib/fuse_i.h
@@ -195,6 +195,8 @@ int fuse_send_reply_iov_nofree(fuse_req_t req, int error, struct iovec *iov,
int count);
void fuse_free_req(fuse_req_t req);
+void _cuse_lowlevel_init(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *req_header, const void *req_payload);
void cuse_lowlevel_init(fuse_req_t req, fuse_ino_t nodeide, const void *inarg);
int fuse_start_thread(pthread_t *thread_id, void *(*func)(void *), void *arg);
diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
index d66e6ab..e0aa523 100644
--- a/lib/fuse_lowlevel.c
+++ b/lib/fuse_lowlevel.c
@@ -1183,9 +1183,12 @@ int fuse_reply_lseek(fuse_req_t req, off_t off)
return send_reply_ok(req, &arg, sizeof(arg));
}
-static void do_lookup(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void _do_lookup(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
{
- char *name = (char *) inarg;
+ (void)op_in;
+
+ char *name = (char *)in_payload;
if (req->se->op.lookup)
req->se->op.lookup(req, nodeid, name);
@@ -1193,9 +1196,18 @@ static void do_lookup(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
fuse_reply_err(req, ENOSYS);
}
-static void do_forget(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void do_lookup(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *inarg)
+{
+ _do_lookup(req, nodeid, NULL, inarg);
+}
+
+static void _do_forget(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
{
- struct fuse_forget_in *arg = (struct fuse_forget_in *) inarg;
+ (void)in_payload;
+
+ struct fuse_forget_in *arg = (struct fuse_forget_in *)op_in;
if (req->se->op.forget)
req->se->op.forget(req, nodeid, arg->nlookup);
@@ -1203,21 +1215,27 @@ static void do_forget(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
fuse_reply_none(req);
}
-static void do_batch_forget(fuse_req_t req, fuse_ino_t nodeid,
- const void *inarg)
+static void do_forget(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *inarg)
+{
+ _do_forget(req, nodeid, inarg, NULL);
+}
+
+static void _do_batch_forget(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
{
- struct fuse_batch_forget_in *arg = (void *) inarg;
- struct fuse_forget_one *param = (void *) PARAM(arg);
+ (void)nodeid;
unsigned int i;
- (void) nodeid;
+ const struct fuse_batch_forget_in *arg = op_in;
+ const struct fuse_forget_one *forgets = in_payload;
if (req->se->op.forget_multi) {
req->se->op.forget_multi(req, arg->count,
- (struct fuse_forget_data *) param);
+ (struct fuse_forget_data *)in_payload);
} else if (req->se->op.forget) {
for (i = 0; i < arg->count; i++) {
- struct fuse_forget_one *forget = &param[i];
+ const struct fuse_forget_one *forget = &forgets[i];
struct fuse_req *dummy_req;
dummy_req = fuse_ll_alloc_req(req->se);
@@ -1237,14 +1255,25 @@ static void do_batch_forget(fuse_req_t req, fuse_ino_t nodeid,
}
}
-static void do_getattr(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void do_batch_forget(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *inarg)
{
+ struct fuse_batch_forget_in *arg = (void *)inarg;
+ struct fuse_forget_one *param = (void *)PARAM(arg);
+
+ _do_batch_forget(req, nodeid, inarg, param);
+}
+
+static void _do_getattr(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
+{
+ struct fuse_getattr_in *arg = (struct fuse_getattr_in *)op_in;
+ (void)in_payload;
+
struct fuse_file_info *fip = NULL;
struct fuse_file_info fi;
if (req->se->conn.proto_minor >= 9) {
- struct fuse_getattr_in *arg = (struct fuse_getattr_in *) inarg;
-
if (arg->getattr_flags & FUSE_GETATTR_FH) {
memset(&fi, 0, sizeof(fi));
fi.fh = arg->fh;
@@ -1258,9 +1287,18 @@ static void do_getattr(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
fuse_reply_err(req, ENOSYS);
}
-static void do_setattr(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void do_getattr(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *inarg)
{
- struct fuse_setattr_in *arg = (struct fuse_setattr_in *) inarg;
+ _do_getattr(req, nodeid, inarg, NULL);
+}
+
+static void _do_setattr(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
+{
+ (void)in_payload;
+ const struct fuse_setattr_in *arg = op_in;
+ uint32_t valid = arg->valid;
if (req->se->op.setattr) {
struct fuse_file_info *fi = NULL;
@@ -1269,32 +1307,34 @@ static void do_setattr(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
memset(&stbuf, 0, sizeof(stbuf));
convert_attr(arg, &stbuf);
if (arg->valid & FATTR_FH) {
- arg->valid &= ~FATTR_FH;
+ valid &= ~FATTR_FH;
memset(&fi_store, 0, sizeof(fi_store));
fi = &fi_store;
fi->fh = arg->fh;
}
- arg->valid &=
- FUSE_SET_ATTR_MODE |
- FUSE_SET_ATTR_UID |
- FUSE_SET_ATTR_GID |
- FUSE_SET_ATTR_SIZE |
- FUSE_SET_ATTR_ATIME |
- FUSE_SET_ATTR_MTIME |
- FUSE_SET_ATTR_KILL_SUID |
- FUSE_SET_ATTR_KILL_SGID |
- FUSE_SET_ATTR_ATIME_NOW |
- FUSE_SET_ATTR_MTIME_NOW |
- FUSE_SET_ATTR_CTIME;
-
- req->se->op.setattr(req, nodeid, &stbuf, arg->valid, fi);
+ valid &= FUSE_SET_ATTR_MODE | FUSE_SET_ATTR_UID |
+ FUSE_SET_ATTR_GID | FUSE_SET_ATTR_SIZE |
+ FUSE_SET_ATTR_ATIME | FUSE_SET_ATTR_MTIME |
+ FUSE_SET_ATTR_KILL_SUID | FUSE_SET_ATTR_KILL_SGID |
+ FUSE_SET_ATTR_ATIME_NOW | FUSE_SET_ATTR_MTIME_NOW |
+ FUSE_SET_ATTR_CTIME;
+
+ req->se->op.setattr(req, nodeid, &stbuf, valid, fi);
} else
fuse_reply_err(req, ENOSYS);
}
-static void do_access(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void do_setattr(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *inarg)
{
- struct fuse_access_in *arg = (struct fuse_access_in *) inarg;
+ _do_setattr(req, nodeid, inarg, NULL);
+}
+
+static void _do_access(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
+{
+ (void)in_payload;
+ const struct fuse_access_in *arg = op_in;
if (req->se->op.access)
req->se->op.access(req, nodeid, arg->mask);
@@ -1302,9 +1342,17 @@ static void do_access(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
fuse_reply_err(req, ENOSYS);
}
-static void do_readlink(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void do_access(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *inarg)
+{
+ _do_access(req, nodeid, inarg, NULL);
+}
+
+static void _do_readlink(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
{
- (void) inarg;
+ (void)op_in;
+ (void)in_payload;
if (req->se->op.readlink)
req->se->op.readlink(req, nodeid);
@@ -1312,15 +1360,20 @@ static void do_readlink(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
fuse_reply_err(req, ENOSYS);
}
-static void do_mknod(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void do_readlink(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *inarg)
{
- struct fuse_mknod_in *arg = (struct fuse_mknod_in *) inarg;
- char *name = PARAM(arg);
+ _do_readlink(req, nodeid, inarg, NULL);
+}
+
+static void _do_mknod(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
+{
+ const struct fuse_mknod_in *arg = (struct fuse_mknod_in *)op_in;
+ const char *name = in_payload;
if (req->se->conn.proto_minor >= 12)
req->ctx.umask = arg->umask;
- else
- name = (char *) inarg + FUSE_COMPAT_MKNOD_IN_SIZE;
if (req->se->op.mknod)
req->se->op.mknod(req, nodeid, name, arg->mode, arg->rdev);
@@ -1328,22 +1381,45 @@ static void do_mknod(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
fuse_reply_err(req, ENOSYS);
}
-static void do_mkdir(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void do_mknod(fuse_req_t req, const fuse_ino_t nodeid, const void *inarg)
{
- struct fuse_mkdir_in *arg = (struct fuse_mkdir_in *) inarg;
+ struct fuse_mknod_in *arg = (struct fuse_mknod_in *)inarg;
+ char *name = PARAM(arg);
+
+ if (req->se->conn.proto_minor < 12)
+ name = (char *)inarg + FUSE_COMPAT_MKNOD_IN_SIZE;
+
+ _do_mknod(req, nodeid, inarg, name);
+}
+
+static void _do_mkdir(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
+{
+ const char *name = in_payload;
+ const struct fuse_mkdir_in *arg = op_in;
if (req->se->conn.proto_minor >= 12)
req->ctx.umask = arg->umask;
if (req->se->op.mkdir)
- req->se->op.mkdir(req, nodeid, PARAM(arg), arg->mode);
+ req->se->op.mkdir(req, nodeid, name, arg->mode);
else
fuse_reply_err(req, ENOSYS);
}
-static void do_unlink(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void do_mkdir(fuse_req_t req, const fuse_ino_t nodeid, const void *inarg)
+{
+ const struct fuse_mkdir_in *arg = inarg;
+ const char *name = PARAM(arg);
+
+ _do_mkdir(req, nodeid, inarg, name);
+}
+
+static void _do_unlink(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
{
- char *name = (char *) inarg;
+ (void)op_in;
+ const char *name = in_payload;
if (req->se->op.unlink)
req->se->op.unlink(req, nodeid, name);
@@ -1351,9 +1427,17 @@ static void do_unlink(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
fuse_reply_err(req, ENOSYS);
}
-static void do_rmdir(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void do_unlink(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *inarg)
+{
+ _do_unlink(req, nodeid, NULL, inarg);
+}
+
+static void _do_rmdir(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
{
- char *name = (char *) inarg;
+ (void)op_in;
+ const char *name = in_payload;
if (req->se->op.rmdir)
req->se->op.rmdir(req, nodeid, name);
@@ -1361,10 +1445,17 @@ static void do_rmdir(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
fuse_reply_err(req, ENOSYS);
}
-static void do_symlink(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void do_rmdir(fuse_req_t req, const fuse_ino_t nodeid, const void *inarg)
+{
+ _do_rmdir(req, nodeid, NULL, inarg);
+}
+
+static void _do_symlink(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
{
- char *name = (char *) inarg;
- char *linkname = ((char *) inarg) + strlen((char *) inarg) + 1;
+ (void)op_in;
+ const char *name = (char *)in_payload;
+ const char *linkname = name + strlen(name) + 1;
if (req->se->op.symlink)
req->se->op.symlink(req, linkname, nodeid, name);
@@ -1372,45 +1463,63 @@ static void do_symlink(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
fuse_reply_err(req, ENOSYS);
}
-static void do_rename(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void do_symlink(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *inarg)
{
- struct fuse_rename_in *arg = (struct fuse_rename_in *) inarg;
- char *oldname = PARAM(arg);
- char *newname = oldname + strlen(oldname) + 1;
+ _do_symlink(req, nodeid, NULL, inarg);
+}
+
+static void _do_rename(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
+{
+ const struct fuse_rename_in *arg = (struct fuse_rename_in *)op_in;
+ const char *oldname = in_payload;
+ const char *newname = oldname + strlen(oldname) + 1;
if (req->se->op.rename)
req->se->op.rename(req, nodeid, oldname, arg->newdir, newname,
- 0);
+ 0);
else
fuse_reply_err(req, ENOSYS);
}
-static void do_rename2(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void do_rename(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *inarg)
+{
+ const struct fuse_rename_in *arg = inarg;
+ const void *payload = PARAM(arg);
+
+ _do_rename(req, nodeid, arg, payload);
+}
+
+static void _do_rename2(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
{
- struct fuse_rename2_in *arg = (struct fuse_rename2_in *) inarg;
- char *oldname = PARAM(arg);
- char *newname = oldname + strlen(oldname) + 1;
+ const struct fuse_rename2_in *arg = op_in;
+ const char *oldname = in_payload;
+ const char *newname = oldname + strlen(oldname) + 1;
if (req->se->op.rename)
req->se->op.rename(req, nodeid, oldname, arg->newdir, newname,
- arg->flags);
+ arg->flags);
else
fuse_reply_err(req, ENOSYS);
}
-static void do_link(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void do_rename2(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *inarg)
{
- struct fuse_link_in *arg = (struct fuse_link_in *) inarg;
+ const struct fuse_rename2_in *arg = inarg;
+ const void *payload = PARAM(arg);
- if (req->se->op.link)
- req->se->op.link(req, arg->oldnodeid, nodeid, PARAM(arg));
- else
- fuse_reply_err(req, ENOSYS);
+ _do_rename2(req, nodeid, arg, payload);
}
-static void do_tmpfile(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void _do_tmpfile(fuse_req_t req, fuse_ino_t nodeid, const void *op_in,
+ const void *in_payload)
{
- struct fuse_create_in *arg = (struct fuse_create_in *) inarg;
+ (void)in_payload;
+ const struct fuse_create_in *arg = op_in;
if (req->se->op.tmpfile) {
struct fuse_file_info fi;
@@ -1426,35 +1535,79 @@ static void do_tmpfile(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
fuse_reply_err(req, ENOSYS);
}
-static void do_create(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void do_tmpfile(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
{
struct fuse_create_in *arg = (struct fuse_create_in *) inarg;
+ _do_tmpfile(req, nodeid, arg, NULL);
+}
+
+static void _do_link(fuse_req_t req, const fuse_ino_t nodeid, const void *op_in,
+ const void *in_payload)
+{
+ struct fuse_link_in *arg = (struct fuse_link_in *)op_in;
+
+ if (req->se->op.link)
+ req->se->op.link(req, arg->oldnodeid, nodeid, in_payload);
+ else
+ fuse_reply_err(req, ENOSYS);
+}
+
+static void do_link(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+{
+ const struct fuse_link_in *arg = inarg;
+ const void *name = PARAM(arg);
+
+ _do_link(req, nodeid, inarg, name);
+}
+
+static void _do_create(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
+{
+ const struct fuse_create_in *arg = op_in;
+ const char *name = in_payload;
+
if (req->se->op.create) {
struct fuse_file_info fi;
- char *name = PARAM(arg);
memset(&fi, 0, sizeof(fi));
fi.flags = arg->flags;
if (req->se->conn.proto_minor >= 12)
req->ctx.umask = arg->umask;
- else
- name = (char *) inarg + sizeof(struct fuse_open_in);
+
+ /* XXX: fuse_create_in::open_flags */
req->se->op.create(req, nodeid, name, arg->mode, &fi);
- } else
+ } else {
fuse_reply_err(req, ENOSYS);
+ }
+}
+
+static void do_create(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *inarg)
+{
+ const struct fuse_create_in *arg = (struct fuse_create_in *)inarg;
+ void *payload = PARAM(arg);
+
+ if (req->se->conn.proto_minor < 12)
+ payload = (char *)inarg + sizeof(struct fuse_open_in);
+
+ _do_create(req, nodeid, arg, payload);
}
-static void do_open(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void _do_open(fuse_req_t req, const fuse_ino_t nodeid, const void *op_in,
+ const void *in_payload)
{
- struct fuse_open_in *arg = (struct fuse_open_in *) inarg;
+ (void)in_payload;
+ struct fuse_open_in *arg = (struct fuse_open_in *)op_in;
struct fuse_file_info fi;
memset(&fi, 0, sizeof(fi));
fi.flags = arg->flags;
+ /* XXX: fuse_open_in::open_flags */
+
if (req->se->op.open)
req->se->op.open(req, nodeid, &fi);
else if (req->se->conn.want_ext & FUSE_CAP_NO_OPEN_SUPPORT)
@@ -1463,9 +1616,16 @@ static void do_open(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
fuse_reply_open(req, &fi);
}
-static void do_read(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void do_open(fuse_req_t req, const fuse_ino_t nodeid, const void *inarg)
+{
+ _do_open(req, nodeid, inarg, NULL);
+}
+
+static void _do_read(fuse_req_t req, const fuse_ino_t nodeid, const void *op_in,
+ const void *in_payload)
{
- struct fuse_read_in *arg = (struct fuse_read_in *) inarg;
+ (void)in_payload;
+ struct fuse_read_in *arg = (struct fuse_read_in *)op_in;
if (req->se->op.read) {
struct fuse_file_info fi;
@@ -1481,68 +1641,97 @@ static void do_read(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
fuse_reply_err(req, ENOSYS);
}
-static void do_write(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void do_read(fuse_req_t req, const fuse_ino_t nodeid, const void *inarg)
+{
+ _do_read(req, nodeid, inarg, NULL);
+}
+
+static void _do_write(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
{
- struct fuse_write_in *arg = (struct fuse_write_in *) inarg;
+ struct fuse_write_in *arg = (struct fuse_write_in *)op_in;
+ const char *buf = in_payload;
struct fuse_file_info fi;
- char *param;
memset(&fi, 0, sizeof(fi));
fi.fh = arg->fh;
fi.writepage = (arg->write_flags & FUSE_WRITE_CACHE) != 0;
- if (req->se->conn.proto_minor < 9) {
- param = ((char *) arg) + FUSE_COMPAT_WRITE_IN_SIZE;
- } else {
+ if (req->se->conn.proto_minor >= 9) {
fi.lock_owner = arg->lock_owner;
fi.flags = arg->flags;
- param = PARAM(arg);
}
if (req->se->op.write)
- req->se->op.write(req, nodeid, param, arg->size,
- arg->offset, &fi);
+ req->se->op.write(req, nodeid, buf, arg->size, arg->offset,
+ &fi);
else
fuse_reply_err(req, ENOSYS);
}
-static void do_write_buf(fuse_req_t req, fuse_ino_t nodeid, const void *inarg,
- const struct fuse_buf *ibuf)
+static void do_write(fuse_req_t req, const fuse_ino_t nodeid, const void *inarg)
+{
+ struct fuse_write_in *arg = (struct fuse_write_in *)inarg;
+ const void *payload;
+
+ if (req->se->conn.proto_minor < 9)
+ payload = ((char *)arg) + FUSE_COMPAT_WRITE_IN_SIZE;
+ else
+ payload = PARAM(arg);
+
+ _do_write(req, nodeid, arg, payload);
+}
+
+static void _do_write_buf(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, struct fuse_bufvec *bufv)
{
struct fuse_session *se = req->se;
- struct fuse_bufvec bufv = {
- .buf[0] = *ibuf,
- .count = 1,
- };
- struct fuse_write_in *arg = (struct fuse_write_in *) inarg;
+ struct fuse_write_in *arg = (struct fuse_write_in *)op_in;
struct fuse_file_info fi;
memset(&fi, 0, sizeof(fi));
fi.fh = arg->fh;
fi.writepage = arg->write_flags & FUSE_WRITE_CACHE;
+ if (se->conn.proto_minor >= 9) {
+ fi.lock_owner = arg->lock_owner;
+ fi.flags = arg->flags;
+ }
+
+ se->op.write_buf(req, nodeid, bufv, arg->offset, &fi);
+}
+
+static void do_write_buf(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *inarg, const struct fuse_buf *ibuf)
+{
+ struct fuse_session *se = req->se;
+ struct fuse_bufvec bufv = {
+ .buf[0] = *ibuf,
+ .count = 1,
+ };
+ struct fuse_write_in *arg = (struct fuse_write_in *)inarg;
+
if (se->conn.proto_minor < 9) {
- bufv.buf[0].mem = ((char *) arg) + FUSE_COMPAT_WRITE_IN_SIZE;
+ bufv.buf[0].mem = ((char *)arg) + FUSE_COMPAT_WRITE_IN_SIZE;
bufv.buf[0].size -= sizeof(struct fuse_in_header) +
- FUSE_COMPAT_WRITE_IN_SIZE;
+ FUSE_COMPAT_WRITE_IN_SIZE;
assert(!(bufv.buf[0].flags & FUSE_BUF_IS_FD));
} else {
- fi.lock_owner = arg->lock_owner;
- fi.flags = arg->flags;
if (!(bufv.buf[0].flags & FUSE_BUF_IS_FD))
bufv.buf[0].mem = PARAM(arg);
bufv.buf[0].size -= sizeof(struct fuse_in_header) +
- sizeof(struct fuse_write_in);
+ sizeof(struct fuse_write_in);
}
if (bufv.buf[0].size < arg->size) {
- fuse_log(FUSE_LOG_ERR, "fuse: do_write_buf: buffer size too small\n");
+ fuse_log(FUSE_LOG_ERR, "fuse: %s: buffer size too small\n",
+ __func__);
fuse_reply_err(req, EIO);
goto out;
}
bufv.buf[0].size = arg->size;
- se->op.write_buf(req, nodeid, &bufv, arg->offset, &fi);
+ _do_write_buf(req, nodeid, inarg, &bufv);
out:
/* Need to reset the pipe if ->write_buf() didn't consume all data */
@@ -1550,9 +1739,11 @@ out:
fuse_ll_clear_pipe(se);
}
-static void do_flush(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void _do_flush(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
{
- struct fuse_flush_in *arg = (struct fuse_flush_in *) inarg;
+ (void)in_payload;
+ struct fuse_flush_in *arg = (struct fuse_flush_in *)op_in;
struct fuse_file_info fi;
memset(&fi, 0, sizeof(fi));
@@ -1567,9 +1758,16 @@ static void do_flush(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
fuse_reply_err(req, ENOSYS);
}
-static void do_release(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void do_flush(fuse_req_t req, const fuse_ino_t nodeid, const void *inarg)
+{
+ _do_flush(req, nodeid, inarg, NULL);
+}
+
+static void _do_release(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
{
- struct fuse_release_in *arg = (struct fuse_release_in *) inarg;
+ (void)in_payload;
+ const struct fuse_release_in *arg = op_in;
struct fuse_file_info fi;
memset(&fi, 0, sizeof(fi));
@@ -1590,9 +1788,17 @@ static void do_release(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
fuse_reply_err(req, 0);
}
-static void do_fsync(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void do_release(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *inarg)
+{
+ _do_release(req, nodeid, inarg, NULL);
+}
+
+static void _do_fsync(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
{
- struct fuse_fsync_in *arg = (struct fuse_fsync_in *) inarg;
+ (void)in_payload;
+ const struct fuse_fsync_in *arg = op_in;
struct fuse_file_info fi;
int datasync = arg->fsync_flags & 1;
@@ -1605,13 +1811,21 @@ static void do_fsync(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
fuse_reply_err(req, ENOSYS);
}
-static void do_opendir(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void do_fsync(fuse_req_t req, const fuse_ino_t nodeid, const void *inarg)
{
- struct fuse_open_in *arg = (struct fuse_open_in *) inarg;
+ _do_fsync(req, nodeid, inarg, NULL);
+}
+
+static void _do_opendir(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
+{
+ (void)in_payload;
+ const struct fuse_open_in *arg = op_in;
struct fuse_file_info fi;
memset(&fi, 0, sizeof(fi));
fi.flags = arg->flags;
+ /* XXX: fuse_open_in::open_flags */
if (req->se->op.opendir)
req->se->op.opendir(req, nodeid, &fi);
@@ -1621,9 +1835,17 @@ static void do_opendir(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
fuse_reply_open(req, &fi);
}
-static void do_readdir(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void do_opendir(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *inarg)
+{
+ _do_opendir(req, nodeid, inarg, NULL);
+}
+
+static void _do_readdir(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
{
- struct fuse_read_in *arg = (struct fuse_read_in *) inarg;
+ (void)in_payload;
+ struct fuse_read_in *arg = (struct fuse_read_in *)op_in;
struct fuse_file_info fi;
memset(&fi, 0, sizeof(fi));
@@ -1635,9 +1857,17 @@ static void do_readdir(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
fuse_reply_err(req, ENOSYS);
}
-static void do_readdirplus(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void do_readdir(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *inarg)
{
- struct fuse_read_in *arg = (struct fuse_read_in *) inarg;
+ _do_readdir(req, nodeid, inarg, NULL);
+}
+
+static void _do_readdirplus(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
+{
+ (void)in_payload;
+ struct fuse_read_in *arg = (struct fuse_read_in *)op_in;
struct fuse_file_info fi;
memset(&fi, 0, sizeof(fi));
@@ -1649,9 +1879,17 @@ static void do_readdirplus(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
fuse_reply_err(req, ENOSYS);
}
-static void do_releasedir(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void do_readdirplus(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *inarg)
{
- struct fuse_release_in *arg = (struct fuse_release_in *) inarg;
+ _do_readdirplus(req, nodeid, inarg, NULL);
+}
+
+static void _do_releasedir(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
+{
+ (void)in_payload;
+ struct fuse_release_in *arg = (struct fuse_release_in *)op_in;
struct fuse_file_info fi;
memset(&fi, 0, sizeof(fi));
@@ -1664,9 +1902,17 @@ static void do_releasedir(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
fuse_reply_err(req, 0);
}
-static void do_fsyncdir(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void do_releasedir(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *inarg)
{
- struct fuse_fsync_in *arg = (struct fuse_fsync_in *) inarg;
+ _do_releasedir(req, nodeid, inarg, NULL);
+}
+
+static void _do_fsyncdir(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
+{
+ (void)in_payload;
+ struct fuse_fsync_in *arg = (struct fuse_fsync_in *)op_in;
struct fuse_file_info fi;
int datasync = arg->fsync_flags & 1;
@@ -1678,11 +1924,18 @@ static void do_fsyncdir(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
else
fuse_reply_err(req, ENOSYS);
}
+static void do_fsyncdir(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *inarg)
+{
+ _do_fsyncdir(req, nodeid, inarg, NULL);
+}
-static void do_statfs(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void _do_statfs(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
{
(void) nodeid;
- (void) inarg;
+ (void)op_in;
+ (void)in_payload;
if (req->se->op.statfs)
req->se->op.statfs(req, nodeid);
@@ -1694,55 +1947,93 @@ static void do_statfs(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
fuse_reply_statfs(req, &buf);
}
}
+static void do_statfs(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *inarg)
+{
+ _do_statfs(req, nodeid, inarg, NULL);
+}
-static void do_setxattr(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void _do_setxattr(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
{
- struct fuse_session *se = req->se;
- unsigned int xattr_ext = !!(se->conn.want_ext & FUSE_CAP_SETXATTR_EXT);
- struct fuse_setxattr_in *arg = (struct fuse_setxattr_in *) inarg;
- char *name = xattr_ext ? PARAM(arg) :
- (char *)arg + FUSE_COMPAT_SETXATTR_IN_SIZE;
- char *value = name + strlen(name) + 1;
+ struct fuse_setxattr_in *arg = (struct fuse_setxattr_in *)op_in;
+ const char *name = in_payload;
+ const char *value = name + strlen(name) + 1;
/* XXX:The API should be extended to support extra_flags/setxattr_flags */
+
if (req->se->op.setxattr)
req->se->op.setxattr(req, nodeid, name, value, arg->size,
- arg->flags);
+ arg->flags);
else
fuse_reply_err(req, ENOSYS);
}
+static void do_setxattr(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *inarg)
+{
+ struct fuse_session *se = req->se;
+ unsigned int xattr_ext = !!(se->conn.want & FUSE_CAP_SETXATTR_EXT);
+ const struct fuse_setxattr_in *arg = inarg;
+ char *payload = xattr_ext ? PARAM(arg) :
+ (char *)arg + FUSE_COMPAT_SETXATTR_IN_SIZE;
-static void do_getxattr(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+ _do_setxattr(req, nodeid, arg, payload);
+}
+
+static void _do_getxattr(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
{
- struct fuse_getxattr_in *arg = (struct fuse_getxattr_in *) inarg;
+ const struct fuse_getxattr_in *arg = op_in;
if (req->se->op.getxattr)
- req->se->op.getxattr(req, nodeid, PARAM(arg), arg->size);
+ req->se->op.getxattr(req, nodeid, in_payload, arg->size);
else
fuse_reply_err(req, ENOSYS);
}
-static void do_listxattr(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void do_getxattr(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *inarg)
{
- struct fuse_getxattr_in *arg = (struct fuse_getxattr_in *) inarg;
+ const struct fuse_getxattr_in *arg = inarg;
+ const void *payload = PARAM(arg);
+
+ _do_getxattr(req, nodeid, arg, payload);
+}
+
+static void _do_listxattr(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *inarg, const void *in_payload)
+{
+ (void)in_payload;
+ const struct fuse_getxattr_in *arg = inarg;
if (req->se->op.listxattr)
req->se->op.listxattr(req, nodeid, arg->size);
else
fuse_reply_err(req, ENOSYS);
}
+static void do_listxattr(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *inarg)
+{
+ _do_listxattr(req, nodeid, inarg, NULL);
+}
-static void do_removexattr(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void _do_removexattr(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *inarg, const void *in_payload)
{
- char *name = (char *) inarg;
+ (void)inarg;
+ const char *name = in_payload;
if (req->se->op.removexattr)
req->se->op.removexattr(req, nodeid, name);
else
fuse_reply_err(req, ENOSYS);
}
+static void do_removexattr(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+{
+ _do_removexattr(req, nodeid, NULL, inarg);
+}
-static void convert_fuse_file_lock(struct fuse_file_lock *fl,
+static void convert_fuse_file_lock(const struct fuse_file_lock *fl,
struct flock *flock)
{
memset(flock, 0, sizeof(struct flock));
@@ -1756,9 +2047,11 @@ static void convert_fuse_file_lock(struct fuse_file_lock *fl,
flock->l_pid = fl->pid;
}
-static void do_getlk(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void _do_getlk(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
{
- struct fuse_lk_in *arg = (struct fuse_lk_in *) inarg;
+ (void)in_payload;
+ const struct fuse_lk_in *arg = op_in;
struct fuse_file_info fi;
struct flock flock;
@@ -1772,11 +2065,15 @@ static void do_getlk(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
else
fuse_reply_err(req, ENOSYS);
}
+static void do_getlk(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+{
+ _do_getlk(req, nodeid, inarg, NULL);
+}
-static void do_setlk_common(fuse_req_t req, fuse_ino_t nodeid,
- const void *inarg, int sleep)
+static void do_setlk_common(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, int sleep)
{
- struct fuse_lk_in *arg = (struct fuse_lk_in *) inarg;
+ const struct fuse_lk_in *arg = op_in;
struct fuse_file_info fi;
struct flock flock;
@@ -1814,14 +2111,27 @@ static void do_setlk_common(fuse_req_t req, fuse_ino_t nodeid,
}
}
-static void do_setlk(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void _do_setlk(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
{
- do_setlk_common(req, nodeid, inarg, 0);
+ (void)in_payload;
+ do_setlk_common(req, nodeid, op_in, 0);
}
+static void do_setlk(fuse_req_t req, const fuse_ino_t nodeid, const void *inarg)
+{
+ _do_setlk(req, nodeid, inarg, NULL);
+}
+
+static void _do_setlkw(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
+{
+ (void)in_payload;
+ do_setlk_common(req, nodeid, op_in, 1);
+}
static void do_setlkw(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
{
- do_setlk_common(req, nodeid, inarg, 1);
+ _do_setlkw(req, nodeid, inarg, NULL);
}
static int find_interrupted(struct fuse_session *se, struct fuse_req *req)
@@ -1864,9 +2174,11 @@ static int find_interrupted(struct fuse_session *se, struct fuse_req *req)
return 0;
}
-static void do_interrupt(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void _do_interrupt(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
{
- struct fuse_interrupt_in *arg = (struct fuse_interrupt_in *) inarg;
+ (void)in_payload;
+ const struct fuse_interrupt_in *arg = op_in;
struct fuse_session *se = req->se;
(void) nodeid;
@@ -1885,6 +2197,10 @@ static void do_interrupt(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
list_add_req(req, &se->interrupts);
pthread_mutex_unlock(&se->lock);
}
+static void do_interrupt(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+{
+ _do_interrupt(req, nodeid, inarg, NULL);
+}
static struct fuse_req *check_interrupt(struct fuse_session *se,
struct fuse_req *req)
@@ -1911,21 +2227,28 @@ static struct fuse_req *check_interrupt(struct fuse_session *se,
return NULL;
}
-static void do_bmap(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void _do_bmap(fuse_req_t req, const fuse_ino_t nodeid, const void *op_in,
+ const void *in_payload)
{
- struct fuse_bmap_in *arg = (struct fuse_bmap_in *) inarg;
+ (void)in_payload;
+ const struct fuse_bmap_in *arg = op_in;
if (req->se->op.bmap)
req->se->op.bmap(req, nodeid, arg->blocksize, arg->block);
else
fuse_reply_err(req, ENOSYS);
}
+static void do_bmap(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+{
+ _do_bmap(req, nodeid, inarg, NULL);
+}
-static void do_ioctl(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void _do_ioctl(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
{
- struct fuse_ioctl_in *arg = (struct fuse_ioctl_in *) inarg;
+ struct fuse_ioctl_in *arg = (struct fuse_ioctl_in *)op_in;
unsigned int flags = arg->flags;
- void *in_buf = arg->in_size ? PARAM(arg) : NULL;
+ const void *in_buf = in_payload;
struct fuse_file_info fi;
if (flags & FUSE_IOCTL_DIR &&
@@ -1949,15 +2272,24 @@ static void do_ioctl(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
else
fuse_reply_err(req, ENOSYS);
}
+static void do_ioctl(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+{
+ const struct fuse_ioctl_in *arg = inarg;
+ void *in_buf = arg->in_size ? PARAM(arg) : NULL;
+
+ _do_ioctl(req, nodeid, arg, in_buf);
+}
void fuse_pollhandle_destroy(struct fuse_pollhandle *ph)
{
free(ph);
}
-static void do_poll(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void _do_poll(fuse_req_t req, const fuse_ino_t nodeid, const void *op_in,
+ const void *in_payload)
{
- struct fuse_poll_in *arg = (struct fuse_poll_in *) inarg;
+ (void)in_payload;
+ struct fuse_poll_in *arg = (struct fuse_poll_in *)op_in;
struct fuse_file_info fi;
memset(&fi, 0, sizeof(fi));
@@ -1983,23 +2315,39 @@ static void do_poll(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
}
}
-static void do_fallocate(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void do_poll(fuse_req_t req, const fuse_ino_t nodeid, const void *inarg)
+{
+ _do_poll(req, nodeid, inarg, NULL);
+}
+
+static void _do_fallocate(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
{
- struct fuse_fallocate_in *arg = (struct fuse_fallocate_in *) inarg;
+ (void)in_payload;
+ const struct fuse_fallocate_in *arg = op_in;
struct fuse_file_info fi;
memset(&fi, 0, sizeof(fi));
fi.fh = arg->fh;
if (req->se->op.fallocate)
- req->se->op.fallocate(req, nodeid, arg->mode, arg->offset, arg->length, &fi);
+ req->se->op.fallocate(req, nodeid, arg->mode, arg->offset,
+ arg->length, &fi);
else
fuse_reply_err(req, ENOSYS);
}
-static void do_copy_file_range(fuse_req_t req, fuse_ino_t nodeid_in, const void *inarg)
+static void do_fallocate(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *inarg)
+{
+ _do_fallocate(req, nodeid, inarg, NULL);
+}
+
+static void _do_copy_file_range(fuse_req_t req, const fuse_ino_t nodeid_in,
+ const void *op_in, const void *in_payload)
{
- struct fuse_copy_file_range_in *arg = (struct fuse_copy_file_range_in *) inarg;
+ (void)in_payload;
+ const struct fuse_copy_file_range_in *arg = op_in;
struct fuse_file_info fi_in, fi_out;
memset(&fi_in, 0, sizeof(fi_in));
@@ -2008,19 +2356,25 @@ static void do_copy_file_range(fuse_req_t req, fuse_ino_t nodeid_in, const void
memset(&fi_out, 0, sizeof(fi_out));
fi_out.fh = arg->fh_out;
-
if (req->se->op.copy_file_range)
- req->se->op.copy_file_range(req, nodeid_in, arg->off_in,
- &fi_in, arg->nodeid_out,
- arg->off_out, &fi_out, arg->len,
- arg->flags);
+ req->se->op.copy_file_range(req, nodeid_in, arg->off_in, &fi_in,
+ arg->nodeid_out, arg->off_out,
+ &fi_out, arg->len, arg->flags);
else
fuse_reply_err(req, ENOSYS);
}
-static void do_lseek(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static void do_copy_file_range(fuse_req_t req, const fuse_ino_t nodeid_in,
+ const void *inarg)
+{
+ _do_copy_file_range(req, nodeid_in, inarg, NULL);
+}
+
+static void _do_lseek(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
{
- struct fuse_lseek_in *arg = (struct fuse_lseek_in *) inarg;
+ (void)in_payload;
+ const struct fuse_lseek_in *arg = op_in;
struct fuse_file_info fi;
memset(&fi, 0, sizeof(fi));
@@ -2032,6 +2386,11 @@ static void do_lseek(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
fuse_reply_err(req, ENOSYS);
}
+static void do_lseek(fuse_req_t req, const fuse_ino_t nodeid, const void *inarg)
+{
+ _do_lseek(req, nodeid, inarg, NULL);
+}
+
static bool want_flags_valid(uint64_t capable, uint64_t want)
{
uint64_t unknown_flags = want & (~capable);
@@ -2046,10 +2405,12 @@ static bool want_flags_valid(uint64_t capable, uint64_t want)
/* Prevent bogus data races (bogus since "init" is called before
* multi-threading becomes relevant */
-static __attribute__((no_sanitize("thread")))
-void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static __attribute__((no_sanitize("thread"))) void
+_do_init(fuse_req_t req, const fuse_ino_t nodeid, const void *op_in,
+ const void *in_payload)
{
- struct fuse_init_in *arg = (struct fuse_init_in *) inarg;
+ (void)in_payload;
+ const struct fuse_init_in *arg = op_in;
struct fuse_init_out outarg;
struct fuse_session *se = req->se;
size_t bufsize = se->bufsize;
@@ -2366,12 +2727,20 @@ void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
send_reply_ok(req, &outarg, outargsize);
}
-static void do_destroy(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+static __attribute__((no_sanitize("thread"))) void
+do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+{
+ _do_init(req, nodeid, inarg, NULL);
+}
+
+static void _do_destroy(fuse_req_t req, const fuse_ino_t nodeid,
+ const void *op_in, const void *in_payload)
{
struct fuse_session *se = req->se;
(void) nodeid;
- (void) inarg;
+ (void)op_in;
+ (void)in_payload;
se->got_destroy = 1;
se->got_init = 0;
@@ -2381,6 +2750,11 @@ static void do_destroy(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
send_reply_ok(req, NULL, 0);
}
+static void do_destroy(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+{
+ _do_destroy(req, nodeid, inarg, NULL);
+}
+
static void list_del_nreq(struct fuse_notify_req *nreq)
{
struct fuse_notify_req *prev = nreq->prev;
@@ -2768,7 +3142,7 @@ static struct {
[FUSE_SETLKW] = { do_setlkw, "SETLKW" },
[FUSE_ACCESS] = { do_access, "ACCESS" },
[FUSE_CREATE] = { do_create, "CREATE" },
- [FUSE_TMPFILE] = { do_tmpfile, "TMPFILE" },
+ [FUSE_TMPFILE] = { do_tmpfile, "TMPFILE" },
[FUSE_INTERRUPT] = { do_interrupt, "INTERRUPT" },
[FUSE_BMAP] = { do_bmap, "BMAP" },
[FUSE_IOCTL] = { do_ioctl, "IOCTL" },
@@ -2784,6 +3158,60 @@ static struct {
[CUSE_INIT] = { cuse_lowlevel_init, "CUSE_INIT" },
};
+static struct {
+ void (*func)(fuse_req_t req, const fuse_ino_t ino, const void *op_in,
+ const void *op_payload);
+ const char *name;
+} fuse_ll_ops2[] __attribute__((unused)) = {
+ [FUSE_LOOKUP] = { _do_lookup, "LOOKUP" },
+ [FUSE_FORGET] = { _do_forget, "FORGET" },
+ [FUSE_GETATTR] = { _do_getattr, "GETATTR" },
+ [FUSE_SETATTR] = { _do_setattr, "SETATTR" },
+ [FUSE_READLINK] = { _do_readlink, "READLINK" },
+ [FUSE_SYMLINK] = { _do_symlink, "SYMLINK" },
+ [FUSE_MKNOD] = { _do_mknod, "MKNOD" },
+ [FUSE_MKDIR] = { _do_mkdir, "MKDIR" },
+ [FUSE_UNLINK] = { _do_unlink, "UNLINK" },
+ [FUSE_RMDIR] = { _do_rmdir, "RMDIR" },
+ [FUSE_RENAME] = { _do_rename, "RENAME" },
+ [FUSE_LINK] = { _do_link, "LINK" },
+ [FUSE_OPEN] = { _do_open, "OPEN" },
+ [FUSE_READ] = { _do_read, "READ" },
+ [FUSE_WRITE] = { _do_write, "WRITE" },
+ [FUSE_STATFS] = { _do_statfs, "STATFS" },
+ [FUSE_RELEASE] = { _do_release, "RELEASE" },
+ [FUSE_FSYNC] = { _do_fsync, "FSYNC" },
+ [FUSE_SETXATTR] = { _do_setxattr, "SETXATTR" },
+ [FUSE_GETXATTR] = { _do_getxattr, "GETXATTR" },
+ [FUSE_LISTXATTR] = { _do_listxattr, "LISTXATTR" },
+ [FUSE_REMOVEXATTR] = { _do_removexattr, "REMOVEXATTR" },
+ [FUSE_FLUSH] = { _do_flush, "FLUSH" },
+ [FUSE_INIT] = { _do_init, "INIT" },
+ [FUSE_OPENDIR] = { _do_opendir, "OPENDIR" },
+ [FUSE_READDIR] = { _do_readdir, "READDIR" },
+ [FUSE_RELEASEDIR] = { _do_releasedir, "RELEASEDIR" },
+ [FUSE_FSYNCDIR] = { _do_fsyncdir, "FSYNCDIR" },
+ [FUSE_GETLK] = { _do_getlk, "GETLK" },
+ [FUSE_SETLK] = { _do_setlk, "SETLK" },
+ [FUSE_SETLKW] = { _do_setlkw, "SETLKW" },
+ [FUSE_ACCESS] = { _do_access, "ACCESS" },
+ [FUSE_CREATE] = { _do_create, "CREATE" },
+ [FUSE_TMPFILE] = { _do_tmpfile, "TMPFILE" },
+ [FUSE_INTERRUPT] = { _do_interrupt, "INTERRUPT" },
+ [FUSE_BMAP] = { _do_bmap, "BMAP" },
+ [FUSE_IOCTL] = { _do_ioctl, "IOCTL" },
+ [FUSE_POLL] = { _do_poll, "POLL" },
+ [FUSE_FALLOCATE] = { _do_fallocate, "FALLOCATE" },
+ [FUSE_DESTROY] = { _do_destroy, "DESTROY" },
+ [FUSE_NOTIFY_REPLY] = { (void *)1, "NOTIFY_REPLY" },
+ [FUSE_BATCH_FORGET] = { _do_batch_forget, "BATCH_FORGET" },
+ [FUSE_READDIRPLUS] = { _do_readdirplus, "READDIRPLUS" },
+ [FUSE_RENAME2] = { _do_rename2, "RENAME2" },
+ [FUSE_COPY_FILE_RANGE] = { _do_copy_file_range, "COPY_FILE_RANGE" },
+ [FUSE_LSEEK] = { _do_lseek, "LSEEK" },
+ [CUSE_INIT] = { _cuse_lowlevel_init, "CUSE_INIT" },
+};
+
/*
* For ABI compatibility we cannot allow higher values than CUSE_INIT.
* Without ABI compatibility we could use the size of the array.