aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfsxdr.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2020-10-21 12:14:23 -0400
committerChuck Lever <chuck.lever@oracle.com>2021-01-25 09:36:25 -0500
commitebcd8e8b28535b643a4c06685bd363b3b73a96af (patch)
tree0b28de2cbdbfcae5ec91d8b068e52a0feae5cfb8 /fs/nfsd/nfsxdr.c
parentNFSD: Update the MKNOD3args decoder to use struct xdr_stream (diff)
downloadlinux-dev-ebcd8e8b28535b643a4c06685bd363b3b73a96af.tar.xz
linux-dev-ebcd8e8b28535b643a4c06685bd363b3b73a96af.zip
NFSD: Update the NFSv2 GETATTR argument decoder to use struct xdr_stream
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'fs/nfsd/nfsxdr.c')
-rw-r--r--fs/nfsd/nfsxdr.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c
index 7aa6e8aca2c1..f3189e1be20f 100644
--- a/fs/nfsd/nfsxdr.c
+++ b/fs/nfsd/nfsxdr.c
@@ -23,8 +23,9 @@ static u32 nfs_ftypes[] = {
/*
- * XDR functions for basic NFS types
+ * Basic NFSv2 data types (RFC 1094 Section 2.3)
*/
+
static __be32 *
decode_fh(__be32 *p, struct svc_fh *fhp)
{
@@ -37,6 +38,21 @@ decode_fh(__be32 *p, struct svc_fh *fhp)
return p + (NFS_FHSIZE >> 2);
}
+static bool
+svcxdr_decode_fhandle(struct xdr_stream *xdr, struct svc_fh *fhp)
+{
+ __be32 *p;
+
+ p = xdr_inline_decode(xdr, NFS_FHSIZE);
+ if (!p)
+ return false;
+ fh_init(fhp, NFS_FHSIZE);
+ memcpy(&fhp->fh_handle.fh_base, p, NFS_FHSIZE);
+ fhp->fh_handle.fh_size = NFS_FHSIZE;
+
+ return true;
+}
+
/* Helper function for NFSv2 ACL code */
__be32 *nfs2svc_decode_fh(__be32 *p, struct svc_fh *fhp)
{
@@ -194,14 +210,12 @@ __be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *f
*/
int
-nfssvc_decode_fhandle(struct svc_rqst *rqstp, __be32 *p)
+nfssvc_decode_fhandleargs(struct svc_rqst *rqstp, __be32 *p)
{
+ struct xdr_stream *xdr = &rqstp->rq_arg_stream;
struct nfsd_fhandle *args = rqstp->rq_argp;
- p = decode_fh(p, &args->fh);
- if (!p)
- return 0;
- return xdr_argsize_check(rqstp, p);
+ return svcxdr_decode_fhandle(xdr, &args->fh);
}
int