Skip to content

Commit 529ca3a

Browse files
chuckleverJ. Bruce Fields
authored andcommitted
lockd: Update the NLMv1 SHARE results encoder to use struct xdr_stream
Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
1 parent e96735a commit 529ca3a

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

fs/lockd/xdr.c

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,6 @@ loff_t_to_s32(loff_t offset)
4141
return res;
4242
}
4343

44-
/*
45-
* XDR functions for basic NLM types
46-
*/
47-
static inline __be32 *
48-
nlm_encode_cookie(__be32 *p, struct nlm_cookie *c)
49-
{
50-
*p++ = htonl(c->len);
51-
memcpy(p, c->data, c->len);
52-
p+=XDR_QUADLEN(c->len);
53-
return p;
54-
}
55-
5644
/*
5745
* NLM file handles are defined by specification to be a variable-length
5846
* XDR opaque no longer than 1024 bytes. However, this implementation
@@ -361,11 +349,16 @@ nlmsvc_encode_res(struct svc_rqst *rqstp, __be32 *p)
361349
int
362350
nlmsvc_encode_shareres(struct svc_rqst *rqstp, __be32 *p)
363351
{
352+
struct xdr_stream *xdr = &rqstp->rq_res_stream;
364353
struct nlm_res *resp = rqstp->rq_resp;
365354

366-
if (!(p = nlm_encode_cookie(p, &resp->cookie)))
355+
if (!svcxdr_encode_cookie(xdr, &resp->cookie))
367356
return 0;
368-
*p++ = resp->status;
369-
*p++ = xdr_zero; /* sequence argument */
370-
return xdr_ressize_check(rqstp, p);
357+
if (!svcxdr_encode_stats(xdr, resp->status))
358+
return 0;
359+
/* sequence */
360+
if (xdr_stream_encode_u32(xdr, 0) < 0)
361+
return 0;
362+
363+
return 1;
371364
}

0 commit comments

Comments
 (0)