diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2010-12-14 09:59:29 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-12-16 12:37:25 -0500 |
commit | bf2695516db982e90a22fc94f93491b481796bb1 (patch) | |
tree | 367bf134ef892bfc3fcd2c4fe676b14102d97467 /fs/nfs/mount_clnt.c | |
parent | 9f06c719f474be7003763284a990bed6377bb0d4 (diff) |
SUNRPC: New xdr_streams XDR decoder API
Now that all client-side XDR decoder routines use xdr_streams, there
should be no need to support the legacy calling sequence [rpc_rqst *,
__be32 *, RPC res *] anywhere. We can construct an xdr_stream in the
generic RPC code, instead of in each decoder function.
This is a refactoring change. It should not cause different behavior.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Tested-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/mount_clnt.c')
-rw-r--r-- | fs/nfs/mount_clnt.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/fs/nfs/mount_clnt.c b/fs/nfs/mount_clnt.c index 979ebd7af3cb..697e07235f30 100644 --- a/fs/nfs/mount_clnt.c +++ b/fs/nfs/mount_clnt.c | |||
@@ -340,18 +340,16 @@ static int decode_fhandle(struct xdr_stream *xdr, struct mountres *res) | |||
340 | return 0; | 340 | return 0; |
341 | } | 341 | } |
342 | 342 | ||
343 | static int mnt_dec_mountres(struct rpc_rqst *req, __be32 *p, | 343 | static int mnt_xdr_dec_mountres(struct rpc_rqst *req, |
344 | struct mountres *res) | 344 | struct xdr_stream *xdr, |
345 | struct mountres *res) | ||
345 | { | 346 | { |
346 | struct xdr_stream xdr; | ||
347 | int status; | 347 | int status; |
348 | 348 | ||
349 | xdr_init_decode(&xdr, &req->rq_rcv_buf, p); | 349 | status = decode_status(xdr, res); |
350 | |||
351 | status = decode_status(&xdr, res); | ||
352 | if (unlikely(status != 0 || res->errno != 0)) | 350 | if (unlikely(status != 0 || res->errno != 0)) |
353 | return status; | 351 | return status; |
354 | return decode_fhandle(&xdr, res); | 352 | return decode_fhandle(xdr, res); |
355 | } | 353 | } |
356 | 354 | ||
357 | static int decode_fhs_status(struct xdr_stream *xdr, struct mountres *res) | 355 | static int decode_fhs_status(struct xdr_stream *xdr, struct mountres *res) |
@@ -434,30 +432,28 @@ static int decode_auth_flavors(struct xdr_stream *xdr, struct mountres *res) | |||
434 | return 0; | 432 | return 0; |
435 | } | 433 | } |
436 | 434 | ||
437 | static int mnt_dec_mountres3(struct rpc_rqst *req, __be32 *p, | 435 | static int mnt_xdr_dec_mountres3(struct rpc_rqst *req, |
438 | struct mountres *res) | 436 | struct xdr_stream *xdr, |
437 | struct mountres *res) | ||
439 | { | 438 | { |
440 | struct xdr_stream xdr; | ||
441 | int status; | 439 | int status; |
442 | 440 | ||
443 | xdr_init_decode(&xdr, &req->rq_rcv_buf, p); | 441 | status = decode_fhs_status(xdr, res); |
444 | |||
445 | status = decode_fhs_status(&xdr, res); | ||
446 | if (unlikely(status != 0 || res->errno != 0)) | 442 | if (unlikely(status != 0 || res->errno != 0)) |
447 | return status; | 443 | return status; |
448 | status = decode_fhandle3(&xdr, res); | 444 | status = decode_fhandle3(xdr, res); |
449 | if (unlikely(status != 0)) { | 445 | if (unlikely(status != 0)) { |
450 | res->errno = -EBADHANDLE; | 446 | res->errno = -EBADHANDLE; |
451 | return 0; | 447 | return 0; |
452 | } | 448 | } |
453 | return decode_auth_flavors(&xdr, res); | 449 | return decode_auth_flavors(xdr, res); |
454 | } | 450 | } |
455 | 451 | ||
456 | static struct rpc_procinfo mnt_procedures[] = { | 452 | static struct rpc_procinfo mnt_procedures[] = { |
457 | [MOUNTPROC_MNT] = { | 453 | [MOUNTPROC_MNT] = { |
458 | .p_proc = MOUNTPROC_MNT, | 454 | .p_proc = MOUNTPROC_MNT, |
459 | .p_encode = (kxdreproc_t)mnt_xdr_enc_dirpath, | 455 | .p_encode = (kxdreproc_t)mnt_xdr_enc_dirpath, |
460 | .p_decode = (kxdrproc_t)mnt_dec_mountres, | 456 | .p_decode = (kxdrdproc_t)mnt_xdr_dec_mountres, |
461 | .p_arglen = MNT_enc_dirpath_sz, | 457 | .p_arglen = MNT_enc_dirpath_sz, |
462 | .p_replen = MNT_dec_mountres_sz, | 458 | .p_replen = MNT_dec_mountres_sz, |
463 | .p_statidx = MOUNTPROC_MNT, | 459 | .p_statidx = MOUNTPROC_MNT, |
@@ -476,7 +472,7 @@ static struct rpc_procinfo mnt3_procedures[] = { | |||
476 | [MOUNTPROC3_MNT] = { | 472 | [MOUNTPROC3_MNT] = { |
477 | .p_proc = MOUNTPROC3_MNT, | 473 | .p_proc = MOUNTPROC3_MNT, |
478 | .p_encode = (kxdreproc_t)mnt_xdr_enc_dirpath, | 474 | .p_encode = (kxdreproc_t)mnt_xdr_enc_dirpath, |
479 | .p_decode = (kxdrproc_t)mnt_dec_mountres3, | 475 | .p_decode = (kxdrdproc_t)mnt_xdr_dec_mountres3, |
480 | .p_arglen = MNT_enc_dirpath_sz, | 476 | .p_arglen = MNT_enc_dirpath_sz, |
481 | .p_replen = MNT_dec_mountres3_sz, | 477 | .p_replen = MNT_dec_mountres3_sz, |
482 | .p_statidx = MOUNTPROC3_MNT, | 478 | .p_statidx = MOUNTPROC3_MNT, |