summaryrefslogtreecommitdiff
path: root/fs/nfsd/nfsxdr.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2020-10-23 18:08:02 +0300
committerChuck Lever <chuck.lever@oracle.com>2021-03-22 17:18:57 +0300
commita887eaed2a964754334cd3f8c5fe87e413e68fef (patch)
tree8c776143cc69b7d7ed8adf0a92582968ebf22d8a /fs/nfsd/nfsxdr.c
parent76ed0dd96eeb2771b21bf5dcbd88326ef89ee0ed (diff)
downloadlinux-a887eaed2a964754334cd3f8c5fe87e413e68fef.tar.xz
NFSD: Update the NFSv2 stat encoder 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.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c
index 5d79ef6a0c7f..10cd120044b3 100644
--- a/fs/nfsd/nfsxdr.c
+++ b/fs/nfsd/nfsxdr.c
@@ -26,6 +26,19 @@ static u32 nfs_ftypes[] = {
* Basic NFSv2 data types (RFC 1094 Section 2.3)
*/
+static bool
+svcxdr_encode_stat(struct xdr_stream *xdr, __be32 status)
+{
+ __be32 *p;
+
+ p = xdr_reserve_space(xdr, sizeof(status));
+ if (!p)
+ return false;
+ *p = status;
+
+ return true;
+}
+
/**
* svcxdr_decode_fhandle - Decode an NFSv2 file handle
* @xdr: XDR stream positioned at an encoded NFSv2 FH
@@ -390,12 +403,12 @@ nfssvc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p)
*/
int
-nfssvc_encode_stat(struct svc_rqst *rqstp, __be32 *p)
+nfssvc_encode_statres(struct svc_rqst *rqstp, __be32 *p)
{
+ struct xdr_stream *xdr = &rqstp->rq_res_stream;
struct nfsd_stat *resp = rqstp->rq_resp;
- *p++ = resp->status;
- return xdr_ressize_check(rqstp, p);
+ return svcxdr_encode_stat(xdr, resp->status);
}
int