Commit 920769f0 authored by Jeff Layton's avatar Jeff Layton Committed by Trond Myklebust

nfs: standardize the rename args container

Each NFS version has its own version of the rename args container.
Standardize them on a common one that's identical to the one NFSv4
uses.
Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
Reviewed-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 2b484297
...@@ -337,10 +337,10 @@ nfs_xdr_createargs(struct rpc_rqst *req, __be32 *p, struct nfs_createargs *args) ...@@ -337,10 +337,10 @@ nfs_xdr_createargs(struct rpc_rqst *req, __be32 *p, struct nfs_createargs *args)
static int static int
nfs_xdr_renameargs(struct rpc_rqst *req, __be32 *p, struct nfs_renameargs *args) nfs_xdr_renameargs(struct rpc_rqst *req, __be32 *p, struct nfs_renameargs *args)
{ {
p = xdr_encode_fhandle(p, args->fromfh); p = xdr_encode_fhandle(p, args->old_dir);
p = xdr_encode_array(p, args->fromname, args->fromlen); p = xdr_encode_array(p, args->old_name->name, args->old_name->len);
p = xdr_encode_fhandle(p, args->tofh); p = xdr_encode_fhandle(p, args->new_dir);
p = xdr_encode_array(p, args->toname, args->tolen); p = xdr_encode_array(p, args->new_name->name, args->new_name->len);
req->rq_slen = xdr_adjust_iovec(req->rq_svec, p); req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
return 0; return 0;
} }
......
...@@ -442,13 +442,11 @@ static int ...@@ -442,13 +442,11 @@ static int
nfs3_proc_rename(struct inode *old_dir, struct qstr *old_name, nfs3_proc_rename(struct inode *old_dir, struct qstr *old_name,
struct inode *new_dir, struct qstr *new_name) struct inode *new_dir, struct qstr *new_name)
{ {
struct nfs3_renameargs arg = { struct nfs_renameargs arg = {
.fromfh = NFS_FH(old_dir), .old_dir = NFS_FH(old_dir),
.fromname = old_name->name, .old_name = old_name,
.fromlen = old_name->len, .new_dir = NFS_FH(new_dir),
.tofh = NFS_FH(new_dir), .new_name = new_name,
.toname = new_name->name,
.tolen = new_name->len
}; };
struct nfs3_renameres res; struct nfs3_renameres res;
struct rpc_message msg = { struct rpc_message msg = {
......
...@@ -442,12 +442,12 @@ nfs3_xdr_mknodargs(struct rpc_rqst *req, __be32 *p, struct nfs3_mknodargs *args) ...@@ -442,12 +442,12 @@ nfs3_xdr_mknodargs(struct rpc_rqst *req, __be32 *p, struct nfs3_mknodargs *args)
* Encode RENAME arguments * Encode RENAME arguments
*/ */
static int static int
nfs3_xdr_renameargs(struct rpc_rqst *req, __be32 *p, struct nfs3_renameargs *args) nfs3_xdr_renameargs(struct rpc_rqst *req, __be32 *p, struct nfs_renameargs *args)
{ {
p = xdr_encode_fhandle(p, args->fromfh); p = xdr_encode_fhandle(p, args->old_dir);
p = xdr_encode_array(p, args->fromname, args->fromlen); p = xdr_encode_array(p, args->old_name->name, args->old_name->len);
p = xdr_encode_fhandle(p, args->tofh); p = xdr_encode_fhandle(p, args->new_dir);
p = xdr_encode_array(p, args->toname, args->tolen); p = xdr_encode_array(p, args->new_name->name, args->new_name->len);
req->rq_slen = xdr_adjust_iovec(req->rq_svec, p); req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
return 0; return 0;
} }
......
...@@ -2570,7 +2570,7 @@ static int _nfs4_proc_rename(struct inode *old_dir, struct qstr *old_name, ...@@ -2570,7 +2570,7 @@ static int _nfs4_proc_rename(struct inode *old_dir, struct qstr *old_name,
struct inode *new_dir, struct qstr *new_name) struct inode *new_dir, struct qstr *new_name)
{ {
struct nfs_server *server = NFS_SERVER(old_dir); struct nfs_server *server = NFS_SERVER(old_dir);
struct nfs4_rename_arg arg = { struct nfs_renameargs arg = {
.old_dir = NFS_FH(old_dir), .old_dir = NFS_FH(old_dir),
.new_dir = NFS_FH(new_dir), .new_dir = NFS_FH(new_dir),
.old_name = old_name, .old_name = old_name,
......
...@@ -1823,7 +1823,7 @@ static int nfs4_xdr_enc_remove(struct rpc_rqst *req, __be32 *p, const struct nfs ...@@ -1823,7 +1823,7 @@ static int nfs4_xdr_enc_remove(struct rpc_rqst *req, __be32 *p, const struct nfs
/* /*
* Encode RENAME request * Encode RENAME request
*/ */
static int nfs4_xdr_enc_rename(struct rpc_rqst *req, __be32 *p, const struct nfs4_rename_arg *args) static int nfs4_xdr_enc_rename(struct rpc_rqst *req, __be32 *p, const struct nfs_renameargs *args)
{ {
struct xdr_stream xdr; struct xdr_stream xdr;
struct compound_hdr hdr = { struct compound_hdr hdr = {
......
...@@ -370,12 +370,10 @@ nfs_proc_rename(struct inode *old_dir, struct qstr *old_name, ...@@ -370,12 +370,10 @@ nfs_proc_rename(struct inode *old_dir, struct qstr *old_name,
struct inode *new_dir, struct qstr *new_name) struct inode *new_dir, struct qstr *new_name)
{ {
struct nfs_renameargs arg = { struct nfs_renameargs arg = {
.fromfh = NFS_FH(old_dir), .old_dir = NFS_FH(old_dir),
.fromname = old_name->name, .old_name = old_name,
.fromlen = old_name->len, .new_dir = NFS_FH(new_dir),
.tofh = NFS_FH(new_dir), .new_name = new_name,
.toname = new_name->name,
.tolen = new_name->len
}; };
struct rpc_message msg = { struct rpc_message msg = {
.rpc_proc = &nfs_procedures[NFSPROC_RENAME], .rpc_proc = &nfs_procedures[NFSPROC_RENAME],
......
...@@ -399,6 +399,18 @@ struct nfs_removeres { ...@@ -399,6 +399,18 @@ struct nfs_removeres {
struct nfs4_sequence_res seq_res; struct nfs4_sequence_res seq_res;
}; };
/*
* Common arguments to the rename call
*/
struct nfs_renameargs {
const struct nfs_fh *old_dir;
const struct nfs_fh *new_dir;
const struct qstr *old_name;
const struct qstr *new_name;
const u32 *bitmask;
struct nfs4_sequence_args seq_args;
};
/* /*
* Argument struct for decode_entry function * Argument struct for decode_entry function
*/ */
...@@ -434,15 +446,6 @@ struct nfs_createargs { ...@@ -434,15 +446,6 @@ struct nfs_createargs {
struct iattr * sattr; struct iattr * sattr;
}; };
struct nfs_renameargs {
struct nfs_fh * fromfh;
const char * fromname;
unsigned int fromlen;
struct nfs_fh * tofh;
const char * toname;
unsigned int tolen;
};
struct nfs_setattrargs { struct nfs_setattrargs {
struct nfs_fh * fh; struct nfs_fh * fh;
nfs4_stateid stateid; nfs4_stateid stateid;
...@@ -586,15 +589,6 @@ struct nfs3_mknodargs { ...@@ -586,15 +589,6 @@ struct nfs3_mknodargs {
dev_t rdev; dev_t rdev;
}; };
struct nfs3_renameargs {
struct nfs_fh * fromfh;
const char * fromname;
unsigned int fromlen;
struct nfs_fh * tofh;
const char * toname;
unsigned int tolen;
};
struct nfs3_linkargs { struct nfs3_linkargs {
struct nfs_fh * fromfh; struct nfs_fh * fromfh;
struct nfs_fh * tofh; struct nfs_fh * tofh;
...@@ -801,15 +795,6 @@ struct nfs4_readlink_res { ...@@ -801,15 +795,6 @@ struct nfs4_readlink_res {
struct nfs4_sequence_res seq_res; struct nfs4_sequence_res seq_res;
}; };
struct nfs4_rename_arg {
const struct nfs_fh * old_dir;
const struct nfs_fh * new_dir;
const struct qstr * old_name;
const struct qstr * new_name;
const u32 * bitmask;
struct nfs4_sequence_args seq_args;
};
struct nfs4_rename_res { struct nfs4_rename_res {
const struct nfs_server * server; const struct nfs_server * server;
struct nfs4_change_info old_cinfo; struct nfs4_change_info old_cinfo;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment