forked from Minki/linux
fuse: flatten 'struct fuse_args'
...to make future expansion simpler. The hiearachical structure is a historical thing that does not serve any practical purpose. The generated code is excatly the same before and after the patch. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
This commit is contained in:
parent
76e43c8cca
commit
d5b4854357
@ -590,32 +590,32 @@ EXPORT_SYMBOL_GPL(fuse_request_send);
|
|||||||
|
|
||||||
static void fuse_adjust_compat(struct fuse_conn *fc, struct fuse_args *args)
|
static void fuse_adjust_compat(struct fuse_conn *fc, struct fuse_args *args)
|
||||||
{
|
{
|
||||||
if (fc->minor < 4 && args->in.h.opcode == FUSE_STATFS)
|
if (fc->minor < 4 && args->opcode == FUSE_STATFS)
|
||||||
args->out.args[0].size = FUSE_COMPAT_STATFS_SIZE;
|
args->out_args[0].size = FUSE_COMPAT_STATFS_SIZE;
|
||||||
|
|
||||||
if (fc->minor < 9) {
|
if (fc->minor < 9) {
|
||||||
switch (args->in.h.opcode) {
|
switch (args->opcode) {
|
||||||
case FUSE_LOOKUP:
|
case FUSE_LOOKUP:
|
||||||
case FUSE_CREATE:
|
case FUSE_CREATE:
|
||||||
case FUSE_MKNOD:
|
case FUSE_MKNOD:
|
||||||
case FUSE_MKDIR:
|
case FUSE_MKDIR:
|
||||||
case FUSE_SYMLINK:
|
case FUSE_SYMLINK:
|
||||||
case FUSE_LINK:
|
case FUSE_LINK:
|
||||||
args->out.args[0].size = FUSE_COMPAT_ENTRY_OUT_SIZE;
|
args->out_args[0].size = FUSE_COMPAT_ENTRY_OUT_SIZE;
|
||||||
break;
|
break;
|
||||||
case FUSE_GETATTR:
|
case FUSE_GETATTR:
|
||||||
case FUSE_SETATTR:
|
case FUSE_SETATTR:
|
||||||
args->out.args[0].size = FUSE_COMPAT_ATTR_OUT_SIZE;
|
args->out_args[0].size = FUSE_COMPAT_ATTR_OUT_SIZE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fc->minor < 12) {
|
if (fc->minor < 12) {
|
||||||
switch (args->in.h.opcode) {
|
switch (args->opcode) {
|
||||||
case FUSE_CREATE:
|
case FUSE_CREATE:
|
||||||
args->in.args[0].size = sizeof(struct fuse_open_in);
|
args->in_args[0].size = sizeof(struct fuse_open_in);
|
||||||
break;
|
break;
|
||||||
case FUSE_MKNOD:
|
case FUSE_MKNOD:
|
||||||
args->in.args[0].size = FUSE_COMPAT_MKNOD_IN_SIZE;
|
args->in_args[0].size = FUSE_COMPAT_MKNOD_IN_SIZE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -633,19 +633,19 @@ ssize_t fuse_simple_request(struct fuse_conn *fc, struct fuse_args *args)
|
|||||||
/* Needs to be done after fuse_get_req() so that fc->minor is valid */
|
/* Needs to be done after fuse_get_req() so that fc->minor is valid */
|
||||||
fuse_adjust_compat(fc, args);
|
fuse_adjust_compat(fc, args);
|
||||||
|
|
||||||
req->in.h.opcode = args->in.h.opcode;
|
req->in.h.opcode = args->opcode;
|
||||||
req->in.h.nodeid = args->in.h.nodeid;
|
req->in.h.nodeid = args->nodeid;
|
||||||
req->in.numargs = args->in.numargs;
|
req->in.numargs = args->in_numargs;
|
||||||
memcpy(req->in.args, args->in.args,
|
memcpy(req->in.args, args->in_args,
|
||||||
args->in.numargs * sizeof(struct fuse_in_arg));
|
args->in_numargs * sizeof(struct fuse_in_arg));
|
||||||
req->out.argvar = args->out.argvar;
|
req->out.argvar = args->out_argvar;
|
||||||
req->out.numargs = args->out.numargs;
|
req->out.numargs = args->out_numargs;
|
||||||
memcpy(req->out.args, args->out.args,
|
memcpy(req->out.args, args->out_args,
|
||||||
args->out.numargs * sizeof(struct fuse_arg));
|
args->out_numargs * sizeof(struct fuse_arg));
|
||||||
fuse_request_send(fc, req);
|
fuse_request_send(fc, req);
|
||||||
ret = req->out.h.error;
|
ret = req->out.h.error;
|
||||||
if (!ret && args->out.argvar) {
|
if (!ret && args->out_argvar) {
|
||||||
BUG_ON(args->out.numargs != 1);
|
BUG_ON(args->out_numargs != 1);
|
||||||
ret = req->out.args[0].size;
|
ret = req->out.args[0].size;
|
||||||
}
|
}
|
||||||
fuse_put_request(fc, req);
|
fuse_put_request(fc, req);
|
||||||
|
176
fs/fuse/dir.c
176
fs/fuse/dir.c
@ -139,14 +139,14 @@ static void fuse_lookup_init(struct fuse_conn *fc, struct fuse_args *args,
|
|||||||
struct fuse_entry_out *outarg)
|
struct fuse_entry_out *outarg)
|
||||||
{
|
{
|
||||||
memset(outarg, 0, sizeof(struct fuse_entry_out));
|
memset(outarg, 0, sizeof(struct fuse_entry_out));
|
||||||
args->in.h.opcode = FUSE_LOOKUP;
|
args->opcode = FUSE_LOOKUP;
|
||||||
args->in.h.nodeid = nodeid;
|
args->nodeid = nodeid;
|
||||||
args->in.numargs = 1;
|
args->in_numargs = 1;
|
||||||
args->in.args[0].size = name->len + 1;
|
args->in_args[0].size = name->len + 1;
|
||||||
args->in.args[0].value = name->name;
|
args->in_args[0].value = name->name;
|
||||||
args->out.numargs = 1;
|
args->out_numargs = 1;
|
||||||
args->out.args[0].size = sizeof(struct fuse_entry_out);
|
args->out_args[0].size = sizeof(struct fuse_entry_out);
|
||||||
args->out.args[0].value = outarg;
|
args->out_args[0].value = outarg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -410,18 +410,18 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry,
|
|||||||
inarg.flags = flags;
|
inarg.flags = flags;
|
||||||
inarg.mode = mode;
|
inarg.mode = mode;
|
||||||
inarg.umask = current_umask();
|
inarg.umask = current_umask();
|
||||||
args.in.h.opcode = FUSE_CREATE;
|
args.opcode = FUSE_CREATE;
|
||||||
args.in.h.nodeid = get_node_id(dir);
|
args.nodeid = get_node_id(dir);
|
||||||
args.in.numargs = 2;
|
args.in_numargs = 2;
|
||||||
args.in.args[0].size = sizeof(inarg);
|
args.in_args[0].size = sizeof(inarg);
|
||||||
args.in.args[0].value = &inarg;
|
args.in_args[0].value = &inarg;
|
||||||
args.in.args[1].size = entry->d_name.len + 1;
|
args.in_args[1].size = entry->d_name.len + 1;
|
||||||
args.in.args[1].value = entry->d_name.name;
|
args.in_args[1].value = entry->d_name.name;
|
||||||
args.out.numargs = 2;
|
args.out_numargs = 2;
|
||||||
args.out.args[0].size = sizeof(outentry);
|
args.out_args[0].size = sizeof(outentry);
|
||||||
args.out.args[0].value = &outentry;
|
args.out_args[0].value = &outentry;
|
||||||
args.out.args[1].size = sizeof(outopen);
|
args.out_args[1].size = sizeof(outopen);
|
||||||
args.out.args[1].value = &outopen;
|
args.out_args[1].value = &outopen;
|
||||||
err = fuse_simple_request(fc, &args);
|
err = fuse_simple_request(fc, &args);
|
||||||
if (err)
|
if (err)
|
||||||
goto out_free_ff;
|
goto out_free_ff;
|
||||||
@ -526,10 +526,10 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_args *args,
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
memset(&outarg, 0, sizeof(outarg));
|
memset(&outarg, 0, sizeof(outarg));
|
||||||
args->in.h.nodeid = get_node_id(dir);
|
args->nodeid = get_node_id(dir);
|
||||||
args->out.numargs = 1;
|
args->out_numargs = 1;
|
||||||
args->out.args[0].size = sizeof(outarg);
|
args->out_args[0].size = sizeof(outarg);
|
||||||
args->out.args[0].value = &outarg;
|
args->out_args[0].value = &outarg;
|
||||||
err = fuse_simple_request(fc, args);
|
err = fuse_simple_request(fc, args);
|
||||||
if (err)
|
if (err)
|
||||||
goto out_put_forget_req;
|
goto out_put_forget_req;
|
||||||
@ -582,12 +582,12 @@ static int fuse_mknod(struct inode *dir, struct dentry *entry, umode_t mode,
|
|||||||
inarg.mode = mode;
|
inarg.mode = mode;
|
||||||
inarg.rdev = new_encode_dev(rdev);
|
inarg.rdev = new_encode_dev(rdev);
|
||||||
inarg.umask = current_umask();
|
inarg.umask = current_umask();
|
||||||
args.in.h.opcode = FUSE_MKNOD;
|
args.opcode = FUSE_MKNOD;
|
||||||
args.in.numargs = 2;
|
args.in_numargs = 2;
|
||||||
args.in.args[0].size = sizeof(inarg);
|
args.in_args[0].size = sizeof(inarg);
|
||||||
args.in.args[0].value = &inarg;
|
args.in_args[0].value = &inarg;
|
||||||
args.in.args[1].size = entry->d_name.len + 1;
|
args.in_args[1].size = entry->d_name.len + 1;
|
||||||
args.in.args[1].value = entry->d_name.name;
|
args.in_args[1].value = entry->d_name.name;
|
||||||
return create_new_entry(fc, &args, dir, entry, mode);
|
return create_new_entry(fc, &args, dir, entry, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -609,12 +609,12 @@ static int fuse_mkdir(struct inode *dir, struct dentry *entry, umode_t mode)
|
|||||||
memset(&inarg, 0, sizeof(inarg));
|
memset(&inarg, 0, sizeof(inarg));
|
||||||
inarg.mode = mode;
|
inarg.mode = mode;
|
||||||
inarg.umask = current_umask();
|
inarg.umask = current_umask();
|
||||||
args.in.h.opcode = FUSE_MKDIR;
|
args.opcode = FUSE_MKDIR;
|
||||||
args.in.numargs = 2;
|
args.in_numargs = 2;
|
||||||
args.in.args[0].size = sizeof(inarg);
|
args.in_args[0].size = sizeof(inarg);
|
||||||
args.in.args[0].value = &inarg;
|
args.in_args[0].value = &inarg;
|
||||||
args.in.args[1].size = entry->d_name.len + 1;
|
args.in_args[1].size = entry->d_name.len + 1;
|
||||||
args.in.args[1].value = entry->d_name.name;
|
args.in_args[1].value = entry->d_name.name;
|
||||||
return create_new_entry(fc, &args, dir, entry, S_IFDIR);
|
return create_new_entry(fc, &args, dir, entry, S_IFDIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -625,12 +625,12 @@ static int fuse_symlink(struct inode *dir, struct dentry *entry,
|
|||||||
unsigned len = strlen(link) + 1;
|
unsigned len = strlen(link) + 1;
|
||||||
FUSE_ARGS(args);
|
FUSE_ARGS(args);
|
||||||
|
|
||||||
args.in.h.opcode = FUSE_SYMLINK;
|
args.opcode = FUSE_SYMLINK;
|
||||||
args.in.numargs = 2;
|
args.in_numargs = 2;
|
||||||
args.in.args[0].size = entry->d_name.len + 1;
|
args.in_args[0].size = entry->d_name.len + 1;
|
||||||
args.in.args[0].value = entry->d_name.name;
|
args.in_args[0].value = entry->d_name.name;
|
||||||
args.in.args[1].size = len;
|
args.in_args[1].size = len;
|
||||||
args.in.args[1].value = link;
|
args.in_args[1].value = link;
|
||||||
return create_new_entry(fc, &args, dir, entry, S_IFLNK);
|
return create_new_entry(fc, &args, dir, entry, S_IFLNK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -648,11 +648,11 @@ static int fuse_unlink(struct inode *dir, struct dentry *entry)
|
|||||||
struct fuse_conn *fc = get_fuse_conn(dir);
|
struct fuse_conn *fc = get_fuse_conn(dir);
|
||||||
FUSE_ARGS(args);
|
FUSE_ARGS(args);
|
||||||
|
|
||||||
args.in.h.opcode = FUSE_UNLINK;
|
args.opcode = FUSE_UNLINK;
|
||||||
args.in.h.nodeid = get_node_id(dir);
|
args.nodeid = get_node_id(dir);
|
||||||
args.in.numargs = 1;
|
args.in_numargs = 1;
|
||||||
args.in.args[0].size = entry->d_name.len + 1;
|
args.in_args[0].size = entry->d_name.len + 1;
|
||||||
args.in.args[0].value = entry->d_name.name;
|
args.in_args[0].value = entry->d_name.name;
|
||||||
err = fuse_simple_request(fc, &args);
|
err = fuse_simple_request(fc, &args);
|
||||||
if (!err) {
|
if (!err) {
|
||||||
struct inode *inode = d_inode(entry);
|
struct inode *inode = d_inode(entry);
|
||||||
@ -684,11 +684,11 @@ static int fuse_rmdir(struct inode *dir, struct dentry *entry)
|
|||||||
struct fuse_conn *fc = get_fuse_conn(dir);
|
struct fuse_conn *fc = get_fuse_conn(dir);
|
||||||
FUSE_ARGS(args);
|
FUSE_ARGS(args);
|
||||||
|
|
||||||
args.in.h.opcode = FUSE_RMDIR;
|
args.opcode = FUSE_RMDIR;
|
||||||
args.in.h.nodeid = get_node_id(dir);
|
args.nodeid = get_node_id(dir);
|
||||||
args.in.numargs = 1;
|
args.in_numargs = 1;
|
||||||
args.in.args[0].size = entry->d_name.len + 1;
|
args.in_args[0].size = entry->d_name.len + 1;
|
||||||
args.in.args[0].value = entry->d_name.name;
|
args.in_args[0].value = entry->d_name.name;
|
||||||
err = fuse_simple_request(fc, &args);
|
err = fuse_simple_request(fc, &args);
|
||||||
if (!err) {
|
if (!err) {
|
||||||
clear_nlink(d_inode(entry));
|
clear_nlink(d_inode(entry));
|
||||||
@ -711,15 +711,15 @@ static int fuse_rename_common(struct inode *olddir, struct dentry *oldent,
|
|||||||
memset(&inarg, 0, argsize);
|
memset(&inarg, 0, argsize);
|
||||||
inarg.newdir = get_node_id(newdir);
|
inarg.newdir = get_node_id(newdir);
|
||||||
inarg.flags = flags;
|
inarg.flags = flags;
|
||||||
args.in.h.opcode = opcode;
|
args.opcode = opcode;
|
||||||
args.in.h.nodeid = get_node_id(olddir);
|
args.nodeid = get_node_id(olddir);
|
||||||
args.in.numargs = 3;
|
args.in_numargs = 3;
|
||||||
args.in.args[0].size = argsize;
|
args.in_args[0].size = argsize;
|
||||||
args.in.args[0].value = &inarg;
|
args.in_args[0].value = &inarg;
|
||||||
args.in.args[1].size = oldent->d_name.len + 1;
|
args.in_args[1].size = oldent->d_name.len + 1;
|
||||||
args.in.args[1].value = oldent->d_name.name;
|
args.in_args[1].value = oldent->d_name.name;
|
||||||
args.in.args[2].size = newent->d_name.len + 1;
|
args.in_args[2].size = newent->d_name.len + 1;
|
||||||
args.in.args[2].value = newent->d_name.name;
|
args.in_args[2].value = newent->d_name.name;
|
||||||
err = fuse_simple_request(fc, &args);
|
err = fuse_simple_request(fc, &args);
|
||||||
if (!err) {
|
if (!err) {
|
||||||
/* ctime changes */
|
/* ctime changes */
|
||||||
@ -796,12 +796,12 @@ static int fuse_link(struct dentry *entry, struct inode *newdir,
|
|||||||
|
|
||||||
memset(&inarg, 0, sizeof(inarg));
|
memset(&inarg, 0, sizeof(inarg));
|
||||||
inarg.oldnodeid = get_node_id(inode);
|
inarg.oldnodeid = get_node_id(inode);
|
||||||
args.in.h.opcode = FUSE_LINK;
|
args.opcode = FUSE_LINK;
|
||||||
args.in.numargs = 2;
|
args.in_numargs = 2;
|
||||||
args.in.args[0].size = sizeof(inarg);
|
args.in_args[0].size = sizeof(inarg);
|
||||||
args.in.args[0].value = &inarg;
|
args.in_args[0].value = &inarg;
|
||||||
args.in.args[1].size = newent->d_name.len + 1;
|
args.in_args[1].size = newent->d_name.len + 1;
|
||||||
args.in.args[1].value = newent->d_name.name;
|
args.in_args[1].value = newent->d_name.name;
|
||||||
err = create_new_entry(fc, &args, newdir, newent, inode->i_mode);
|
err = create_new_entry(fc, &args, newdir, newent, inode->i_mode);
|
||||||
/* Contrary to "normal" filesystems it can happen that link
|
/* Contrary to "normal" filesystems it can happen that link
|
||||||
makes two "logical" inodes point to the same "physical"
|
makes two "logical" inodes point to the same "physical"
|
||||||
@ -884,14 +884,14 @@ static int fuse_do_getattr(struct inode *inode, struct kstat *stat,
|
|||||||
inarg.getattr_flags |= FUSE_GETATTR_FH;
|
inarg.getattr_flags |= FUSE_GETATTR_FH;
|
||||||
inarg.fh = ff->fh;
|
inarg.fh = ff->fh;
|
||||||
}
|
}
|
||||||
args.in.h.opcode = FUSE_GETATTR;
|
args.opcode = FUSE_GETATTR;
|
||||||
args.in.h.nodeid = get_node_id(inode);
|
args.nodeid = get_node_id(inode);
|
||||||
args.in.numargs = 1;
|
args.in_numargs = 1;
|
||||||
args.in.args[0].size = sizeof(inarg);
|
args.in_args[0].size = sizeof(inarg);
|
||||||
args.in.args[0].value = &inarg;
|
args.in_args[0].value = &inarg;
|
||||||
args.out.numargs = 1;
|
args.out_numargs = 1;
|
||||||
args.out.args[0].size = sizeof(outarg);
|
args.out_args[0].size = sizeof(outarg);
|
||||||
args.out.args[0].value = &outarg;
|
args.out_args[0].value = &outarg;
|
||||||
err = fuse_simple_request(fc, &args);
|
err = fuse_simple_request(fc, &args);
|
||||||
if (!err) {
|
if (!err) {
|
||||||
if ((inode->i_mode ^ outarg.attr.mode) & S_IFMT) {
|
if ((inode->i_mode ^ outarg.attr.mode) & S_IFMT) {
|
||||||
@ -1056,11 +1056,11 @@ static int fuse_access(struct inode *inode, int mask)
|
|||||||
|
|
||||||
memset(&inarg, 0, sizeof(inarg));
|
memset(&inarg, 0, sizeof(inarg));
|
||||||
inarg.mask = mask & (MAY_READ | MAY_WRITE | MAY_EXEC);
|
inarg.mask = mask & (MAY_READ | MAY_WRITE | MAY_EXEC);
|
||||||
args.in.h.opcode = FUSE_ACCESS;
|
args.opcode = FUSE_ACCESS;
|
||||||
args.in.h.nodeid = get_node_id(inode);
|
args.nodeid = get_node_id(inode);
|
||||||
args.in.numargs = 1;
|
args.in_numargs = 1;
|
||||||
args.in.args[0].size = sizeof(inarg);
|
args.in_args[0].size = sizeof(inarg);
|
||||||
args.in.args[0].value = &inarg;
|
args.in_args[0].value = &inarg;
|
||||||
err = fuse_simple_request(fc, &args);
|
err = fuse_simple_request(fc, &args);
|
||||||
if (err == -ENOSYS) {
|
if (err == -ENOSYS) {
|
||||||
fc->no_access = 1;
|
fc->no_access = 1;
|
||||||
@ -1383,14 +1383,14 @@ static void fuse_setattr_fill(struct fuse_conn *fc, struct fuse_args *args,
|
|||||||
struct fuse_setattr_in *inarg_p,
|
struct fuse_setattr_in *inarg_p,
|
||||||
struct fuse_attr_out *outarg_p)
|
struct fuse_attr_out *outarg_p)
|
||||||
{
|
{
|
||||||
args->in.h.opcode = FUSE_SETATTR;
|
args->opcode = FUSE_SETATTR;
|
||||||
args->in.h.nodeid = get_node_id(inode);
|
args->nodeid = get_node_id(inode);
|
||||||
args->in.numargs = 1;
|
args->in_numargs = 1;
|
||||||
args->in.args[0].size = sizeof(*inarg_p);
|
args->in_args[0].size = sizeof(*inarg_p);
|
||||||
args->in.args[0].value = inarg_p;
|
args->in_args[0].value = inarg_p;
|
||||||
args->out.numargs = 1;
|
args->out_numargs = 1;
|
||||||
args->out.args[0].size = sizeof(*outarg_p);
|
args->out_args[0].size = sizeof(*outarg_p);
|
||||||
args->out.args[0].value = outarg_p;
|
args->out_args[0].value = outarg_p;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
116
fs/fuse/file.c
116
fs/fuse/file.c
@ -29,14 +29,14 @@ static int fuse_send_open(struct fuse_conn *fc, u64 nodeid, struct file *file,
|
|||||||
inarg.flags = file->f_flags & ~(O_CREAT | O_EXCL | O_NOCTTY);
|
inarg.flags = file->f_flags & ~(O_CREAT | O_EXCL | O_NOCTTY);
|
||||||
if (!fc->atomic_o_trunc)
|
if (!fc->atomic_o_trunc)
|
||||||
inarg.flags &= ~O_TRUNC;
|
inarg.flags &= ~O_TRUNC;
|
||||||
args.in.h.opcode = opcode;
|
args.opcode = opcode;
|
||||||
args.in.h.nodeid = nodeid;
|
args.nodeid = nodeid;
|
||||||
args.in.numargs = 1;
|
args.in_numargs = 1;
|
||||||
args.in.args[0].size = sizeof(inarg);
|
args.in_args[0].size = sizeof(inarg);
|
||||||
args.in.args[0].value = &inarg;
|
args.in_args[0].value = &inarg;
|
||||||
args.out.numargs = 1;
|
args.out_numargs = 1;
|
||||||
args.out.args[0].size = sizeof(*outargp);
|
args.out_args[0].size = sizeof(*outargp);
|
||||||
args.out.args[0].value = outargp;
|
args.out_args[0].value = outargp;
|
||||||
|
|
||||||
return fuse_simple_request(fc, &args);
|
return fuse_simple_request(fc, &args);
|
||||||
}
|
}
|
||||||
@ -464,11 +464,11 @@ int fuse_fsync_common(struct file *file, loff_t start, loff_t end,
|
|||||||
memset(&inarg, 0, sizeof(inarg));
|
memset(&inarg, 0, sizeof(inarg));
|
||||||
inarg.fh = ff->fh;
|
inarg.fh = ff->fh;
|
||||||
inarg.fsync_flags = datasync ? FUSE_FSYNC_FDATASYNC : 0;
|
inarg.fsync_flags = datasync ? FUSE_FSYNC_FDATASYNC : 0;
|
||||||
args.in.h.opcode = opcode;
|
args.opcode = opcode;
|
||||||
args.in.h.nodeid = get_node_id(inode);
|
args.nodeid = get_node_id(inode);
|
||||||
args.in.numargs = 1;
|
args.in_numargs = 1;
|
||||||
args.in.args[0].size = sizeof(inarg);
|
args.in_args[0].size = sizeof(inarg);
|
||||||
args.in.args[0].value = &inarg;
|
args.in_args[0].value = &inarg;
|
||||||
return fuse_simple_request(fc, &args);
|
return fuse_simple_request(fc, &args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2221,11 +2221,11 @@ static void fuse_lk_fill(struct fuse_args *args, struct file *file,
|
|||||||
inarg->lk.pid = pid;
|
inarg->lk.pid = pid;
|
||||||
if (flock)
|
if (flock)
|
||||||
inarg->lk_flags |= FUSE_LK_FLOCK;
|
inarg->lk_flags |= FUSE_LK_FLOCK;
|
||||||
args->in.h.opcode = opcode;
|
args->opcode = opcode;
|
||||||
args->in.h.nodeid = get_node_id(inode);
|
args->nodeid = get_node_id(inode);
|
||||||
args->in.numargs = 1;
|
args->in_numargs = 1;
|
||||||
args->in.args[0].size = sizeof(*inarg);
|
args->in_args[0].size = sizeof(*inarg);
|
||||||
args->in.args[0].value = inarg;
|
args->in_args[0].value = inarg;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fuse_getlk(struct file *file, struct file_lock *fl)
|
static int fuse_getlk(struct file *file, struct file_lock *fl)
|
||||||
@ -2238,9 +2238,9 @@ static int fuse_getlk(struct file *file, struct file_lock *fl)
|
|||||||
int err;
|
int err;
|
||||||
|
|
||||||
fuse_lk_fill(&args, file, fl, FUSE_GETLK, 0, 0, &inarg);
|
fuse_lk_fill(&args, file, fl, FUSE_GETLK, 0, 0, &inarg);
|
||||||
args.out.numargs = 1;
|
args.out_numargs = 1;
|
||||||
args.out.args[0].size = sizeof(outarg);
|
args.out_args[0].size = sizeof(outarg);
|
||||||
args.out.args[0].value = &outarg;
|
args.out_args[0].value = &outarg;
|
||||||
err = fuse_simple_request(fc, &args);
|
err = fuse_simple_request(fc, &args);
|
||||||
if (!err)
|
if (!err)
|
||||||
err = convert_fuse_file_lock(fc, &outarg.lk, fl);
|
err = convert_fuse_file_lock(fc, &outarg.lk, fl);
|
||||||
@ -2335,14 +2335,14 @@ static sector_t fuse_bmap(struct address_space *mapping, sector_t block)
|
|||||||
memset(&inarg, 0, sizeof(inarg));
|
memset(&inarg, 0, sizeof(inarg));
|
||||||
inarg.block = block;
|
inarg.block = block;
|
||||||
inarg.blocksize = inode->i_sb->s_blocksize;
|
inarg.blocksize = inode->i_sb->s_blocksize;
|
||||||
args.in.h.opcode = FUSE_BMAP;
|
args.opcode = FUSE_BMAP;
|
||||||
args.in.h.nodeid = get_node_id(inode);
|
args.nodeid = get_node_id(inode);
|
||||||
args.in.numargs = 1;
|
args.in_numargs = 1;
|
||||||
args.in.args[0].size = sizeof(inarg);
|
args.in_args[0].size = sizeof(inarg);
|
||||||
args.in.args[0].value = &inarg;
|
args.in_args[0].value = &inarg;
|
||||||
args.out.numargs = 1;
|
args.out_numargs = 1;
|
||||||
args.out.args[0].size = sizeof(outarg);
|
args.out_args[0].size = sizeof(outarg);
|
||||||
args.out.args[0].value = &outarg;
|
args.out_args[0].value = &outarg;
|
||||||
err = fuse_simple_request(fc, &args);
|
err = fuse_simple_request(fc, &args);
|
||||||
if (err == -ENOSYS)
|
if (err == -ENOSYS)
|
||||||
fc->no_bmap = 1;
|
fc->no_bmap = 1;
|
||||||
@ -2367,14 +2367,14 @@ static loff_t fuse_lseek(struct file *file, loff_t offset, int whence)
|
|||||||
if (fc->no_lseek)
|
if (fc->no_lseek)
|
||||||
goto fallback;
|
goto fallback;
|
||||||
|
|
||||||
args.in.h.opcode = FUSE_LSEEK;
|
args.opcode = FUSE_LSEEK;
|
||||||
args.in.h.nodeid = ff->nodeid;
|
args.nodeid = ff->nodeid;
|
||||||
args.in.numargs = 1;
|
args.in_numargs = 1;
|
||||||
args.in.args[0].size = sizeof(inarg);
|
args.in_args[0].size = sizeof(inarg);
|
||||||
args.in.args[0].value = &inarg;
|
args.in_args[0].value = &inarg;
|
||||||
args.out.numargs = 1;
|
args.out_numargs = 1;
|
||||||
args.out.args[0].size = sizeof(outarg);
|
args.out_args[0].size = sizeof(outarg);
|
||||||
args.out.args[0].value = &outarg;
|
args.out_args[0].value = &outarg;
|
||||||
err = fuse_simple_request(fc, &args);
|
err = fuse_simple_request(fc, &args);
|
||||||
if (err) {
|
if (err) {
|
||||||
if (err == -ENOSYS) {
|
if (err == -ENOSYS) {
|
||||||
@ -2860,14 +2860,14 @@ __poll_t fuse_file_poll(struct file *file, poll_table *wait)
|
|||||||
fuse_register_polled_file(fc, ff);
|
fuse_register_polled_file(fc, ff);
|
||||||
}
|
}
|
||||||
|
|
||||||
args.in.h.opcode = FUSE_POLL;
|
args.opcode = FUSE_POLL;
|
||||||
args.in.h.nodeid = ff->nodeid;
|
args.nodeid = ff->nodeid;
|
||||||
args.in.numargs = 1;
|
args.in_numargs = 1;
|
||||||
args.in.args[0].size = sizeof(inarg);
|
args.in_args[0].size = sizeof(inarg);
|
||||||
args.in.args[0].value = &inarg;
|
args.in_args[0].value = &inarg;
|
||||||
args.out.numargs = 1;
|
args.out_numargs = 1;
|
||||||
args.out.args[0].size = sizeof(outarg);
|
args.out_args[0].size = sizeof(outarg);
|
||||||
args.out.args[0].value = &outarg;
|
args.out_args[0].value = &outarg;
|
||||||
err = fuse_simple_request(fc, &args);
|
err = fuse_simple_request(fc, &args);
|
||||||
|
|
||||||
if (!err)
|
if (!err)
|
||||||
@ -3075,11 +3075,11 @@ static long fuse_file_fallocate(struct file *file, int mode, loff_t offset,
|
|||||||
if (!(mode & FALLOC_FL_KEEP_SIZE))
|
if (!(mode & FALLOC_FL_KEEP_SIZE))
|
||||||
set_bit(FUSE_I_SIZE_UNSTABLE, &fi->state);
|
set_bit(FUSE_I_SIZE_UNSTABLE, &fi->state);
|
||||||
|
|
||||||
args.in.h.opcode = FUSE_FALLOCATE;
|
args.opcode = FUSE_FALLOCATE;
|
||||||
args.in.h.nodeid = ff->nodeid;
|
args.nodeid = ff->nodeid;
|
||||||
args.in.numargs = 1;
|
args.in_numargs = 1;
|
||||||
args.in.args[0].size = sizeof(inarg);
|
args.in_args[0].size = sizeof(inarg);
|
||||||
args.in.args[0].value = &inarg;
|
args.in_args[0].value = &inarg;
|
||||||
err = fuse_simple_request(fc, &args);
|
err = fuse_simple_request(fc, &args);
|
||||||
if (err == -ENOSYS) {
|
if (err == -ENOSYS) {
|
||||||
fc->no_fallocate = 1;
|
fc->no_fallocate = 1;
|
||||||
@ -3167,14 +3167,14 @@ static ssize_t __fuse_copy_file_range(struct file *file_in, loff_t pos_in,
|
|||||||
if (is_unstable)
|
if (is_unstable)
|
||||||
set_bit(FUSE_I_SIZE_UNSTABLE, &fi_out->state);
|
set_bit(FUSE_I_SIZE_UNSTABLE, &fi_out->state);
|
||||||
|
|
||||||
args.in.h.opcode = FUSE_COPY_FILE_RANGE;
|
args.opcode = FUSE_COPY_FILE_RANGE;
|
||||||
args.in.h.nodeid = ff_in->nodeid;
|
args.nodeid = ff_in->nodeid;
|
||||||
args.in.numargs = 1;
|
args.in_numargs = 1;
|
||||||
args.in.args[0].size = sizeof(inarg);
|
args.in_args[0].size = sizeof(inarg);
|
||||||
args.in.args[0].value = &inarg;
|
args.in_args[0].value = &inarg;
|
||||||
args.out.numargs = 1;
|
args.out_numargs = 1;
|
||||||
args.out.args[0].size = sizeof(outarg);
|
args.out_args[0].size = sizeof(outarg);
|
||||||
args.out.args[0].value = &outarg;
|
args.out_args[0].value = &outarg;
|
||||||
err = fuse_simple_request(fc, &args);
|
err = fuse_simple_request(fc, &args);
|
||||||
if (err == -ENOSYS) {
|
if (err == -ENOSYS) {
|
||||||
fc->no_copy_file_range = 1;
|
fc->no_copy_file_range = 1;
|
||||||
|
@ -287,20 +287,13 @@ struct fuse_page_desc {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct fuse_args {
|
struct fuse_args {
|
||||||
struct {
|
uint32_t opcode;
|
||||||
struct {
|
uint64_t nodeid;
|
||||||
uint32_t opcode;
|
unsigned int in_numargs;
|
||||||
uint64_t nodeid;
|
struct fuse_in_arg in_args[3];
|
||||||
} h;
|
unsigned int out_argvar:1;
|
||||||
unsigned numargs;
|
unsigned int out_numargs;
|
||||||
struct fuse_in_arg args[3];
|
struct fuse_arg out_args[2];
|
||||||
|
|
||||||
} in;
|
|
||||||
struct {
|
|
||||||
unsigned argvar:1;
|
|
||||||
unsigned numargs;
|
|
||||||
struct fuse_arg args[2];
|
|
||||||
} out;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define FUSE_ARGS(args) struct fuse_args args = {}
|
#define FUSE_ARGS(args) struct fuse_args args = {}
|
||||||
|
@ -437,12 +437,12 @@ static int fuse_statfs(struct dentry *dentry, struct kstatfs *buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
memset(&outarg, 0, sizeof(outarg));
|
memset(&outarg, 0, sizeof(outarg));
|
||||||
args.in.numargs = 0;
|
args.in_numargs = 0;
|
||||||
args.in.h.opcode = FUSE_STATFS;
|
args.opcode = FUSE_STATFS;
|
||||||
args.in.h.nodeid = get_node_id(d_inode(dentry));
|
args.nodeid = get_node_id(d_inode(dentry));
|
||||||
args.out.numargs = 1;
|
args.out_numargs = 1;
|
||||||
args.out.args[0].size = sizeof(outarg);
|
args.out_args[0].size = sizeof(outarg);
|
||||||
args.out.args[0].value = &outarg;
|
args.out_args[0].value = &outarg;
|
||||||
err = fuse_simple_request(fc, &args);
|
err = fuse_simple_request(fc, &args);
|
||||||
if (!err)
|
if (!err)
|
||||||
convert_fuse_statfs(buf, &outarg.st);
|
convert_fuse_statfs(buf, &outarg.st);
|
||||||
|
@ -25,15 +25,15 @@ int fuse_setxattr(struct inode *inode, const char *name, const void *value,
|
|||||||
memset(&inarg, 0, sizeof(inarg));
|
memset(&inarg, 0, sizeof(inarg));
|
||||||
inarg.size = size;
|
inarg.size = size;
|
||||||
inarg.flags = flags;
|
inarg.flags = flags;
|
||||||
args.in.h.opcode = FUSE_SETXATTR;
|
args.opcode = FUSE_SETXATTR;
|
||||||
args.in.h.nodeid = get_node_id(inode);
|
args.nodeid = get_node_id(inode);
|
||||||
args.in.numargs = 3;
|
args.in_numargs = 3;
|
||||||
args.in.args[0].size = sizeof(inarg);
|
args.in_args[0].size = sizeof(inarg);
|
||||||
args.in.args[0].value = &inarg;
|
args.in_args[0].value = &inarg;
|
||||||
args.in.args[1].size = strlen(name) + 1;
|
args.in_args[1].size = strlen(name) + 1;
|
||||||
args.in.args[1].value = name;
|
args.in_args[1].value = name;
|
||||||
args.in.args[2].size = size;
|
args.in_args[2].size = size;
|
||||||
args.in.args[2].value = value;
|
args.in_args[2].value = value;
|
||||||
err = fuse_simple_request(fc, &args);
|
err = fuse_simple_request(fc, &args);
|
||||||
if (err == -ENOSYS) {
|
if (err == -ENOSYS) {
|
||||||
fc->no_setxattr = 1;
|
fc->no_setxattr = 1;
|
||||||
@ -60,22 +60,22 @@ ssize_t fuse_getxattr(struct inode *inode, const char *name, void *value,
|
|||||||
|
|
||||||
memset(&inarg, 0, sizeof(inarg));
|
memset(&inarg, 0, sizeof(inarg));
|
||||||
inarg.size = size;
|
inarg.size = size;
|
||||||
args.in.h.opcode = FUSE_GETXATTR;
|
args.opcode = FUSE_GETXATTR;
|
||||||
args.in.h.nodeid = get_node_id(inode);
|
args.nodeid = get_node_id(inode);
|
||||||
args.in.numargs = 2;
|
args.in_numargs = 2;
|
||||||
args.in.args[0].size = sizeof(inarg);
|
args.in_args[0].size = sizeof(inarg);
|
||||||
args.in.args[0].value = &inarg;
|
args.in_args[0].value = &inarg;
|
||||||
args.in.args[1].size = strlen(name) + 1;
|
args.in_args[1].size = strlen(name) + 1;
|
||||||
args.in.args[1].value = name;
|
args.in_args[1].value = name;
|
||||||
/* This is really two different operations rolled into one */
|
/* This is really two different operations rolled into one */
|
||||||
args.out.numargs = 1;
|
args.out_numargs = 1;
|
||||||
if (size) {
|
if (size) {
|
||||||
args.out.argvar = 1;
|
args.out_argvar = 1;
|
||||||
args.out.args[0].size = size;
|
args.out_args[0].size = size;
|
||||||
args.out.args[0].value = value;
|
args.out_args[0].value = value;
|
||||||
} else {
|
} else {
|
||||||
args.out.args[0].size = sizeof(outarg);
|
args.out_args[0].size = sizeof(outarg);
|
||||||
args.out.args[0].value = &outarg;
|
args.out_args[0].value = &outarg;
|
||||||
}
|
}
|
||||||
ret = fuse_simple_request(fc, &args);
|
ret = fuse_simple_request(fc, &args);
|
||||||
if (!ret && !size)
|
if (!ret && !size)
|
||||||
@ -121,20 +121,20 @@ ssize_t fuse_listxattr(struct dentry *entry, char *list, size_t size)
|
|||||||
|
|
||||||
memset(&inarg, 0, sizeof(inarg));
|
memset(&inarg, 0, sizeof(inarg));
|
||||||
inarg.size = size;
|
inarg.size = size;
|
||||||
args.in.h.opcode = FUSE_LISTXATTR;
|
args.opcode = FUSE_LISTXATTR;
|
||||||
args.in.h.nodeid = get_node_id(inode);
|
args.nodeid = get_node_id(inode);
|
||||||
args.in.numargs = 1;
|
args.in_numargs = 1;
|
||||||
args.in.args[0].size = sizeof(inarg);
|
args.in_args[0].size = sizeof(inarg);
|
||||||
args.in.args[0].value = &inarg;
|
args.in_args[0].value = &inarg;
|
||||||
/* This is really two different operations rolled into one */
|
/* This is really two different operations rolled into one */
|
||||||
args.out.numargs = 1;
|
args.out_numargs = 1;
|
||||||
if (size) {
|
if (size) {
|
||||||
args.out.argvar = 1;
|
args.out_argvar = 1;
|
||||||
args.out.args[0].size = size;
|
args.out_args[0].size = size;
|
||||||
args.out.args[0].value = list;
|
args.out_args[0].value = list;
|
||||||
} else {
|
} else {
|
||||||
args.out.args[0].size = sizeof(outarg);
|
args.out_args[0].size = sizeof(outarg);
|
||||||
args.out.args[0].value = &outarg;
|
args.out_args[0].value = &outarg;
|
||||||
}
|
}
|
||||||
ret = fuse_simple_request(fc, &args);
|
ret = fuse_simple_request(fc, &args);
|
||||||
if (!ret && !size)
|
if (!ret && !size)
|
||||||
@ -157,11 +157,11 @@ int fuse_removexattr(struct inode *inode, const char *name)
|
|||||||
if (fc->no_removexattr)
|
if (fc->no_removexattr)
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
args.in.h.opcode = FUSE_REMOVEXATTR;
|
args.opcode = FUSE_REMOVEXATTR;
|
||||||
args.in.h.nodeid = get_node_id(inode);
|
args.nodeid = get_node_id(inode);
|
||||||
args.in.numargs = 1;
|
args.in_numargs = 1;
|
||||||
args.in.args[0].size = strlen(name) + 1;
|
args.in_args[0].size = strlen(name) + 1;
|
||||||
args.in.args[0].value = name;
|
args.in_args[0].value = name;
|
||||||
err = fuse_simple_request(fc, &args);
|
err = fuse_simple_request(fc, &args);
|
||||||
if (err == -ENOSYS) {
|
if (err == -ENOSYS) {
|
||||||
fc->no_removexattr = 1;
|
fc->no_removexattr = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user