Skip to content

Commit 0ff5b50

Browse files
chuckleverJ. Bruce Fields
authored andcommitted
lockd: Update the NLMv4 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 447c14d commit 0ff5b50

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

fs/lockd/xdr4.c

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,6 @@ loff_t_to_s64(loff_t offset)
4040
return res;
4141
}
4242

43-
static __be32 *
44-
nlm4_encode_cookie(__be32 *p, struct nlm_cookie *c)
45-
{
46-
*p++ = htonl(c->len);
47-
memcpy(p, c->data, c->len);
48-
p+=XDR_QUADLEN(c->len);
49-
return p;
50-
}
51-
5243
/*
5344
* NLM file handles are defined by specification to be a variable-length
5445
* XDR opaque no longer than 1024 bytes. However, this implementation
@@ -356,11 +347,16 @@ nlm4svc_encode_res(struct svc_rqst *rqstp, __be32 *p)
356347
int
357348
nlm4svc_encode_shareres(struct svc_rqst *rqstp, __be32 *p)
358349
{
350+
struct xdr_stream *xdr = &rqstp->rq_res_stream;
359351
struct nlm_res *resp = rqstp->rq_resp;
360352

361-
if (!(p = nlm4_encode_cookie(p, &resp->cookie)))
353+
if (!svcxdr_encode_cookie(xdr, &resp->cookie))
362354
return 0;
363-
*p++ = resp->status;
364-
*p++ = xdr_zero; /* sequence argument */
365-
return xdr_ressize_check(rqstp, p);
355+
if (!svcxdr_encode_stats(xdr, resp->status))
356+
return 0;
357+
/* sequence */
358+
if (xdr_stream_encode_u32(xdr, 0) < 0)
359+
return 0;
360+
361+
return 1;
366362
}

0 commit comments

Comments
 (0)