Skip to content

Commit 0e5977a

Browse files
chuckleverJ. Bruce Fields
authored andcommitted
lockd: Update the NLMv4 LOCK arguments decoder to use struct xdr_stream
Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
1 parent 345b415 commit 0e5977a

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

fs/lockd/xdr4.c

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -264,35 +264,40 @@ nlm4svc_decode_testargs(struct svc_rqst *rqstp, __be32 *p)
264264
return 1;
265265
}
266266

267-
int
268-
nlm4svc_encode_testres(struct svc_rqst *rqstp, __be32 *p)
269-
{
270-
struct nlm_res *resp = rqstp->rq_resp;
271-
272-
if (!(p = nlm4_encode_testres(p, resp)))
273-
return 0;
274-
return xdr_ressize_check(rqstp, p);
275-
}
276-
277267
int
278268
nlm4svc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p)
279269
{
270+
struct xdr_stream *xdr = &rqstp->rq_arg_stream;
280271
struct nlm_args *argp = rqstp->rq_argp;
281-
u32 exclusive;
272+
u32 exclusive;
282273

283-
if (!(p = nlm4_decode_cookie(p, &argp->cookie)))
274+
if (!svcxdr_decode_cookie(xdr, &argp->cookie))
284275
return 0;
285-
argp->block = ntohl(*p++);
286-
exclusive = ntohl(*p++);
287-
if (!(p = nlm4_decode_lock(p, &argp->lock)))
276+
if (xdr_stream_decode_bool(xdr, &argp->block) < 0)
277+
return 0;
278+
if (xdr_stream_decode_bool(xdr, &exclusive) < 0)
279+
return 0;
280+
if (!svcxdr_decode_lock(xdr, &argp->lock))
288281
return 0;
289282
if (exclusive)
290283
argp->lock.fl.fl_type = F_WRLCK;
291-
argp->reclaim = ntohl(*p++);
292-
argp->state = ntohl(*p++);
284+
if (xdr_stream_decode_bool(xdr, &argp->reclaim) < 0)
285+
return 0;
286+
if (xdr_stream_decode_u32(xdr, &argp->state) < 0)
287+
return 0;
293288
argp->monitor = 1; /* monitor client by default */
294289

295-
return xdr_argsize_check(rqstp, p);
290+
return 1;
291+
}
292+
293+
int
294+
nlm4svc_encode_testres(struct svc_rqst *rqstp, __be32 *p)
295+
{
296+
struct nlm_res *resp = rqstp->rq_resp;
297+
298+
if (!(p = nlm4_encode_testres(p, resp)))
299+
return 0;
300+
return xdr_ressize_check(rqstp, p);
296301
}
297302

298303
int

0 commit comments

Comments
 (0)