NFSD: Add a helper to decode nfs_impl_id4
Refactor for clarity. Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
parent
523ec6ed6f
commit
10ff842281
@ -1558,12 +1558,47 @@ nfsd4_decode_state_protect4_a(struct nfsd4_compoundargs *argp,
|
|||||||
return nfs_ok;
|
return nfs_ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static __be32
|
||||||
|
nfsd4_decode_nfs_impl_id4(struct nfsd4_compoundargs *argp,
|
||||||
|
struct nfsd4_exchange_id *exid)
|
||||||
|
{
|
||||||
|
__be32 status;
|
||||||
|
u32 count;
|
||||||
|
|
||||||
|
if (xdr_stream_decode_u32(argp->xdr, &count) < 0)
|
||||||
|
return nfserr_bad_xdr;
|
||||||
|
switch (count) {
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
/* Note that RFC 8881 places no length limit on
|
||||||
|
* nii_domain, but this implementation permits no
|
||||||
|
* more than NFS4_OPAQUE_LIMIT bytes */
|
||||||
|
status = nfsd4_decode_opaque(argp, &exid->nii_domain);
|
||||||
|
if (status)
|
||||||
|
return status;
|
||||||
|
/* Note that RFC 8881 places no length limit on
|
||||||
|
* nii_name, but this implementation permits no
|
||||||
|
* more than NFS4_OPAQUE_LIMIT bytes */
|
||||||
|
status = nfsd4_decode_opaque(argp, &exid->nii_name);
|
||||||
|
if (status)
|
||||||
|
return status;
|
||||||
|
status = nfsd4_decode_nfstime4(argp, &exid->nii_time);
|
||||||
|
if (status)
|
||||||
|
return status;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return nfserr_bad_xdr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nfs_ok;
|
||||||
|
}
|
||||||
|
|
||||||
static __be32
|
static __be32
|
||||||
nfsd4_decode_exchange_id(struct nfsd4_compoundargs *argp,
|
nfsd4_decode_exchange_id(struct nfsd4_compoundargs *argp,
|
||||||
struct nfsd4_exchange_id *exid)
|
struct nfsd4_exchange_id *exid)
|
||||||
{
|
{
|
||||||
DECODE_HEAD;
|
__be32 status;
|
||||||
int dummy;
|
|
||||||
|
|
||||||
status = nfsd4_decode_verifier4(argp, &exid->verifier);
|
status = nfsd4_decode_verifier4(argp, &exid->verifier);
|
||||||
if (status)
|
if (status)
|
||||||
@ -1576,29 +1611,7 @@ nfsd4_decode_exchange_id(struct nfsd4_compoundargs *argp,
|
|||||||
status = nfsd4_decode_state_protect4_a(argp, exid);
|
status = nfsd4_decode_state_protect4_a(argp, exid);
|
||||||
if (status)
|
if (status)
|
||||||
return status;
|
return status;
|
||||||
|
return nfsd4_decode_nfs_impl_id4(argp, exid);
|
||||||
READ_BUF(4); /* nfs_impl_id4 array length */
|
|
||||||
dummy = be32_to_cpup(p++);
|
|
||||||
|
|
||||||
if (dummy > 1)
|
|
||||||
goto xdr_error;
|
|
||||||
|
|
||||||
if (dummy == 1) {
|
|
||||||
status = nfsd4_decode_opaque(argp, &exid->nii_domain);
|
|
||||||
if (status)
|
|
||||||
goto xdr_error;
|
|
||||||
|
|
||||||
/* nii_name */
|
|
||||||
status = nfsd4_decode_opaque(argp, &exid->nii_name);
|
|
||||||
if (status)
|
|
||||||
goto xdr_error;
|
|
||||||
|
|
||||||
/* nii_date */
|
|
||||||
status = nfsd4_decode_time(argp, &exid->nii_time);
|
|
||||||
if (status)
|
|
||||||
goto xdr_error;
|
|
||||||
}
|
|
||||||
DECODE_TAIL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static __be32
|
static __be32
|
||||||
|
Loading…
Reference in New Issue
Block a user