mirror of https://gitee.com/openkylin/linux.git
NFSD: Add helper to decode OPEN's openflag4 argument
Refactor for clarity. Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
parent
bf33bab3c4
commit
e6ec04b27b
|
@ -988,6 +988,28 @@ nfsd4_decode_createhow4(struct nfsd4_compoundargs *argp, struct nfsd4_open *open
|
||||||
return nfs_ok;
|
return nfs_ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static __be32
|
||||||
|
nfsd4_decode_openflag4(struct nfsd4_compoundargs *argp, struct nfsd4_open *open)
|
||||||
|
{
|
||||||
|
__be32 status;
|
||||||
|
|
||||||
|
if (xdr_stream_decode_u32(argp->xdr, &open->op_create) < 0)
|
||||||
|
return nfserr_bad_xdr;
|
||||||
|
switch (open->op_create) {
|
||||||
|
case NFS4_OPEN_NOCREATE:
|
||||||
|
break;
|
||||||
|
case NFS4_OPEN_CREATE:
|
||||||
|
status = nfsd4_decode_createhow4(argp, open);
|
||||||
|
if (status)
|
||||||
|
return status;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return nfserr_bad_xdr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nfs_ok;
|
||||||
|
}
|
||||||
|
|
||||||
static __be32 nfsd4_decode_share_access(struct nfsd4_compoundargs *argp, u32 *share_access, u32 *deleg_want, u32 *deleg_when)
|
static __be32 nfsd4_decode_share_access(struct nfsd4_compoundargs *argp, u32 *share_access, u32 *deleg_want, u32 *deleg_when)
|
||||||
{
|
{
|
||||||
__be32 *p;
|
__be32 *p;
|
||||||
|
@ -1082,19 +1104,9 @@ nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open)
|
||||||
status = nfsd4_decode_opaque(argp, &open->op_owner);
|
status = nfsd4_decode_opaque(argp, &open->op_owner);
|
||||||
if (status)
|
if (status)
|
||||||
goto xdr_error;
|
goto xdr_error;
|
||||||
READ_BUF(4);
|
status = nfsd4_decode_openflag4(argp, open);
|
||||||
open->op_create = be32_to_cpup(p++);
|
|
||||||
switch (open->op_create) {
|
|
||||||
case NFS4_OPEN_NOCREATE:
|
|
||||||
break;
|
|
||||||
case NFS4_OPEN_CREATE:
|
|
||||||
status = nfsd4_decode_createhow4(argp, open);
|
|
||||||
if (status)
|
if (status)
|
||||||
return status;
|
return status;
|
||||||
break;
|
|
||||||
default:
|
|
||||||
goto xdr_error;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* open_claim */
|
/* open_claim */
|
||||||
READ_BUF(4);
|
READ_BUF(4);
|
||||||
|
|
Loading…
Reference in New Issue