NFSv4: Clean up the NFSv4 setclientid operation
Reviewed-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
parent
d7cf8dd012
commit
bb8b27e504
6 changed files with 39 additions and 24 deletions
|
@ -1504,14 +1504,14 @@ static void encode_setclientid(struct xdr_stream *xdr, const struct nfs4_setclie
|
|||
hdr->replen += decode_setclientid_maxsz;
|
||||
}
|
||||
|
||||
static void encode_setclientid_confirm(struct xdr_stream *xdr, const struct nfs_client *client_state, struct compound_hdr *hdr)
|
||||
static void encode_setclientid_confirm(struct xdr_stream *xdr, const struct nfs4_setclientid_res *arg, struct compound_hdr *hdr)
|
||||
{
|
||||
__be32 *p;
|
||||
|
||||
p = reserve_space(xdr, 12 + NFS4_VERIFIER_SIZE);
|
||||
*p++ = cpu_to_be32(OP_SETCLIENTID_CONFIRM);
|
||||
p = xdr_encode_hyper(p, client_state->cl_clientid);
|
||||
xdr_encode_opaque_fixed(p, client_state->cl_confirm.data, NFS4_VERIFIER_SIZE);
|
||||
p = xdr_encode_hyper(p, arg->clientid);
|
||||
xdr_encode_opaque_fixed(p, arg->confirm.data, NFS4_VERIFIER_SIZE);
|
||||
hdr->nops++;
|
||||
hdr->replen += decode_setclientid_confirm_maxsz;
|
||||
}
|
||||
|
@ -2324,7 +2324,7 @@ static int nfs4_xdr_enc_setclientid(struct rpc_rqst *req, __be32 *p, struct nfs4
|
|||
/*
|
||||
* a SETCLIENTID_CONFIRM request
|
||||
*/
|
||||
static int nfs4_xdr_enc_setclientid_confirm(struct rpc_rqst *req, __be32 *p, struct nfs_client *clp)
|
||||
static int nfs4_xdr_enc_setclientid_confirm(struct rpc_rqst *req, __be32 *p, struct nfs4_setclientid_res *arg)
|
||||
{
|
||||
struct xdr_stream xdr;
|
||||
struct compound_hdr hdr = {
|
||||
|
@ -2334,7 +2334,7 @@ static int nfs4_xdr_enc_setclientid_confirm(struct rpc_rqst *req, __be32 *p, str
|
|||
|
||||
xdr_init_encode(&xdr, &req->rq_snd_buf, p);
|
||||
encode_compound_hdr(&xdr, req, &hdr);
|
||||
encode_setclientid_confirm(&xdr, clp, &hdr);
|
||||
encode_setclientid_confirm(&xdr, arg, &hdr);
|
||||
encode_putrootfh(&xdr, &hdr);
|
||||
encode_fsinfo(&xdr, lease_bitmap, &hdr);
|
||||
encode_nops(&hdr);
|
||||
|
@ -4397,7 +4397,7 @@ out_overflow:
|
|||
return -EIO;
|
||||
}
|
||||
|
||||
static int decode_setclientid(struct xdr_stream *xdr, struct nfs_client *clp)
|
||||
static int decode_setclientid(struct xdr_stream *xdr, struct nfs4_setclientid_res *res)
|
||||
{
|
||||
__be32 *p;
|
||||
uint32_t opnum;
|
||||
|
@ -4417,8 +4417,8 @@ static int decode_setclientid(struct xdr_stream *xdr, struct nfs_client *clp)
|
|||
p = xdr_inline_decode(xdr, 8 + NFS4_VERIFIER_SIZE);
|
||||
if (unlikely(!p))
|
||||
goto out_overflow;
|
||||
p = xdr_decode_hyper(p, &clp->cl_clientid);
|
||||
memcpy(clp->cl_confirm.data, p, NFS4_VERIFIER_SIZE);
|
||||
p = xdr_decode_hyper(p, &res->clientid);
|
||||
memcpy(res->confirm.data, p, NFS4_VERIFIER_SIZE);
|
||||
} else if (nfserr == NFSERR_CLID_INUSE) {
|
||||
uint32_t len;
|
||||
|
||||
|
@ -5498,7 +5498,7 @@ static int nfs4_xdr_dec_renew(struct rpc_rqst *rqstp, __be32 *p, void *dummy)
|
|||
* Decode SETCLIENTID response
|
||||
*/
|
||||
static int nfs4_xdr_dec_setclientid(struct rpc_rqst *req, __be32 *p,
|
||||
struct nfs_client *clp)
|
||||
struct nfs4_setclientid_res *res)
|
||||
{
|
||||
struct xdr_stream xdr;
|
||||
struct compound_hdr hdr;
|
||||
|
@ -5507,7 +5507,7 @@ static int nfs4_xdr_dec_setclientid(struct rpc_rqst *req, __be32 *p,
|
|||
xdr_init_decode(&xdr, &req->rq_rcv_buf, p);
|
||||
status = decode_compound_hdr(&xdr, &hdr);
|
||||
if (!status)
|
||||
status = decode_setclientid(&xdr, clp);
|
||||
status = decode_setclientid(&xdr, res);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue