diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2010-12-14 09:59:18 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-12-16 12:37:25 -0500 |
commit | 9f06c719f474be7003763284a990bed6377bb0d4 (patch) | |
tree | 409ebc3505f943bfdb933ab0acd76ffb5347b372 | |
parent | 1ac7c23e4af5e83525137661595000099f1ce94f (diff) |
SUNRPC: New xdr_streams XDR encoder API
Now that all client-side XDR encoder routines use xdr_streams, there
should be no need to support the legacy calling sequence [rpc_rqst *,
__be32 *, RPC arg *] anywhere. We can construct an xdr_stream in the
generic RPC code, instead of in each encoder function.
Also, all the client-side encoder functions return 0 now, making a
return value superfluous. Take this opportunity to convert them to
return void instead.
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>
-rw-r--r-- | fs/lockd/clnt4xdr.c | 92 | ||||
-rw-r--r-- | fs/lockd/clntxdr.c | 92 | ||||
-rw-r--r-- | fs/lockd/mon.c | 26 | ||||
-rw-r--r-- | fs/nfs/mount_clnt.c | 18 | ||||
-rw-r--r-- | fs/nfs/nfs2xdr.c | 147 | ||||
-rw-r--r-- | fs/nfs/nfs3xdr.c | 241 | ||||
-rw-r--r-- | fs/nfs/nfs4xdr.c | 663 | ||||
-rw-r--r-- | fs/nfsd/nfs4callback.c | 22 | ||||
-rw-r--r-- | include/linux/sunrpc/auth.h | 4 | ||||
-rw-r--r-- | include/linux/sunrpc/clnt.h | 2 | ||||
-rw-r--r-- | include/linux/sunrpc/xdr.h | 9 | ||||
-rw-r--r-- | net/sunrpc/auth.c | 14 | ||||
-rw-r--r-- | net/sunrpc/auth_gss/auth_gss.c | 31 | ||||
-rw-r--r-- | net/sunrpc/clnt.c | 5 | ||||
-rw-r--r-- | net/sunrpc/rpcb_clnt.c | 47 |
15 files changed, 606 insertions, 807 deletions
diff --git a/fs/lockd/clnt4xdr.c b/fs/lockd/clnt4xdr.c index 1a1c3e21ed2c..974f1d9cd323 100644 --- a/fs/lockd/clnt4xdr.c +++ b/fs/lockd/clnt4xdr.c | |||
@@ -385,17 +385,15 @@ static void encode_nlm4_lock(struct xdr_stream *xdr, | |||
385 | * struct nlm4_lock alock; | 385 | * struct nlm4_lock alock; |
386 | * }; | 386 | * }; |
387 | */ | 387 | */ |
388 | static int nlm4_xdr_enc_testargs(struct rpc_rqst *req, __be32 *p, | 388 | static void nlm4_xdr_enc_testargs(struct rpc_rqst *req, |
389 | const struct nlm_args *args) | 389 | struct xdr_stream *xdr, |
390 | const struct nlm_args *args) | ||
390 | { | 391 | { |
391 | const struct nlm_lock *lock = &args->lock; | 392 | const struct nlm_lock *lock = &args->lock; |
392 | struct xdr_stream xdr; | ||
393 | 393 | ||
394 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 394 | encode_cookie(xdr, &args->cookie); |
395 | encode_cookie(&xdr, &args->cookie); | 395 | encode_bool(xdr, lock->fl.fl_type == F_WRLCK); |
396 | encode_bool(&xdr, lock->fl.fl_type == F_WRLCK); | 396 | encode_nlm4_lock(xdr, lock); |
397 | encode_nlm4_lock(&xdr, lock); | ||
398 | return 0; | ||
399 | } | 397 | } |
400 | 398 | ||
401 | /* | 399 | /* |
@@ -408,20 +406,18 @@ static int nlm4_xdr_enc_testargs(struct rpc_rqst *req, __be32 *p, | |||
408 | * int state; | 406 | * int state; |
409 | * }; | 407 | * }; |
410 | */ | 408 | */ |
411 | static int nlm4_xdr_enc_lockargs(struct rpc_rqst *req, __be32 *p, | 409 | static void nlm4_xdr_enc_lockargs(struct rpc_rqst *req, |
412 | const struct nlm_args *args) | 410 | struct xdr_stream *xdr, |
411 | const struct nlm_args *args) | ||
413 | { | 412 | { |
414 | const struct nlm_lock *lock = &args->lock; | 413 | const struct nlm_lock *lock = &args->lock; |
415 | struct xdr_stream xdr; | ||
416 | 414 | ||
417 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 415 | encode_cookie(xdr, &args->cookie); |
418 | encode_cookie(&xdr, &args->cookie); | 416 | encode_bool(xdr, args->block); |
419 | encode_bool(&xdr, args->block); | 417 | encode_bool(xdr, lock->fl.fl_type == F_WRLCK); |
420 | encode_bool(&xdr, lock->fl.fl_type == F_WRLCK); | 418 | encode_nlm4_lock(xdr, lock); |
421 | encode_nlm4_lock(&xdr, lock); | 419 | encode_bool(xdr, args->reclaim); |
422 | encode_bool(&xdr, args->reclaim); | 420 | encode_int32(xdr, args->state); |
423 | encode_int32(&xdr, args->state); | ||
424 | return 0; | ||
425 | } | 421 | } |
426 | 422 | ||
427 | /* | 423 | /* |
@@ -432,18 +428,16 @@ static int nlm4_xdr_enc_lockargs(struct rpc_rqst *req, __be32 *p, | |||
432 | * struct nlm4_lock alock; | 428 | * struct nlm4_lock alock; |
433 | * }; | 429 | * }; |
434 | */ | 430 | */ |
435 | static int nlm4_xdr_enc_cancargs(struct rpc_rqst *req, __be32 *p, | 431 | static void nlm4_xdr_enc_cancargs(struct rpc_rqst *req, |
436 | const struct nlm_args *args) | 432 | struct xdr_stream *xdr, |
433 | const struct nlm_args *args) | ||
437 | { | 434 | { |
438 | const struct nlm_lock *lock = &args->lock; | 435 | const struct nlm_lock *lock = &args->lock; |
439 | struct xdr_stream xdr; | ||
440 | 436 | ||
441 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 437 | encode_cookie(xdr, &args->cookie); |
442 | encode_cookie(&xdr, &args->cookie); | 438 | encode_bool(xdr, args->block); |
443 | encode_bool(&xdr, args->block); | 439 | encode_bool(xdr, lock->fl.fl_type == F_WRLCK); |
444 | encode_bool(&xdr, lock->fl.fl_type == F_WRLCK); | 440 | encode_nlm4_lock(xdr, lock); |
445 | encode_nlm4_lock(&xdr, lock); | ||
446 | return 0; | ||
447 | } | 441 | } |
448 | 442 | ||
449 | /* | 443 | /* |
@@ -452,16 +446,14 @@ static int nlm4_xdr_enc_cancargs(struct rpc_rqst *req, __be32 *p, | |||
452 | * struct nlm4_lock alock; | 446 | * struct nlm4_lock alock; |
453 | * }; | 447 | * }; |
454 | */ | 448 | */ |
455 | static int nlm4_xdr_enc_unlockargs(struct rpc_rqst *req, __be32 *p, | 449 | static void nlm4_xdr_enc_unlockargs(struct rpc_rqst *req, |
456 | const struct nlm_args *args) | 450 | struct xdr_stream *xdr, |
451 | const struct nlm_args *args) | ||
457 | { | 452 | { |
458 | const struct nlm_lock *lock = &args->lock; | 453 | const struct nlm_lock *lock = &args->lock; |
459 | struct xdr_stream xdr; | ||
460 | 454 | ||
461 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 455 | encode_cookie(xdr, &args->cookie); |
462 | encode_cookie(&xdr, &args->cookie); | 456 | encode_nlm4_lock(xdr, lock); |
463 | encode_nlm4_lock(&xdr, lock); | ||
464 | return 0; | ||
465 | } | 457 | } |
466 | 458 | ||
467 | /* | 459 | /* |
@@ -470,15 +462,12 @@ static int nlm4_xdr_enc_unlockargs(struct rpc_rqst *req, __be32 *p, | |||
470 | * nlm4_stat stat; | 462 | * nlm4_stat stat; |
471 | * }; | 463 | * }; |
472 | */ | 464 | */ |
473 | static int nlm4_xdr_enc_res(struct rpc_rqst *req, __be32 *p, | 465 | static void nlm4_xdr_enc_res(struct rpc_rqst *req, |
474 | const struct nlm_res *result) | 466 | struct xdr_stream *xdr, |
467 | const struct nlm_res *result) | ||
475 | { | 468 | { |
476 | struct xdr_stream xdr; | 469 | encode_cookie(xdr, &result->cookie); |
477 | 470 | encode_nlm4_stat(xdr, result->status); | |
478 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
479 | encode_cookie(&xdr, &result->cookie); | ||
480 | encode_nlm4_stat(&xdr, result->status); | ||
481 | return 0; | ||
482 | } | 471 | } |
483 | 472 | ||
484 | /* | 473 | /* |
@@ -494,17 +483,14 @@ static int nlm4_xdr_enc_res(struct rpc_rqst *req, __be32 *p, | |||
494 | * nlm4_testrply test_stat; | 483 | * nlm4_testrply test_stat; |
495 | * }; | 484 | * }; |
496 | */ | 485 | */ |
497 | static int nlm4_xdr_enc_testres(struct rpc_rqst *req, __be32 *p, | 486 | static void nlm4_xdr_enc_testres(struct rpc_rqst *req, |
498 | const struct nlm_res *result) | 487 | struct xdr_stream *xdr, |
488 | const struct nlm_res *result) | ||
499 | { | 489 | { |
500 | struct xdr_stream xdr; | 490 | encode_cookie(xdr, &result->cookie); |
501 | 491 | encode_nlm4_stat(xdr, result->status); | |
502 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
503 | encode_cookie(&xdr, &result->cookie); | ||
504 | encode_nlm4_stat(&xdr, result->status); | ||
505 | if (result->status == nlm_lck_denied) | 492 | if (result->status == nlm_lck_denied) |
506 | encode_nlm4_holder(&xdr, result); | 493 | encode_nlm4_holder(xdr, result); |
507 | return 0; | ||
508 | } | 494 | } |
509 | 495 | ||
510 | 496 | ||
@@ -588,7 +574,7 @@ out: | |||
588 | #define PROC(proc, argtype, restype) \ | 574 | #define PROC(proc, argtype, restype) \ |
589 | [NLMPROC_##proc] = { \ | 575 | [NLMPROC_##proc] = { \ |
590 | .p_proc = NLMPROC_##proc, \ | 576 | .p_proc = NLMPROC_##proc, \ |
591 | .p_encode = (kxdrproc_t)nlm4_xdr_enc_##argtype, \ | 577 | .p_encode = (kxdreproc_t)nlm4_xdr_enc_##argtype, \ |
592 | .p_decode = (kxdrproc_t)nlm4_xdr_dec_##restype, \ | 578 | .p_decode = (kxdrproc_t)nlm4_xdr_dec_##restype, \ |
593 | .p_arglen = NLM4_##argtype##_sz, \ | 579 | .p_arglen = NLM4_##argtype##_sz, \ |
594 | .p_replen = NLM4_##restype##_sz, \ | 580 | .p_replen = NLM4_##restype##_sz, \ |
diff --git a/fs/lockd/clntxdr.c b/fs/lockd/clntxdr.c index 0472f2aff509..c6fda8fb1c5b 100644 --- a/fs/lockd/clntxdr.c +++ b/fs/lockd/clntxdr.c | |||
@@ -378,17 +378,15 @@ static void encode_nlm_lock(struct xdr_stream *xdr, | |||
378 | * struct nlm_lock alock; | 378 | * struct nlm_lock alock; |
379 | * }; | 379 | * }; |
380 | */ | 380 | */ |
381 | static int nlm_xdr_enc_testargs(struct rpc_rqst *req, __be32 *p, | 381 | static void nlm_xdr_enc_testargs(struct rpc_rqst *req, |
382 | const struct nlm_args *args) | 382 | struct xdr_stream *xdr, |
383 | const struct nlm_args *args) | ||
383 | { | 384 | { |
384 | const struct nlm_lock *lock = &args->lock; | 385 | const struct nlm_lock *lock = &args->lock; |
385 | struct xdr_stream xdr; | ||
386 | 386 | ||
387 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 387 | encode_cookie(xdr, &args->cookie); |
388 | encode_cookie(&xdr, &args->cookie); | 388 | encode_bool(xdr, lock->fl.fl_type == F_WRLCK); |
389 | encode_bool(&xdr, lock->fl.fl_type == F_WRLCK); | 389 | encode_nlm_lock(xdr, lock); |
390 | encode_nlm_lock(&xdr, lock); | ||
391 | return 0; | ||
392 | } | 390 | } |
393 | 391 | ||
394 | /* | 392 | /* |
@@ -401,20 +399,18 @@ static int nlm_xdr_enc_testargs(struct rpc_rqst *req, __be32 *p, | |||
401 | * int state; | 399 | * int state; |
402 | * }; | 400 | * }; |
403 | */ | 401 | */ |
404 | static int nlm_xdr_enc_lockargs(struct rpc_rqst *req, __be32 *p, | 402 | static void nlm_xdr_enc_lockargs(struct rpc_rqst *req, |
405 | const struct nlm_args *args) | 403 | struct xdr_stream *xdr, |
404 | const struct nlm_args *args) | ||
406 | { | 405 | { |
407 | const struct nlm_lock *lock = &args->lock; | 406 | const struct nlm_lock *lock = &args->lock; |
408 | struct xdr_stream xdr; | ||
409 | 407 | ||
410 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 408 | encode_cookie(xdr, &args->cookie); |
411 | encode_cookie(&xdr, &args->cookie); | 409 | encode_bool(xdr, args->block); |
412 | encode_bool(&xdr, args->block); | 410 | encode_bool(xdr, lock->fl.fl_type == F_WRLCK); |
413 | encode_bool(&xdr, lock->fl.fl_type == F_WRLCK); | 411 | encode_nlm_lock(xdr, lock); |
414 | encode_nlm_lock(&xdr, lock); | 412 | encode_bool(xdr, args->reclaim); |
415 | encode_bool(&xdr, args->reclaim); | 413 | encode_int32(xdr, args->state); |
416 | encode_int32(&xdr, args->state); | ||
417 | return 0; | ||
418 | } | 414 | } |
419 | 415 | ||
420 | /* | 416 | /* |
@@ -425,18 +421,16 @@ static int nlm_xdr_enc_lockargs(struct rpc_rqst *req, __be32 *p, | |||
425 | * struct nlm_lock alock; | 421 | * struct nlm_lock alock; |
426 | * }; | 422 | * }; |
427 | */ | 423 | */ |
428 | static int nlm_xdr_enc_cancargs(struct rpc_rqst *req, __be32 *p, | 424 | static void nlm_xdr_enc_cancargs(struct rpc_rqst *req, |
429 | const struct nlm_args *args) | 425 | struct xdr_stream *xdr, |
426 | const struct nlm_args *args) | ||
430 | { | 427 | { |
431 | const struct nlm_lock *lock = &args->lock; | 428 | const struct nlm_lock *lock = &args->lock; |
432 | struct xdr_stream xdr; | ||
433 | 429 | ||
434 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 430 | encode_cookie(xdr, &args->cookie); |
435 | encode_cookie(&xdr, &args->cookie); | 431 | encode_bool(xdr, args->block); |
436 | encode_bool(&xdr, args->block); | 432 | encode_bool(xdr, lock->fl.fl_type == F_WRLCK); |
437 | encode_bool(&xdr, lock->fl.fl_type == F_WRLCK); | 433 | encode_nlm_lock(xdr, lock); |
438 | encode_nlm_lock(&xdr, lock); | ||
439 | return 0; | ||
440 | } | 434 | } |
441 | 435 | ||
442 | /* | 436 | /* |
@@ -445,16 +439,14 @@ static int nlm_xdr_enc_cancargs(struct rpc_rqst *req, __be32 *p, | |||
445 | * struct nlm_lock alock; | 439 | * struct nlm_lock alock; |
446 | * }; | 440 | * }; |
447 | */ | 441 | */ |
448 | static int nlm_xdr_enc_unlockargs(struct rpc_rqst *req, __be32 *p, | 442 | static void nlm_xdr_enc_unlockargs(struct rpc_rqst *req, |
449 | const struct nlm_args *args) | 443 | struct xdr_stream *xdr, |
444 | const struct nlm_args *args) | ||
450 | { | 445 | { |
451 | const struct nlm_lock *lock = &args->lock; | 446 | const struct nlm_lock *lock = &args->lock; |
452 | struct xdr_stream xdr; | ||
453 | 447 | ||
454 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 448 | encode_cookie(xdr, &args->cookie); |
455 | encode_cookie(&xdr, &args->cookie); | 449 | encode_nlm_lock(xdr, lock); |
456 | encode_nlm_lock(&xdr, lock); | ||
457 | return 0; | ||
458 | } | 450 | } |
459 | 451 | ||
460 | /* | 452 | /* |
@@ -463,15 +455,12 @@ static int nlm_xdr_enc_unlockargs(struct rpc_rqst *req, __be32 *p, | |||
463 | * nlm_stat stat; | 455 | * nlm_stat stat; |
464 | * }; | 456 | * }; |
465 | */ | 457 | */ |
466 | static int nlm_xdr_enc_res(struct rpc_rqst *req, __be32 *p, | 458 | static void nlm_xdr_enc_res(struct rpc_rqst *req, |
467 | const struct nlm_res *result) | 459 | struct xdr_stream *xdr, |
460 | const struct nlm_res *result) | ||
468 | { | 461 | { |
469 | struct xdr_stream xdr; | 462 | encode_cookie(xdr, &result->cookie); |
470 | 463 | encode_nlm_stat(xdr, result->status); | |
471 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
472 | encode_cookie(&xdr, &result->cookie); | ||
473 | encode_nlm_stat(&xdr, result->status); | ||
474 | return 0; | ||
475 | } | 464 | } |
476 | 465 | ||
477 | /* | 466 | /* |
@@ -494,16 +483,13 @@ static void encode_nlm_testrply(struct xdr_stream *xdr, | |||
494 | encode_nlm_holder(xdr, result); | 483 | encode_nlm_holder(xdr, result); |
495 | } | 484 | } |
496 | 485 | ||
497 | static int nlm_xdr_enc_testres(struct rpc_rqst *req, __be32 *p, | 486 | static void nlm_xdr_enc_testres(struct rpc_rqst *req, |
498 | const struct nlm_res *result) | 487 | struct xdr_stream *xdr, |
488 | const struct nlm_res *result) | ||
499 | { | 489 | { |
500 | struct xdr_stream xdr; | 490 | encode_cookie(xdr, &result->cookie); |
501 | 491 | encode_nlm_stat(xdr, result->status); | |
502 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 492 | encode_nlm_testrply(xdr, result); |
503 | encode_cookie(&xdr, &result->cookie); | ||
504 | encode_nlm_stat(&xdr, result->status); | ||
505 | encode_nlm_testrply(&xdr, result); | ||
506 | return 0; | ||
507 | } | 493 | } |
508 | 494 | ||
509 | 495 | ||
@@ -586,7 +572,7 @@ out: | |||
586 | #define PROC(proc, argtype, restype) \ | 572 | #define PROC(proc, argtype, restype) \ |
587 | [NLMPROC_##proc] = { \ | 573 | [NLMPROC_##proc] = { \ |
588 | .p_proc = NLMPROC_##proc, \ | 574 | .p_proc = NLMPROC_##proc, \ |
589 | .p_encode = (kxdrproc_t)nlm_xdr_enc_##argtype, \ | 575 | .p_encode = (kxdreproc_t)nlm_xdr_enc_##argtype, \ |
590 | .p_decode = (kxdrproc_t)nlm_xdr_dec_##restype, \ | 576 | .p_decode = (kxdrproc_t)nlm_xdr_dec_##restype, \ |
591 | .p_arglen = NLM_##argtype##_sz, \ | 577 | .p_arglen = NLM_##argtype##_sz, \ |
592 | .p_replen = NLM_##restype##_sz, \ | 578 | .p_replen = NLM_##restype##_sz, \ |
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c index d812818d0258..baa77bc9d825 100644 --- a/fs/lockd/mon.c +++ b/fs/lockd/mon.c | |||
@@ -459,25 +459,17 @@ static void encode_priv(struct xdr_stream *xdr, const struct nsm_args *argp) | |||
459 | xdr_encode_opaque_fixed(p, argp->priv->data, SM_PRIV_SIZE); | 459 | xdr_encode_opaque_fixed(p, argp->priv->data, SM_PRIV_SIZE); |
460 | } | 460 | } |
461 | 461 | ||
462 | static int xdr_enc_mon(struct rpc_rqst *req, __be32 *p, | 462 | static void nsm_xdr_enc_mon(struct rpc_rqst *req, struct xdr_stream *xdr, |
463 | const struct nsm_args *argp) | 463 | const struct nsm_args *argp) |
464 | { | 464 | { |
465 | struct xdr_stream xdr; | 465 | encode_mon_id(xdr, argp); |
466 | 466 | encode_priv(xdr, argp); | |
467 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
468 | encode_mon_id(&xdr, argp); | ||
469 | encode_priv(&xdr, argp); | ||
470 | return 0; | ||
471 | } | 467 | } |
472 | 468 | ||
473 | static int xdr_enc_unmon(struct rpc_rqst *req, __be32 *p, | 469 | static void nsm_xdr_enc_unmon(struct rpc_rqst *req, struct xdr_stream *xdr, |
474 | const struct nsm_args *argp) | 470 | const struct nsm_args *argp) |
475 | { | 471 | { |
476 | struct xdr_stream xdr; | 472 | encode_mon_id(xdr, argp); |
477 | |||
478 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
479 | encode_mon_id(&xdr, argp); | ||
480 | return 0; | ||
481 | } | 473 | } |
482 | 474 | ||
483 | static int xdr_dec_stat_res(struct rpc_rqst *rqstp, __be32 *p, | 475 | static int xdr_dec_stat_res(struct rpc_rqst *rqstp, __be32 *p, |
@@ -524,7 +516,7 @@ static int xdr_dec_stat(struct rpc_rqst *rqstp, __be32 *p, | |||
524 | static struct rpc_procinfo nsm_procedures[] = { | 516 | static struct rpc_procinfo nsm_procedures[] = { |
525 | [NSMPROC_MON] = { | 517 | [NSMPROC_MON] = { |
526 | .p_proc = NSMPROC_MON, | 518 | .p_proc = NSMPROC_MON, |
527 | .p_encode = (kxdrproc_t)xdr_enc_mon, | 519 | .p_encode = (kxdreproc_t)nsm_xdr_enc_mon, |
528 | .p_decode = (kxdrproc_t)xdr_dec_stat_res, | 520 | .p_decode = (kxdrproc_t)xdr_dec_stat_res, |
529 | .p_arglen = SM_mon_sz, | 521 | .p_arglen = SM_mon_sz, |
530 | .p_replen = SM_monres_sz, | 522 | .p_replen = SM_monres_sz, |
@@ -533,7 +525,7 @@ static struct rpc_procinfo nsm_procedures[] = { | |||
533 | }, | 525 | }, |
534 | [NSMPROC_UNMON] = { | 526 | [NSMPROC_UNMON] = { |
535 | .p_proc = NSMPROC_UNMON, | 527 | .p_proc = NSMPROC_UNMON, |
536 | .p_encode = (kxdrproc_t)xdr_enc_unmon, | 528 | .p_encode = (kxdreproc_t)nsm_xdr_enc_unmon, |
537 | .p_decode = (kxdrproc_t)xdr_dec_stat, | 529 | .p_decode = (kxdrproc_t)xdr_dec_stat, |
538 | .p_arglen = SM_mon_id_sz, | 530 | .p_arglen = SM_mon_id_sz, |
539 | .p_replen = SM_unmonres_sz, | 531 | .p_replen = SM_unmonres_sz, |
diff --git a/fs/nfs/mount_clnt.c b/fs/nfs/mount_clnt.c index 97c3ec793305..979ebd7af3cb 100644 --- a/fs/nfs/mount_clnt.c +++ b/fs/nfs/mount_clnt.c | |||
@@ -288,14 +288,10 @@ static void encode_mntdirpath(struct xdr_stream *xdr, const char *pathname) | |||
288 | xdr_encode_opaque(p, pathname, pathname_len); | 288 | xdr_encode_opaque(p, pathname, pathname_len); |
289 | } | 289 | } |
290 | 290 | ||
291 | static int mnt_enc_dirpath(struct rpc_rqst *req, __be32 *p, | 291 | static void mnt_xdr_enc_dirpath(struct rpc_rqst *req, struct xdr_stream *xdr, |
292 | const char *dirpath) | 292 | const char *dirpath) |
293 | { | 293 | { |
294 | struct xdr_stream xdr; | 294 | encode_mntdirpath(xdr, dirpath); |
295 | |||
296 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
297 | encode_mntdirpath(&xdr, dirpath); | ||
298 | return 0; | ||
299 | } | 295 | } |
300 | 296 | ||
301 | /* | 297 | /* |
@@ -460,7 +456,7 @@ static int mnt_dec_mountres3(struct rpc_rqst *req, __be32 *p, | |||
460 | static struct rpc_procinfo mnt_procedures[] = { | 456 | static struct rpc_procinfo mnt_procedures[] = { |
461 | [MOUNTPROC_MNT] = { | 457 | [MOUNTPROC_MNT] = { |
462 | .p_proc = MOUNTPROC_MNT, | 458 | .p_proc = MOUNTPROC_MNT, |
463 | .p_encode = (kxdrproc_t)mnt_enc_dirpath, | 459 | .p_encode = (kxdreproc_t)mnt_xdr_enc_dirpath, |
464 | .p_decode = (kxdrproc_t)mnt_dec_mountres, | 460 | .p_decode = (kxdrproc_t)mnt_dec_mountres, |
465 | .p_arglen = MNT_enc_dirpath_sz, | 461 | .p_arglen = MNT_enc_dirpath_sz, |
466 | .p_replen = MNT_dec_mountres_sz, | 462 | .p_replen = MNT_dec_mountres_sz, |
@@ -469,7 +465,7 @@ static struct rpc_procinfo mnt_procedures[] = { | |||
469 | }, | 465 | }, |
470 | [MOUNTPROC_UMNT] = { | 466 | [MOUNTPROC_UMNT] = { |
471 | .p_proc = MOUNTPROC_UMNT, | 467 | .p_proc = MOUNTPROC_UMNT, |
472 | .p_encode = (kxdrproc_t)mnt_enc_dirpath, | 468 | .p_encode = (kxdreproc_t)mnt_xdr_enc_dirpath, |
473 | .p_arglen = MNT_enc_dirpath_sz, | 469 | .p_arglen = MNT_enc_dirpath_sz, |
474 | .p_statidx = MOUNTPROC_UMNT, | 470 | .p_statidx = MOUNTPROC_UMNT, |
475 | .p_name = "UMOUNT", | 471 | .p_name = "UMOUNT", |
@@ -479,7 +475,7 @@ static struct rpc_procinfo mnt_procedures[] = { | |||
479 | static struct rpc_procinfo mnt3_procedures[] = { | 475 | static struct rpc_procinfo mnt3_procedures[] = { |
480 | [MOUNTPROC3_MNT] = { | 476 | [MOUNTPROC3_MNT] = { |
481 | .p_proc = MOUNTPROC3_MNT, | 477 | .p_proc = MOUNTPROC3_MNT, |
482 | .p_encode = (kxdrproc_t)mnt_enc_dirpath, | 478 | .p_encode = (kxdreproc_t)mnt_xdr_enc_dirpath, |
483 | .p_decode = (kxdrproc_t)mnt_dec_mountres3, | 479 | .p_decode = (kxdrproc_t)mnt_dec_mountres3, |
484 | .p_arglen = MNT_enc_dirpath_sz, | 480 | .p_arglen = MNT_enc_dirpath_sz, |
485 | .p_replen = MNT_dec_mountres3_sz, | 481 | .p_replen = MNT_dec_mountres3_sz, |
@@ -488,7 +484,7 @@ static struct rpc_procinfo mnt3_procedures[] = { | |||
488 | }, | 484 | }, |
489 | [MOUNTPROC3_UMNT] = { | 485 | [MOUNTPROC3_UMNT] = { |
490 | .p_proc = MOUNTPROC3_UMNT, | 486 | .p_proc = MOUNTPROC3_UMNT, |
491 | .p_encode = (kxdrproc_t)mnt_enc_dirpath, | 487 | .p_encode = (kxdreproc_t)mnt_xdr_enc_dirpath, |
492 | .p_arglen = MNT_enc_dirpath_sz, | 488 | .p_arglen = MNT_enc_dirpath_sz, |
493 | .p_statidx = MOUNTPROC3_UMNT, | 489 | .p_statidx = MOUNTPROC3_UMNT, |
494 | .p_name = "UMOUNT", | 490 | .p_name = "UMOUNT", |
diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c index a9b848edbd2e..8f3acbec761f 100644 --- a/fs/nfs/nfs2xdr.c +++ b/fs/nfs/nfs2xdr.c | |||
@@ -558,14 +558,11 @@ out_default: | |||
558 | * "NFS: Network File System Protocol Specification". | 558 | * "NFS: Network File System Protocol Specification". |
559 | */ | 559 | */ |
560 | 560 | ||
561 | static int nfs2_xdr_enc_fhandle(struct rpc_rqst *req, __be32 *p, | 561 | static void nfs2_xdr_enc_fhandle(struct rpc_rqst *req, |
562 | const struct nfs_fh *fh) | 562 | struct xdr_stream *xdr, |
563 | const struct nfs_fh *fh) | ||
563 | { | 564 | { |
564 | struct xdr_stream xdr; | 565 | encode_fhandle(xdr, fh); |
565 | |||
566 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
567 | encode_fhandle(&xdr, fh); | ||
568 | return 0; | ||
569 | } | 566 | } |
570 | 567 | ||
571 | /* | 568 | /* |
@@ -576,37 +573,28 @@ static int nfs2_xdr_enc_fhandle(struct rpc_rqst *req, __be32 *p, | |||
576 | * sattr attributes; | 573 | * sattr attributes; |
577 | * }; | 574 | * }; |
578 | */ | 575 | */ |
579 | static int nfs2_xdr_enc_sattrargs(struct rpc_rqst *req, __be32 *p, | 576 | static void nfs2_xdr_enc_sattrargs(struct rpc_rqst *req, |
580 | const struct nfs_sattrargs *args) | 577 | struct xdr_stream *xdr, |
578 | const struct nfs_sattrargs *args) | ||
581 | { | 579 | { |
582 | struct xdr_stream xdr; | 580 | encode_fhandle(xdr, args->fh); |
583 | 581 | encode_sattr(xdr, args->sattr); | |
584 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
585 | encode_fhandle(&xdr, args->fh); | ||
586 | encode_sattr(&xdr, args->sattr); | ||
587 | return 0; | ||
588 | } | 582 | } |
589 | 583 | ||
590 | static int nfs2_xdr_enc_diropargs(struct rpc_rqst *req, __be32 *p, | 584 | static void nfs2_xdr_enc_diropargs(struct rpc_rqst *req, |
591 | const struct nfs_diropargs *args) | 585 | struct xdr_stream *xdr, |
586 | const struct nfs_diropargs *args) | ||
592 | { | 587 | { |
593 | struct xdr_stream xdr; | 588 | encode_diropargs(xdr, args->fh, args->name, args->len); |
594 | |||
595 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
596 | encode_diropargs(&xdr, args->fh, args->name, args->len); | ||
597 | return 0; | ||
598 | } | 589 | } |
599 | 590 | ||
600 | static int nfs2_xdr_enc_readlinkargs(struct rpc_rqst *req, __be32 *p, | 591 | static void nfs2_xdr_enc_readlinkargs(struct rpc_rqst *req, |
601 | const struct nfs_readlinkargs *args) | 592 | struct xdr_stream *xdr, |
593 | const struct nfs_readlinkargs *args) | ||
602 | { | 594 | { |
603 | struct xdr_stream xdr; | 595 | encode_fhandle(xdr, args->fh); |
604 | |||
605 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
606 | encode_fhandle(&xdr, args->fh); | ||
607 | prepare_reply_buffer(req, args->pages, args->pgbase, | 596 | prepare_reply_buffer(req, args->pages, args->pgbase, |
608 | args->pglen, NFS_readlinkres_sz); | 597 | args->pglen, NFS_readlinkres_sz); |
609 | return 0; | ||
610 | } | 598 | } |
611 | 599 | ||
612 | /* | 600 | /* |
@@ -634,17 +622,14 @@ static void encode_readargs(struct xdr_stream *xdr, | |||
634 | *p = cpu_to_be32(count); | 622 | *p = cpu_to_be32(count); |
635 | } | 623 | } |
636 | 624 | ||
637 | static int nfs2_xdr_enc_readargs(struct rpc_rqst *req, __be32 *p, | 625 | static void nfs2_xdr_enc_readargs(struct rpc_rqst *req, |
638 | const struct nfs_readargs *args) | 626 | struct xdr_stream *xdr, |
627 | const struct nfs_readargs *args) | ||
639 | { | 628 | { |
640 | struct xdr_stream xdr; | 629 | encode_readargs(xdr, args); |
641 | |||
642 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
643 | encode_readargs(&xdr, args); | ||
644 | prepare_reply_buffer(req, args->pages, args->pgbase, | 630 | prepare_reply_buffer(req, args->pages, args->pgbase, |
645 | args->count, NFS_readres_sz); | 631 | args->count, NFS_readres_sz); |
646 | req->rq_rcv_buf.flags |= XDRBUF_READ; | 632 | req->rq_rcv_buf.flags |= XDRBUF_READ; |
647 | return 0; | ||
648 | } | 633 | } |
649 | 634 | ||
650 | /* | 635 | /* |
@@ -677,15 +662,12 @@ static void encode_writeargs(struct xdr_stream *xdr, | |||
677 | xdr_write_pages(xdr, args->pages, args->pgbase, count); | 662 | xdr_write_pages(xdr, args->pages, args->pgbase, count); |
678 | } | 663 | } |
679 | 664 | ||
680 | static int nfs2_xdr_enc_writeargs(struct rpc_rqst *req, __be32 *p, | 665 | static void nfs2_xdr_enc_writeargs(struct rpc_rqst *req, |
681 | const struct nfs_writeargs *args) | 666 | struct xdr_stream *xdr, |
667 | const struct nfs_writeargs *args) | ||
682 | { | 668 | { |
683 | struct xdr_stream xdr; | 669 | encode_writeargs(xdr, args); |
684 | 670 | xdr->buf->flags |= XDRBUF_WRITE; | |
685 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
686 | encode_writeargs(&xdr, args); | ||
687 | xdr.buf->flags |= XDRBUF_WRITE; | ||
688 | return 0; | ||
689 | } | 671 | } |
690 | 672 | ||
691 | /* | 673 | /* |
@@ -696,25 +678,19 @@ static int nfs2_xdr_enc_writeargs(struct rpc_rqst *req, __be32 *p, | |||
696 | * sattr attributes; | 678 | * sattr attributes; |
697 | * }; | 679 | * }; |
698 | */ | 680 | */ |
699 | static int nfs2_xdr_enc_createargs(struct rpc_rqst *req, __be32 *p, | 681 | static void nfs2_xdr_enc_createargs(struct rpc_rqst *req, |
700 | const struct nfs_createargs *args) | 682 | struct xdr_stream *xdr, |
683 | const struct nfs_createargs *args) | ||
701 | { | 684 | { |
702 | struct xdr_stream xdr; | 685 | encode_diropargs(xdr, args->fh, args->name, args->len); |
703 | 686 | encode_sattr(xdr, args->sattr); | |
704 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
705 | encode_diropargs(&xdr, args->fh, args->name, args->len); | ||
706 | encode_sattr(&xdr, args->sattr); | ||
707 | return 0; | ||
708 | } | 687 | } |
709 | 688 | ||
710 | static int nfs2_xdr_enc_removeargs(struct rpc_rqst *req, __be32 *p, | 689 | static void nfs2_xdr_enc_removeargs(struct rpc_rqst *req, |
711 | const struct nfs_removeargs *args) | 690 | struct xdr_stream *xdr, |
691 | const struct nfs_removeargs *args) | ||
712 | { | 692 | { |
713 | struct xdr_stream xdr; | 693 | encode_diropargs(xdr, args->fh, args->name.name, args->name.len); |
714 | |||
715 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
716 | encode_diropargs(&xdr, args->fh, args->name.name, args->name.len); | ||
717 | return 0; | ||
718 | } | 694 | } |
719 | 695 | ||
720 | /* | 696 | /* |
@@ -725,17 +701,15 @@ static int nfs2_xdr_enc_removeargs(struct rpc_rqst *req, __be32 *p, | |||
725 | * diropargs to; | 701 | * diropargs to; |
726 | * }; | 702 | * }; |
727 | */ | 703 | */ |
728 | static int nfs2_xdr_enc_renameargs(struct rpc_rqst *req, __be32 *p, | 704 | static void nfs2_xdr_enc_renameargs(struct rpc_rqst *req, |
729 | const struct nfs_renameargs *args) | 705 | struct xdr_stream *xdr, |
706 | const struct nfs_renameargs *args) | ||
730 | { | 707 | { |
731 | const struct qstr *old = args->old_name; | 708 | const struct qstr *old = args->old_name; |
732 | const struct qstr *new = args->new_name; | 709 | const struct qstr *new = args->new_name; |
733 | struct xdr_stream xdr; | ||
734 | 710 | ||
735 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 711 | encode_diropargs(xdr, args->old_dir, old->name, old->len); |
736 | encode_diropargs(&xdr, args->old_dir, old->name, old->len); | 712 | encode_diropargs(xdr, args->new_dir, new->name, new->len); |
737 | encode_diropargs(&xdr, args->new_dir, new->name, new->len); | ||
738 | return 0; | ||
739 | } | 713 | } |
740 | 714 | ||
741 | /* | 715 | /* |
@@ -746,15 +720,12 @@ static int nfs2_xdr_enc_renameargs(struct rpc_rqst *req, __be32 *p, | |||
746 | * diropargs to; | 720 | * diropargs to; |
747 | * }; | 721 | * }; |
748 | */ | 722 | */ |
749 | static int nfs2_xdr_enc_linkargs(struct rpc_rqst *req, __be32 *p, | 723 | static void nfs2_xdr_enc_linkargs(struct rpc_rqst *req, |
750 | const struct nfs_linkargs *args) | 724 | struct xdr_stream *xdr, |
725 | const struct nfs_linkargs *args) | ||
751 | { | 726 | { |
752 | struct xdr_stream xdr; | 727 | encode_fhandle(xdr, args->fromfh); |
753 | 728 | encode_diropargs(xdr, args->tofh, args->toname, args->tolen); | |
754 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
755 | encode_fhandle(&xdr, args->fromfh); | ||
756 | encode_diropargs(&xdr, args->tofh, args->toname, args->tolen); | ||
757 | return 0; | ||
758 | } | 729 | } |
759 | 730 | ||
760 | /* | 731 | /* |
@@ -766,16 +737,13 @@ static int nfs2_xdr_enc_linkargs(struct rpc_rqst *req, __be32 *p, | |||
766 | * sattr attributes; | 737 | * sattr attributes; |
767 | * }; | 738 | * }; |
768 | */ | 739 | */ |
769 | static int nfs2_xdr_enc_symlinkargs(struct rpc_rqst *req, __be32 *p, | 740 | static void nfs2_xdr_enc_symlinkargs(struct rpc_rqst *req, |
770 | const struct nfs_symlinkargs *args) | 741 | struct xdr_stream *xdr, |
742 | const struct nfs_symlinkargs *args) | ||
771 | { | 743 | { |
772 | struct xdr_stream xdr; | 744 | encode_diropargs(xdr, args->fromfh, args->fromname, args->fromlen); |
773 | 745 | encode_path(xdr, args->pages, args->pathlen); | |
774 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 746 | encode_sattr(xdr, args->sattr); |
775 | encode_diropargs(&xdr, args->fromfh, args->fromname, args->fromlen); | ||
776 | encode_path(&xdr, args->pages, args->pathlen); | ||
777 | encode_sattr(&xdr, args->sattr); | ||
778 | return 0; | ||
779 | } | 747 | } |
780 | 748 | ||
781 | /* | 749 | /* |
@@ -799,16 +767,13 @@ static void encode_readdirargs(struct xdr_stream *xdr, | |||
799 | *p = cpu_to_be32(args->count); | 767 | *p = cpu_to_be32(args->count); |
800 | } | 768 | } |
801 | 769 | ||
802 | static int nfs2_xdr_enc_readdirargs(struct rpc_rqst *req, __be32 *p, | 770 | static void nfs2_xdr_enc_readdirargs(struct rpc_rqst *req, |
803 | const struct nfs_readdirargs *args) | 771 | struct xdr_stream *xdr, |
772 | const struct nfs_readdirargs *args) | ||
804 | { | 773 | { |
805 | struct xdr_stream xdr; | 774 | encode_readdirargs(xdr, args); |
806 | |||
807 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
808 | encode_readdirargs(&xdr, args); | ||
809 | prepare_reply_buffer(req, args->pages, 0, | 775 | prepare_reply_buffer(req, args->pages, 0, |
810 | args->count, NFS_readdirres_sz); | 776 | args->count, NFS_readdirres_sz); |
811 | return 0; | ||
812 | } | 777 | } |
813 | 778 | ||
814 | /* | 779 | /* |
@@ -1184,7 +1149,7 @@ int nfs_stat_to_errno(enum nfs_stat status) | |||
1184 | #define PROC(proc, argtype, restype, timer) \ | 1149 | #define PROC(proc, argtype, restype, timer) \ |
1185 | [NFSPROC_##proc] = { \ | 1150 | [NFSPROC_##proc] = { \ |
1186 | .p_proc = NFSPROC_##proc, \ | 1151 | .p_proc = NFSPROC_##proc, \ |
1187 | .p_encode = (kxdrproc_t)nfs2_xdr_enc_##argtype, \ | 1152 | .p_encode = (kxdreproc_t)nfs2_xdr_enc_##argtype, \ |
1188 | .p_decode = (kxdrproc_t)nfs2_xdr_dec_##restype, \ | 1153 | .p_decode = (kxdrproc_t)nfs2_xdr_dec_##restype, \ |
1189 | .p_arglen = NFS_##argtype##_sz, \ | 1154 | .p_arglen = NFS_##argtype##_sz, \ |
1190 | .p_replen = NFS_##restype##_sz, \ | 1155 | .p_replen = NFS_##restype##_sz, \ |
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c index 15c93ccd90c5..ae1b1a43f05e 100644 --- a/fs/nfs/nfs3xdr.c +++ b/fs/nfs/nfs3xdr.c | |||
@@ -835,14 +835,11 @@ static void encode_diropargs3(struct xdr_stream *xdr, const struct nfs_fh *fh, | |||
835 | * nfs_fh3 object; | 835 | * nfs_fh3 object; |
836 | * }; | 836 | * }; |
837 | */ | 837 | */ |
838 | static int nfs3_xdr_enc_getattr3args(struct rpc_rqst *req, __be32 *p, | 838 | static void nfs3_xdr_enc_getattr3args(struct rpc_rqst *req, |
839 | const struct nfs_fh *fh) | 839 | struct xdr_stream *xdr, |
840 | const struct nfs_fh *fh) | ||
840 | { | 841 | { |
841 | struct xdr_stream xdr; | 842 | encode_nfs_fh3(xdr, fh); |
842 | |||
843 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
844 | encode_nfs_fh3(&xdr, fh); | ||
845 | return 0; | ||
846 | } | 843 | } |
847 | 844 | ||
848 | /* | 845 | /* |
@@ -876,16 +873,13 @@ static void encode_sattrguard3(struct xdr_stream *xdr, | |||
876 | } | 873 | } |
877 | } | 874 | } |
878 | 875 | ||
879 | static int nfs3_xdr_enc_setattr3args(struct rpc_rqst *req, __be32 *p, | 876 | static void nfs3_xdr_enc_setattr3args(struct rpc_rqst *req, |
880 | const struct nfs3_sattrargs *args) | 877 | struct xdr_stream *xdr, |
878 | const struct nfs3_sattrargs *args) | ||
881 | { | 879 | { |
882 | struct xdr_stream xdr; | 880 | encode_nfs_fh3(xdr, args->fh); |
883 | 881 | encode_sattr3(xdr, args->sattr); | |
884 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 882 | encode_sattrguard3(xdr, args); |
885 | encode_nfs_fh3(&xdr, args->fh); | ||
886 | encode_sattr3(&xdr, args->sattr); | ||
887 | encode_sattrguard3(&xdr, args); | ||
888 | return 0; | ||
889 | } | 883 | } |
890 | 884 | ||
891 | /* | 885 | /* |
@@ -895,14 +889,11 @@ static int nfs3_xdr_enc_setattr3args(struct rpc_rqst *req, __be32 *p, | |||
895 | * diropargs3 what; | 889 | * diropargs3 what; |
896 | * }; | 890 | * }; |
897 | */ | 891 | */ |
898 | static int nfs3_xdr_enc_lookup3args(struct rpc_rqst *req, __be32 *p, | 892 | static void nfs3_xdr_enc_lookup3args(struct rpc_rqst *req, |
899 | const struct nfs3_diropargs *args) | 893 | struct xdr_stream *xdr, |
894 | const struct nfs3_diropargs *args) | ||
900 | { | 895 | { |
901 | struct xdr_stream xdr; | 896 | encode_diropargs3(xdr, args->fh, args->name, args->len); |
902 | |||
903 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
904 | encode_diropargs3(&xdr, args->fh, args->name, args->len); | ||
905 | return 0; | ||
906 | } | 897 | } |
907 | 898 | ||
908 | /* | 899 | /* |
@@ -920,14 +911,11 @@ static void encode_access3args(struct xdr_stream *xdr, | |||
920 | encode_uint32(xdr, args->access); | 911 | encode_uint32(xdr, args->access); |
921 | } | 912 | } |
922 | 913 | ||
923 | static int nfs3_xdr_enc_access3args(struct rpc_rqst *req, __be32 *p, | 914 | static void nfs3_xdr_enc_access3args(struct rpc_rqst *req, |
924 | const struct nfs3_accessargs *args) | 915 | struct xdr_stream *xdr, |
916 | const struct nfs3_accessargs *args) | ||
925 | { | 917 | { |
926 | struct xdr_stream xdr; | 918 | encode_access3args(xdr, args); |
927 | |||
928 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
929 | encode_access3args(&xdr, args); | ||
930 | return 0; | ||
931 | } | 919 | } |
932 | 920 | ||
933 | /* | 921 | /* |
@@ -937,16 +925,13 @@ static int nfs3_xdr_enc_access3args(struct rpc_rqst *req, __be32 *p, | |||
937 | * nfs_fh3 symlink; | 925 | * nfs_fh3 symlink; |
938 | * }; | 926 | * }; |
939 | */ | 927 | */ |
940 | static int nfs3_xdr_enc_readlink3args(struct rpc_rqst *req, __be32 *p, | 928 | static void nfs3_xdr_enc_readlink3args(struct rpc_rqst *req, |
941 | const struct nfs3_readlinkargs *args) | 929 | struct xdr_stream *xdr, |
930 | const struct nfs3_readlinkargs *args) | ||
942 | { | 931 | { |
943 | struct xdr_stream xdr; | 932 | encode_nfs_fh3(xdr, args->fh); |
944 | |||
945 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
946 | encode_nfs_fh3(&xdr, args->fh); | ||
947 | prepare_reply_buffer(req, args->pages, args->pgbase, | 933 | prepare_reply_buffer(req, args->pages, args->pgbase, |
948 | args->pglen, NFS3_readlinkres_sz); | 934 | args->pglen, NFS3_readlinkres_sz); |
949 | return 0; | ||
950 | } | 935 | } |
951 | 936 | ||
952 | /* | 937 | /* |
@@ -970,17 +955,14 @@ static void encode_read3args(struct xdr_stream *xdr, | |||
970 | *p = cpu_to_be32(args->count); | 955 | *p = cpu_to_be32(args->count); |
971 | } | 956 | } |
972 | 957 | ||
973 | static int nfs3_xdr_enc_read3args(struct rpc_rqst *req, __be32 *p, | 958 | static void nfs3_xdr_enc_read3args(struct rpc_rqst *req, |
974 | const struct nfs_readargs *args) | 959 | struct xdr_stream *xdr, |
960 | const struct nfs_readargs *args) | ||
975 | { | 961 | { |
976 | struct xdr_stream xdr; | 962 | encode_read3args(xdr, args); |
977 | |||
978 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
979 | encode_read3args(&xdr, args); | ||
980 | prepare_reply_buffer(req, args->pages, args->pgbase, | 963 | prepare_reply_buffer(req, args->pages, args->pgbase, |
981 | args->count, NFS3_readres_sz); | 964 | args->count, NFS3_readres_sz); |
982 | req->rq_rcv_buf.flags |= XDRBUF_READ; | 965 | req->rq_rcv_buf.flags |= XDRBUF_READ; |
983 | return 0; | ||
984 | } | 966 | } |
985 | 967 | ||
986 | /* | 968 | /* |
@@ -1015,15 +997,12 @@ static void encode_write3args(struct xdr_stream *xdr, | |||
1015 | xdr_write_pages(xdr, args->pages, args->pgbase, args->count); | 997 | xdr_write_pages(xdr, args->pages, args->pgbase, args->count); |
1016 | } | 998 | } |
1017 | 999 | ||
1018 | static int nfs3_xdr_enc_write3args(struct rpc_rqst *req, __be32 *p, | 1000 | static void nfs3_xdr_enc_write3args(struct rpc_rqst *req, |
1019 | const struct nfs_writeargs *args) | 1001 | struct xdr_stream *xdr, |
1002 | const struct nfs_writeargs *args) | ||
1020 | { | 1003 | { |
1021 | struct xdr_stream xdr; | 1004 | encode_write3args(xdr, args); |
1022 | 1005 | xdr->buf->flags |= XDRBUF_WRITE; | |
1023 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
1024 | encode_write3args(&xdr, args); | ||
1025 | xdr.buf->flags |= XDRBUF_WRITE; | ||
1026 | return 0; | ||
1027 | } | 1006 | } |
1028 | 1007 | ||
1029 | /* | 1008 | /* |
@@ -1065,15 +1044,12 @@ static void encode_createhow3(struct xdr_stream *xdr, | |||
1065 | } | 1044 | } |
1066 | } | 1045 | } |
1067 | 1046 | ||
1068 | static int nfs3_xdr_enc_create3args(struct rpc_rqst *req, __be32 *p, | 1047 | static void nfs3_xdr_enc_create3args(struct rpc_rqst *req, |
1069 | const struct nfs3_createargs *args) | 1048 | struct xdr_stream *xdr, |
1049 | const struct nfs3_createargs *args) | ||
1070 | { | 1050 | { |
1071 | struct xdr_stream xdr; | 1051 | encode_diropargs3(xdr, args->fh, args->name, args->len); |
1072 | 1052 | encode_createhow3(xdr, args); | |
1073 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
1074 | encode_diropargs3(&xdr, args->fh, args->name, args->len); | ||
1075 | encode_createhow3(&xdr, args); | ||
1076 | return 0; | ||
1077 | } | 1053 | } |
1078 | 1054 | ||
1079 | /* | 1055 | /* |
@@ -1084,15 +1060,12 @@ static int nfs3_xdr_enc_create3args(struct rpc_rqst *req, __be32 *p, | |||
1084 | * sattr3 attributes; | 1060 | * sattr3 attributes; |
1085 | * }; | 1061 | * }; |
1086 | */ | 1062 | */ |
1087 | static int nfs3_xdr_enc_mkdir3args(struct rpc_rqst *req, __be32 *p, | 1063 | static void nfs3_xdr_enc_mkdir3args(struct rpc_rqst *req, |
1088 | const struct nfs3_mkdirargs *args) | 1064 | struct xdr_stream *xdr, |
1065 | const struct nfs3_mkdirargs *args) | ||
1089 | { | 1066 | { |
1090 | struct xdr_stream xdr; | 1067 | encode_diropargs3(xdr, args->fh, args->name, args->len); |
1091 | 1068 | encode_sattr3(xdr, args->sattr); | |
1092 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
1093 | encode_diropargs3(&xdr, args->fh, args->name, args->len); | ||
1094 | encode_sattr3(&xdr, args->sattr); | ||
1095 | return 0; | ||
1096 | } | 1069 | } |
1097 | 1070 | ||
1098 | /* | 1071 | /* |
@@ -1115,15 +1088,12 @@ static void encode_symlinkdata3(struct xdr_stream *xdr, | |||
1115 | encode_nfspath3(xdr, args->pages, args->pathlen); | 1088 | encode_nfspath3(xdr, args->pages, args->pathlen); |
1116 | } | 1089 | } |
1117 | 1090 | ||
1118 | static int nfs3_xdr_enc_symlink3args(struct rpc_rqst *req, __be32 *p, | 1091 | static void nfs3_xdr_enc_symlink3args(struct rpc_rqst *req, |
1119 | const struct nfs3_symlinkargs *args) | 1092 | struct xdr_stream *xdr, |
1093 | const struct nfs3_symlinkargs *args) | ||
1120 | { | 1094 | { |
1121 | struct xdr_stream xdr; | 1095 | encode_diropargs3(xdr, args->fromfh, args->fromname, args->fromlen); |
1122 | 1096 | encode_symlinkdata3(xdr, args); | |
1123 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
1124 | encode_diropargs3(&xdr, args->fromfh, args->fromname, args->fromlen); | ||
1125 | encode_symlinkdata3(&xdr, args); | ||
1126 | return 0; | ||
1127 | } | 1097 | } |
1128 | 1098 | ||
1129 | /* | 1099 | /* |
@@ -1178,15 +1148,12 @@ static void encode_mknoddata3(struct xdr_stream *xdr, | |||
1178 | } | 1148 | } |
1179 | } | 1149 | } |
1180 | 1150 | ||
1181 | static int nfs3_xdr_enc_mknod3args(struct rpc_rqst *req, __be32 *p, | 1151 | static void nfs3_xdr_enc_mknod3args(struct rpc_rqst *req, |
1182 | const struct nfs3_mknodargs *args) | 1152 | struct xdr_stream *xdr, |
1153 | const struct nfs3_mknodargs *args) | ||
1183 | { | 1154 | { |
1184 | struct xdr_stream xdr; | 1155 | encode_diropargs3(xdr, args->fh, args->name, args->len); |
1185 | 1156 | encode_mknoddata3(xdr, args); | |
1186 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
1187 | encode_diropargs3(&xdr, args->fh, args->name, args->len); | ||
1188 | encode_mknoddata3(&xdr, args); | ||
1189 | return 0; | ||
1190 | } | 1157 | } |
1191 | 1158 | ||
1192 | /* | 1159 | /* |
@@ -1196,14 +1163,11 @@ static int nfs3_xdr_enc_mknod3args(struct rpc_rqst *req, __be32 *p, | |||
1196 | * diropargs3 object; | 1163 | * diropargs3 object; |
1197 | * }; | 1164 | * }; |
1198 | */ | 1165 | */ |
1199 | static int nfs3_xdr_enc_remove3args(struct rpc_rqst *req, __be32 *p, | 1166 | static void nfs3_xdr_enc_remove3args(struct rpc_rqst *req, |
1200 | const struct nfs_removeargs *args) | 1167 | struct xdr_stream *xdr, |
1168 | const struct nfs_removeargs *args) | ||
1201 | { | 1169 | { |
1202 | struct xdr_stream xdr; | 1170 | encode_diropargs3(xdr, args->fh, args->name.name, args->name.len); |
1203 | |||
1204 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
1205 | encode_diropargs3(&xdr, args->fh, args->name.name, args->name.len); | ||
1206 | return 0; | ||
1207 | } | 1171 | } |
1208 | 1172 | ||
1209 | /* | 1173 | /* |
@@ -1214,17 +1178,15 @@ static int nfs3_xdr_enc_remove3args(struct rpc_rqst *req, __be32 *p, | |||
1214 | * diropargs3 to; | 1178 | * diropargs3 to; |
1215 | * }; | 1179 | * }; |
1216 | */ | 1180 | */ |
1217 | static int nfs3_xdr_enc_rename3args(struct rpc_rqst *req, __be32 *p, | 1181 | static void nfs3_xdr_enc_rename3args(struct rpc_rqst *req, |
1218 | const struct nfs_renameargs *args) | 1182 | struct xdr_stream *xdr, |
1183 | const struct nfs_renameargs *args) | ||
1219 | { | 1184 | { |
1220 | const struct qstr *old = args->old_name; | 1185 | const struct qstr *old = args->old_name; |
1221 | const struct qstr *new = args->new_name; | 1186 | const struct qstr *new = args->new_name; |
1222 | struct xdr_stream xdr; | ||
1223 | 1187 | ||
1224 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1188 | encode_diropargs3(xdr, args->old_dir, old->name, old->len); |
1225 | encode_diropargs3(&xdr, args->old_dir, old->name, old->len); | 1189 | encode_diropargs3(xdr, args->new_dir, new->name, new->len); |
1226 | encode_diropargs3(&xdr, args->new_dir, new->name, new->len); | ||
1227 | return 0; | ||
1228 | } | 1190 | } |
1229 | 1191 | ||
1230 | /* | 1192 | /* |
@@ -1235,15 +1197,12 @@ static int nfs3_xdr_enc_rename3args(struct rpc_rqst *req, __be32 *p, | |||
1235 | * diropargs3 link; | 1197 | * diropargs3 link; |
1236 | * }; | 1198 | * }; |
1237 | */ | 1199 | */ |
1238 | static int nfs3_xdr_enc_link3args(struct rpc_rqst *req, __be32 *p, | 1200 | static void nfs3_xdr_enc_link3args(struct rpc_rqst *req, |
1239 | const struct nfs3_linkargs *args) | 1201 | struct xdr_stream *xdr, |
1202 | const struct nfs3_linkargs *args) | ||
1240 | { | 1203 | { |
1241 | struct xdr_stream xdr; | 1204 | encode_nfs_fh3(xdr, args->fromfh); |
1242 | 1205 | encode_diropargs3(xdr, args->tofh, args->toname, args->tolen); | |
1243 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
1244 | encode_nfs_fh3(&xdr, args->fromfh); | ||
1245 | encode_diropargs3(&xdr, args->tofh, args->toname, args->tolen); | ||
1246 | return 0; | ||
1247 | } | 1206 | } |
1248 | 1207 | ||
1249 | /* | 1208 | /* |
@@ -1269,16 +1228,13 @@ static void encode_readdir3args(struct xdr_stream *xdr, | |||
1269 | *p = cpu_to_be32(args->count); | 1228 | *p = cpu_to_be32(args->count); |
1270 | } | 1229 | } |
1271 | 1230 | ||
1272 | static int nfs3_xdr_enc_readdir3args(struct rpc_rqst *req, __be32 *p, | 1231 | static void nfs3_xdr_enc_readdir3args(struct rpc_rqst *req, |
1273 | const struct nfs3_readdirargs *args) | 1232 | struct xdr_stream *xdr, |
1233 | const struct nfs3_readdirargs *args) | ||
1274 | { | 1234 | { |
1275 | struct xdr_stream xdr; | 1235 | encode_readdir3args(xdr, args); |
1276 | |||
1277 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
1278 | encode_readdir3args(&xdr, args); | ||
1279 | prepare_reply_buffer(req, args->pages, 0, | 1236 | prepare_reply_buffer(req, args->pages, 0, |
1280 | args->count, NFS3_readdirres_sz); | 1237 | args->count, NFS3_readdirres_sz); |
1281 | return 0; | ||
1282 | } | 1238 | } |
1283 | 1239 | ||
1284 | /* | 1240 | /* |
@@ -1312,16 +1268,13 @@ static void encode_readdirplus3args(struct xdr_stream *xdr, | |||
1312 | *p = cpu_to_be32(args->count); | 1268 | *p = cpu_to_be32(args->count); |
1313 | } | 1269 | } |
1314 | 1270 | ||
1315 | static int nfs3_xdr_enc_readdirplus3args(struct rpc_rqst *req, __be32 *p, | 1271 | static void nfs3_xdr_enc_readdirplus3args(struct rpc_rqst *req, |
1316 | const struct nfs3_readdirargs *args) | 1272 | struct xdr_stream *xdr, |
1273 | const struct nfs3_readdirargs *args) | ||
1317 | { | 1274 | { |
1318 | struct xdr_stream xdr; | 1275 | encode_readdirplus3args(xdr, args); |
1319 | |||
1320 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
1321 | encode_readdirplus3args(&xdr, args); | ||
1322 | prepare_reply_buffer(req, args->pages, 0, | 1276 | prepare_reply_buffer(req, args->pages, 0, |
1323 | args->count, NFS3_readdirres_sz); | 1277 | args->count, NFS3_readdirres_sz); |
1324 | return 0; | ||
1325 | } | 1278 | } |
1326 | 1279 | ||
1327 | /* | 1280 | /* |
@@ -1345,57 +1298,49 @@ static void encode_commit3args(struct xdr_stream *xdr, | |||
1345 | *p = cpu_to_be32(args->count); | 1298 | *p = cpu_to_be32(args->count); |
1346 | } | 1299 | } |
1347 | 1300 | ||
1348 | static int nfs3_xdr_enc_commit3args(struct rpc_rqst *req, __be32 *p, | 1301 | static void nfs3_xdr_enc_commit3args(struct rpc_rqst *req, |
1349 | const struct nfs_writeargs *args) | 1302 | struct xdr_stream *xdr, |
1303 | const struct nfs_writeargs *args) | ||
1350 | { | 1304 | { |
1351 | struct xdr_stream xdr; | 1305 | encode_commit3args(xdr, args); |
1352 | |||
1353 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
1354 | encode_commit3args(&xdr, args); | ||
1355 | return 0; | ||
1356 | } | 1306 | } |
1357 | 1307 | ||
1358 | #ifdef CONFIG_NFS_V3_ACL | 1308 | #ifdef CONFIG_NFS_V3_ACL |
1359 | 1309 | ||
1360 | static int nfs3_xdr_enc_getacl3args(struct rpc_rqst *req, __be32 *p, | 1310 | static void nfs3_xdr_enc_getacl3args(struct rpc_rqst *req, |
1361 | const struct nfs3_getaclargs *args) | 1311 | struct xdr_stream *xdr, |
1312 | const struct nfs3_getaclargs *args) | ||
1362 | { | 1313 | { |
1363 | struct xdr_stream xdr; | 1314 | encode_nfs_fh3(xdr, args->fh); |
1364 | 1315 | encode_uint32(xdr, args->mask); | |
1365 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | ||
1366 | encode_nfs_fh3(&xdr, args->fh); | ||
1367 | encode_uint32(&xdr, args->mask); | ||
1368 | if (args->mask & (NFS_ACL | NFS_DFACL)) | 1316 | if (args->mask & (NFS_ACL | NFS_DFACL)) |
1369 | prepare_reply_buffer(req, args->pages, 0, | 1317 | prepare_reply_buffer(req, args->pages, 0, |
1370 | NFSACL_MAXPAGES << PAGE_SHIFT, | 1318 | NFSACL_MAXPAGES << PAGE_SHIFT, |
1371 | ACL3_getaclres_sz); | 1319 | ACL3_getaclres_sz); |
1372 | return 0; | ||
1373 | } | 1320 | } |
1374 | 1321 | ||
1375 | static int nfs3_xdr_enc_setacl3args(struct rpc_rqst *req, __be32 *p, | 1322 | static void nfs3_xdr_enc_setacl3args(struct rpc_rqst *req, |
1376 | const struct nfs3_setaclargs *args) | 1323 | struct xdr_stream *xdr, |
1324 | const struct nfs3_setaclargs *args) | ||
1377 | { | 1325 | { |
1378 | struct xdr_stream xdr; | ||
1379 | unsigned int base; | 1326 | unsigned int base; |
1380 | int error; | 1327 | int error; |
1381 | 1328 | ||
1382 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1329 | encode_nfs_fh3(xdr, NFS_FH(args->inode)); |
1383 | encode_nfs_fh3(&xdr, NFS_FH(args->inode)); | 1330 | encode_uint32(xdr, args->mask); |
1384 | encode_uint32(&xdr, args->mask); | ||
1385 | if (args->npages != 0) | 1331 | if (args->npages != 0) |
1386 | xdr_write_pages(&xdr, args->pages, 0, args->len); | 1332 | xdr_write_pages(xdr, args->pages, 0, args->len); |
1387 | 1333 | ||
1388 | base = req->rq_slen; | 1334 | base = req->rq_slen; |
1389 | error = nfsacl_encode(xdr.buf, base, args->inode, | 1335 | error = nfsacl_encode(xdr->buf, base, args->inode, |
1390 | (args->mask & NFS_ACL) ? | 1336 | (args->mask & NFS_ACL) ? |
1391 | args->acl_access : NULL, 1, 0); | 1337 | args->acl_access : NULL, 1, 0); |
1392 | BUG_ON(error < 0); | 1338 | BUG_ON(error < 0); |
1393 | error = nfsacl_encode(xdr.buf, base + error, args->inode, | 1339 | error = nfsacl_encode(xdr->buf, base + error, args->inode, |
1394 | (args->mask & NFS_DFACL) ? | 1340 | (args->mask & NFS_DFACL) ? |
1395 | args->acl_default : NULL, 1, | 1341 | args->acl_default : NULL, 1, |
1396 | NFS_ACL_DEFAULT); | 1342 | NFS_ACL_DEFAULT); |
1397 | BUG_ON(error < 0); | 1343 | BUG_ON(error < 0); |
1398 | return 0; | ||
1399 | } | 1344 | } |
1400 | 1345 | ||
1401 | #endif /* CONFIG_NFS_V3_ACL */ | 1346 | #endif /* CONFIG_NFS_V3_ACL */ |
@@ -2506,7 +2451,7 @@ out_default: | |||
2506 | #define PROC(proc, argtype, restype, timer) \ | 2451 | #define PROC(proc, argtype, restype, timer) \ |
2507 | [NFS3PROC_##proc] = { \ | 2452 | [NFS3PROC_##proc] = { \ |
2508 | .p_proc = NFS3PROC_##proc, \ | 2453 | .p_proc = NFS3PROC_##proc, \ |
2509 | .p_encode = (kxdrproc_t)nfs3_xdr_enc_##argtype##3args, \ | 2454 | .p_encode = (kxdreproc_t)nfs3_xdr_enc_##argtype##3args, \ |
2510 | .p_decode = (kxdrproc_t)nfs3_xdr_dec_##restype##3res, \ | 2455 | .p_decode = (kxdrproc_t)nfs3_xdr_dec_##restype##3res, \ |
2511 | .p_arglen = NFS3_##argtype##args_sz, \ | 2456 | .p_arglen = NFS3_##argtype##args_sz, \ |
2512 | .p_replen = NFS3_##restype##res_sz, \ | 2457 | .p_replen = NFS3_##restype##res_sz, \ |
@@ -2549,7 +2494,7 @@ struct rpc_version nfs_version3 = { | |||
2549 | static struct rpc_procinfo nfs3_acl_procedures[] = { | 2494 | static struct rpc_procinfo nfs3_acl_procedures[] = { |
2550 | [ACLPROC3_GETACL] = { | 2495 | [ACLPROC3_GETACL] = { |
2551 | .p_proc = ACLPROC3_GETACL, | 2496 | .p_proc = ACLPROC3_GETACL, |
2552 | .p_encode = (kxdrproc_t)nfs3_xdr_enc_getacl3args, | 2497 | .p_encode = (kxdreproc_t)nfs3_xdr_enc_getacl3args, |
2553 | .p_decode = (kxdrproc_t)nfs3_xdr_dec_getacl3res, | 2498 | .p_decode = (kxdrproc_t)nfs3_xdr_dec_getacl3res, |
2554 | .p_arglen = ACL3_getaclargs_sz, | 2499 | .p_arglen = ACL3_getaclargs_sz, |
2555 | .p_replen = ACL3_getaclres_sz, | 2500 | .p_replen = ACL3_getaclres_sz, |
@@ -2558,7 +2503,7 @@ static struct rpc_procinfo nfs3_acl_procedures[] = { | |||
2558 | }, | 2503 | }, |
2559 | [ACLPROC3_SETACL] = { | 2504 | [ACLPROC3_SETACL] = { |
2560 | .p_proc = ACLPROC3_SETACL, | 2505 | .p_proc = ACLPROC3_SETACL, |
2561 | .p_encode = (kxdrproc_t)nfs3_xdr_enc_setacl3args, | 2506 | .p_encode = (kxdreproc_t)nfs3_xdr_enc_setacl3args, |
2562 | .p_decode = (kxdrproc_t)nfs3_xdr_dec_setacl3res, | 2507 | .p_decode = (kxdrproc_t)nfs3_xdr_dec_setacl3res, |
2563 | .p_arglen = ACL3_setaclargs_sz, | 2508 | .p_arglen = ACL3_setaclargs_sz, |
2564 | .p_replen = ACL3_setaclres_sz, | 2509 | .p_replen = ACL3_setaclres_sz, |
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index a15fe99fea86..6ec38b3e4a3d 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -1510,7 +1510,7 @@ encode_restorefh(struct xdr_stream *xdr, struct compound_hdr *hdr) | |||
1510 | hdr->replen += decode_restorefh_maxsz; | 1510 | hdr->replen += decode_restorefh_maxsz; |
1511 | } | 1511 | } |
1512 | 1512 | ||
1513 | static int | 1513 | static void |
1514 | encode_setacl(struct xdr_stream *xdr, struct nfs_setaclargs *arg, struct compound_hdr *hdr) | 1514 | encode_setacl(struct xdr_stream *xdr, struct nfs_setaclargs *arg, struct compound_hdr *hdr) |
1515 | { | 1515 | { |
1516 | __be32 *p; | 1516 | __be32 *p; |
@@ -1521,14 +1521,12 @@ encode_setacl(struct xdr_stream *xdr, struct nfs_setaclargs *arg, struct compoun | |||
1521 | p = reserve_space(xdr, 2*4); | 1521 | p = reserve_space(xdr, 2*4); |
1522 | *p++ = cpu_to_be32(1); | 1522 | *p++ = cpu_to_be32(1); |
1523 | *p = cpu_to_be32(FATTR4_WORD0_ACL); | 1523 | *p = cpu_to_be32(FATTR4_WORD0_ACL); |
1524 | if (arg->acl_len % 4) | 1524 | BUG_ON(arg->acl_len % 4); |
1525 | return -EINVAL; | ||
1526 | p = reserve_space(xdr, 4); | 1525 | p = reserve_space(xdr, 4); |
1527 | *p = cpu_to_be32(arg->acl_len); | 1526 | *p = cpu_to_be32(arg->acl_len); |
1528 | xdr_write_pages(xdr, arg->acl_pages, arg->acl_pgbase, arg->acl_len); | 1527 | xdr_write_pages(xdr, arg->acl_pages, arg->acl_pgbase, arg->acl_len); |
1529 | hdr->nops++; | 1528 | hdr->nops++; |
1530 | hdr->replen += decode_setacl_maxsz; | 1529 | hdr->replen += decode_setacl_maxsz; |
1531 | return 0; | ||
1532 | } | 1530 | } |
1533 | 1531 | ||
1534 | static void | 1532 | static void |
@@ -1833,393 +1831,362 @@ static u32 nfs4_xdr_minorversion(const struct nfs4_sequence_args *args) | |||
1833 | /* | 1831 | /* |
1834 | * Encode an ACCESS request | 1832 | * Encode an ACCESS request |
1835 | */ | 1833 | */ |
1836 | static int nfs4_xdr_enc_access(struct rpc_rqst *req, __be32 *p, const struct nfs4_accessargs *args) | 1834 | static void nfs4_xdr_enc_access(struct rpc_rqst *req, struct xdr_stream *xdr, |
1835 | const struct nfs4_accessargs *args) | ||
1837 | { | 1836 | { |
1838 | struct xdr_stream xdr; | ||
1839 | struct compound_hdr hdr = { | 1837 | struct compound_hdr hdr = { |
1840 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 1838 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
1841 | }; | 1839 | }; |
1842 | 1840 | ||
1843 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1841 | encode_compound_hdr(xdr, req, &hdr); |
1844 | encode_compound_hdr(&xdr, req, &hdr); | 1842 | encode_sequence(xdr, &args->seq_args, &hdr); |
1845 | encode_sequence(&xdr, &args->seq_args, &hdr); | 1843 | encode_putfh(xdr, args->fh, &hdr); |
1846 | encode_putfh(&xdr, args->fh, &hdr); | 1844 | encode_access(xdr, args->access, &hdr); |
1847 | encode_access(&xdr, args->access, &hdr); | 1845 | encode_getfattr(xdr, args->bitmask, &hdr); |
1848 | encode_getfattr(&xdr, args->bitmask, &hdr); | ||
1849 | encode_nops(&hdr); | 1846 | encode_nops(&hdr); |
1850 | return 0; | ||
1851 | } | 1847 | } |
1852 | 1848 | ||
1853 | /* | 1849 | /* |
1854 | * Encode LOOKUP request | 1850 | * Encode LOOKUP request |
1855 | */ | 1851 | */ |
1856 | static int nfs4_xdr_enc_lookup(struct rpc_rqst *req, __be32 *p, const struct nfs4_lookup_arg *args) | 1852 | static void nfs4_xdr_enc_lookup(struct rpc_rqst *req, struct xdr_stream *xdr, |
1853 | const struct nfs4_lookup_arg *args) | ||
1857 | { | 1854 | { |
1858 | struct xdr_stream xdr; | ||
1859 | struct compound_hdr hdr = { | 1855 | struct compound_hdr hdr = { |
1860 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 1856 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
1861 | }; | 1857 | }; |
1862 | 1858 | ||
1863 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1859 | encode_compound_hdr(xdr, req, &hdr); |
1864 | encode_compound_hdr(&xdr, req, &hdr); | 1860 | encode_sequence(xdr, &args->seq_args, &hdr); |
1865 | encode_sequence(&xdr, &args->seq_args, &hdr); | 1861 | encode_putfh(xdr, args->dir_fh, &hdr); |
1866 | encode_putfh(&xdr, args->dir_fh, &hdr); | 1862 | encode_lookup(xdr, args->name, &hdr); |
1867 | encode_lookup(&xdr, args->name, &hdr); | 1863 | encode_getfh(xdr, &hdr); |
1868 | encode_getfh(&xdr, &hdr); | 1864 | encode_getfattr(xdr, args->bitmask, &hdr); |
1869 | encode_getfattr(&xdr, args->bitmask, &hdr); | ||
1870 | encode_nops(&hdr); | 1865 | encode_nops(&hdr); |
1871 | return 0; | ||
1872 | } | 1866 | } |
1873 | 1867 | ||
1874 | /* | 1868 | /* |
1875 | * Encode LOOKUP_ROOT request | 1869 | * Encode LOOKUP_ROOT request |
1876 | */ | 1870 | */ |
1877 | static int nfs4_xdr_enc_lookup_root(struct rpc_rqst *req, __be32 *p, const struct nfs4_lookup_root_arg *args) | 1871 | static void nfs4_xdr_enc_lookup_root(struct rpc_rqst *req, |
1872 | struct xdr_stream *xdr, | ||
1873 | const struct nfs4_lookup_root_arg *args) | ||
1878 | { | 1874 | { |
1879 | struct xdr_stream xdr; | ||
1880 | struct compound_hdr hdr = { | 1875 | struct compound_hdr hdr = { |
1881 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 1876 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
1882 | }; | 1877 | }; |
1883 | 1878 | ||
1884 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1879 | encode_compound_hdr(xdr, req, &hdr); |
1885 | encode_compound_hdr(&xdr, req, &hdr); | 1880 | encode_sequence(xdr, &args->seq_args, &hdr); |
1886 | encode_sequence(&xdr, &args->seq_args, &hdr); | 1881 | encode_putrootfh(xdr, &hdr); |
1887 | encode_putrootfh(&xdr, &hdr); | 1882 | encode_getfh(xdr, &hdr); |
1888 | encode_getfh(&xdr, &hdr); | 1883 | encode_getfattr(xdr, args->bitmask, &hdr); |
1889 | encode_getfattr(&xdr, args->bitmask, &hdr); | ||
1890 | encode_nops(&hdr); | 1884 | encode_nops(&hdr); |
1891 | return 0; | ||
1892 | } | 1885 | } |
1893 | 1886 | ||
1894 | /* | 1887 | /* |
1895 | * Encode REMOVE request | 1888 | * Encode REMOVE request |
1896 | */ | 1889 | */ |
1897 | static int nfs4_xdr_enc_remove(struct rpc_rqst *req, __be32 *p, const struct nfs_removeargs *args) | 1890 | static void nfs4_xdr_enc_remove(struct rpc_rqst *req, struct xdr_stream *xdr, |
1891 | const struct nfs_removeargs *args) | ||
1898 | { | 1892 | { |
1899 | struct xdr_stream xdr; | ||
1900 | struct compound_hdr hdr = { | 1893 | struct compound_hdr hdr = { |
1901 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 1894 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
1902 | }; | 1895 | }; |
1903 | 1896 | ||
1904 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1897 | encode_compound_hdr(xdr, req, &hdr); |
1905 | encode_compound_hdr(&xdr, req, &hdr); | 1898 | encode_sequence(xdr, &args->seq_args, &hdr); |
1906 | encode_sequence(&xdr, &args->seq_args, &hdr); | 1899 | encode_putfh(xdr, args->fh, &hdr); |
1907 | encode_putfh(&xdr, args->fh, &hdr); | 1900 | encode_remove(xdr, &args->name, &hdr); |
1908 | encode_remove(&xdr, &args->name, &hdr); | 1901 | encode_getfattr(xdr, args->bitmask, &hdr); |
1909 | encode_getfattr(&xdr, args->bitmask, &hdr); | ||
1910 | encode_nops(&hdr); | 1902 | encode_nops(&hdr); |
1911 | return 0; | ||
1912 | } | 1903 | } |
1913 | 1904 | ||
1914 | /* | 1905 | /* |
1915 | * Encode RENAME request | 1906 | * Encode RENAME request |
1916 | */ | 1907 | */ |
1917 | static int nfs4_xdr_enc_rename(struct rpc_rqst *req, __be32 *p, const struct nfs_renameargs *args) | 1908 | static void nfs4_xdr_enc_rename(struct rpc_rqst *req, struct xdr_stream *xdr, |
1909 | const struct nfs_renameargs *args) | ||
1918 | { | 1910 | { |
1919 | struct xdr_stream xdr; | ||
1920 | struct compound_hdr hdr = { | 1911 | struct compound_hdr hdr = { |
1921 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 1912 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
1922 | }; | 1913 | }; |
1923 | 1914 | ||
1924 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1915 | encode_compound_hdr(xdr, req, &hdr); |
1925 | encode_compound_hdr(&xdr, req, &hdr); | 1916 | encode_sequence(xdr, &args->seq_args, &hdr); |
1926 | encode_sequence(&xdr, &args->seq_args, &hdr); | 1917 | encode_putfh(xdr, args->old_dir, &hdr); |
1927 | encode_putfh(&xdr, args->old_dir, &hdr); | 1918 | encode_savefh(xdr, &hdr); |
1928 | encode_savefh(&xdr, &hdr); | 1919 | encode_putfh(xdr, args->new_dir, &hdr); |
1929 | encode_putfh(&xdr, args->new_dir, &hdr); | 1920 | encode_rename(xdr, args->old_name, args->new_name, &hdr); |
1930 | encode_rename(&xdr, args->old_name, args->new_name, &hdr); | 1921 | encode_getfattr(xdr, args->bitmask, &hdr); |
1931 | encode_getfattr(&xdr, args->bitmask, &hdr); | 1922 | encode_restorefh(xdr, &hdr); |
1932 | encode_restorefh(&xdr, &hdr); | 1923 | encode_getfattr(xdr, args->bitmask, &hdr); |
1933 | encode_getfattr(&xdr, args->bitmask, &hdr); | ||
1934 | encode_nops(&hdr); | 1924 | encode_nops(&hdr); |
1935 | return 0; | ||
1936 | } | 1925 | } |
1937 | 1926 | ||
1938 | /* | 1927 | /* |
1939 | * Encode LINK request | 1928 | * Encode LINK request |
1940 | */ | 1929 | */ |
1941 | static int nfs4_xdr_enc_link(struct rpc_rqst *req, __be32 *p, const struct nfs4_link_arg *args) | 1930 | static void nfs4_xdr_enc_link(struct rpc_rqst *req, struct xdr_stream *xdr, |
1931 | const struct nfs4_link_arg *args) | ||
1942 | { | 1932 | { |
1943 | struct xdr_stream xdr; | ||
1944 | struct compound_hdr hdr = { | 1933 | struct compound_hdr hdr = { |
1945 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 1934 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
1946 | }; | 1935 | }; |
1947 | 1936 | ||
1948 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1937 | encode_compound_hdr(xdr, req, &hdr); |
1949 | encode_compound_hdr(&xdr, req, &hdr); | 1938 | encode_sequence(xdr, &args->seq_args, &hdr); |
1950 | encode_sequence(&xdr, &args->seq_args, &hdr); | 1939 | encode_putfh(xdr, args->fh, &hdr); |
1951 | encode_putfh(&xdr, args->fh, &hdr); | 1940 | encode_savefh(xdr, &hdr); |
1952 | encode_savefh(&xdr, &hdr); | 1941 | encode_putfh(xdr, args->dir_fh, &hdr); |
1953 | encode_putfh(&xdr, args->dir_fh, &hdr); | 1942 | encode_link(xdr, args->name, &hdr); |
1954 | encode_link(&xdr, args->name, &hdr); | 1943 | encode_getfattr(xdr, args->bitmask, &hdr); |
1955 | encode_getfattr(&xdr, args->bitmask, &hdr); | 1944 | encode_restorefh(xdr, &hdr); |
1956 | encode_restorefh(&xdr, &hdr); | 1945 | encode_getfattr(xdr, args->bitmask, &hdr); |
1957 | encode_getfattr(&xdr, args->bitmask, &hdr); | ||
1958 | encode_nops(&hdr); | 1946 | encode_nops(&hdr); |
1959 | return 0; | ||
1960 | } | 1947 | } |
1961 | 1948 | ||
1962 | /* | 1949 | /* |
1963 | * Encode CREATE request | 1950 | * Encode CREATE request |
1964 | */ | 1951 | */ |
1965 | static int nfs4_xdr_enc_create(struct rpc_rqst *req, __be32 *p, const struct nfs4_create_arg *args) | 1952 | static void nfs4_xdr_enc_create(struct rpc_rqst *req, struct xdr_stream *xdr, |
1953 | const struct nfs4_create_arg *args) | ||
1966 | { | 1954 | { |
1967 | struct xdr_stream xdr; | ||
1968 | struct compound_hdr hdr = { | 1955 | struct compound_hdr hdr = { |
1969 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 1956 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
1970 | }; | 1957 | }; |
1971 | 1958 | ||
1972 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1959 | encode_compound_hdr(xdr, req, &hdr); |
1973 | encode_compound_hdr(&xdr, req, &hdr); | 1960 | encode_sequence(xdr, &args->seq_args, &hdr); |
1974 | encode_sequence(&xdr, &args->seq_args, &hdr); | 1961 | encode_putfh(xdr, args->dir_fh, &hdr); |
1975 | encode_putfh(&xdr, args->dir_fh, &hdr); | 1962 | encode_savefh(xdr, &hdr); |
1976 | encode_savefh(&xdr, &hdr); | 1963 | encode_create(xdr, args, &hdr); |
1977 | encode_create(&xdr, args, &hdr); | 1964 | encode_getfh(xdr, &hdr); |
1978 | encode_getfh(&xdr, &hdr); | 1965 | encode_getfattr(xdr, args->bitmask, &hdr); |
1979 | encode_getfattr(&xdr, args->bitmask, &hdr); | 1966 | encode_restorefh(xdr, &hdr); |
1980 | encode_restorefh(&xdr, &hdr); | 1967 | encode_getfattr(xdr, args->bitmask, &hdr); |
1981 | encode_getfattr(&xdr, args->bitmask, &hdr); | ||
1982 | encode_nops(&hdr); | 1968 | encode_nops(&hdr); |
1983 | return 0; | ||
1984 | } | 1969 | } |
1985 | 1970 | ||
1986 | /* | 1971 | /* |
1987 | * Encode SYMLINK request | 1972 | * Encode SYMLINK request |
1988 | */ | 1973 | */ |
1989 | static int nfs4_xdr_enc_symlink(struct rpc_rqst *req, __be32 *p, const struct nfs4_create_arg *args) | 1974 | static void nfs4_xdr_enc_symlink(struct rpc_rqst *req, struct xdr_stream *xdr, |
1975 | const struct nfs4_create_arg *args) | ||
1990 | { | 1976 | { |
1991 | return nfs4_xdr_enc_create(req, p, args); | 1977 | nfs4_xdr_enc_create(req, xdr, args); |
1992 | } | 1978 | } |
1993 | 1979 | ||
1994 | /* | 1980 | /* |
1995 | * Encode GETATTR request | 1981 | * Encode GETATTR request |
1996 | */ | 1982 | */ |
1997 | static int nfs4_xdr_enc_getattr(struct rpc_rqst *req, __be32 *p, const struct nfs4_getattr_arg *args) | 1983 | static void nfs4_xdr_enc_getattr(struct rpc_rqst *req, struct xdr_stream *xdr, |
1984 | const struct nfs4_getattr_arg *args) | ||
1998 | { | 1985 | { |
1999 | struct xdr_stream xdr; | ||
2000 | struct compound_hdr hdr = { | 1986 | struct compound_hdr hdr = { |
2001 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 1987 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
2002 | }; | 1988 | }; |
2003 | 1989 | ||
2004 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 1990 | encode_compound_hdr(xdr, req, &hdr); |
2005 | encode_compound_hdr(&xdr, req, &hdr); | 1991 | encode_sequence(xdr, &args->seq_args, &hdr); |
2006 | encode_sequence(&xdr, &args->seq_args, &hdr); | 1992 | encode_putfh(xdr, args->fh, &hdr); |
2007 | encode_putfh(&xdr, args->fh, &hdr); | 1993 | encode_getfattr(xdr, args->bitmask, &hdr); |
2008 | encode_getfattr(&xdr, args->bitmask, &hdr); | ||
2009 | encode_nops(&hdr); | 1994 | encode_nops(&hdr); |
2010 | return 0; | ||
2011 | } | 1995 | } |
2012 | 1996 | ||
2013 | /* | 1997 | /* |
2014 | * Encode a CLOSE request | 1998 | * Encode a CLOSE request |
2015 | */ | 1999 | */ |
2016 | static int nfs4_xdr_enc_close(struct rpc_rqst *req, __be32 *p, struct nfs_closeargs *args) | 2000 | static void nfs4_xdr_enc_close(struct rpc_rqst *req, struct xdr_stream *xdr, |
2001 | struct nfs_closeargs *args) | ||
2017 | { | 2002 | { |
2018 | struct xdr_stream xdr; | ||
2019 | struct compound_hdr hdr = { | 2003 | struct compound_hdr hdr = { |
2020 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 2004 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
2021 | }; | 2005 | }; |
2022 | 2006 | ||
2023 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2007 | encode_compound_hdr(xdr, req, &hdr); |
2024 | encode_compound_hdr(&xdr, req, &hdr); | 2008 | encode_sequence(xdr, &args->seq_args, &hdr); |
2025 | encode_sequence(&xdr, &args->seq_args, &hdr); | 2009 | encode_putfh(xdr, args->fh, &hdr); |
2026 | encode_putfh(&xdr, args->fh, &hdr); | 2010 | encode_close(xdr, args, &hdr); |
2027 | encode_close(&xdr, args, &hdr); | 2011 | encode_getfattr(xdr, args->bitmask, &hdr); |
2028 | encode_getfattr(&xdr, args->bitmask, &hdr); | ||
2029 | encode_nops(&hdr); | 2012 | encode_nops(&hdr); |
2030 | return 0; | ||
2031 | } | 2013 | } |
2032 | 2014 | ||
2033 | /* | 2015 | /* |
2034 | * Encode an OPEN request | 2016 | * Encode an OPEN request |
2035 | */ | 2017 | */ |
2036 | static int nfs4_xdr_enc_open(struct rpc_rqst *req, __be32 *p, struct nfs_openargs *args) | 2018 | static void nfs4_xdr_enc_open(struct rpc_rqst *req, struct xdr_stream *xdr, |
2019 | struct nfs_openargs *args) | ||
2037 | { | 2020 | { |
2038 | struct xdr_stream xdr; | ||
2039 | struct compound_hdr hdr = { | 2021 | struct compound_hdr hdr = { |
2040 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 2022 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
2041 | }; | 2023 | }; |
2042 | 2024 | ||
2043 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2025 | encode_compound_hdr(xdr, req, &hdr); |
2044 | encode_compound_hdr(&xdr, req, &hdr); | 2026 | encode_sequence(xdr, &args->seq_args, &hdr); |
2045 | encode_sequence(&xdr, &args->seq_args, &hdr); | 2027 | encode_putfh(xdr, args->fh, &hdr); |
2046 | encode_putfh(&xdr, args->fh, &hdr); | 2028 | encode_savefh(xdr, &hdr); |
2047 | encode_savefh(&xdr, &hdr); | 2029 | encode_open(xdr, args, &hdr); |
2048 | encode_open(&xdr, args, &hdr); | 2030 | encode_getfh(xdr, &hdr); |
2049 | encode_getfh(&xdr, &hdr); | 2031 | encode_getfattr(xdr, args->bitmask, &hdr); |
2050 | encode_getfattr(&xdr, args->bitmask, &hdr); | 2032 | encode_restorefh(xdr, &hdr); |
2051 | encode_restorefh(&xdr, &hdr); | 2033 | encode_getfattr(xdr, args->bitmask, &hdr); |
2052 | encode_getfattr(&xdr, args->bitmask, &hdr); | ||
2053 | encode_nops(&hdr); | 2034 | encode_nops(&hdr); |
2054 | return 0; | ||
2055 | } | 2035 | } |
2056 | 2036 | ||
2057 | /* | 2037 | /* |
2058 | * Encode an OPEN_CONFIRM request | 2038 | * Encode an OPEN_CONFIRM request |
2059 | */ | 2039 | */ |
2060 | static int nfs4_xdr_enc_open_confirm(struct rpc_rqst *req, __be32 *p, struct nfs_open_confirmargs *args) | 2040 | static void nfs4_xdr_enc_open_confirm(struct rpc_rqst *req, |
2041 | struct xdr_stream *xdr, | ||
2042 | struct nfs_open_confirmargs *args) | ||
2061 | { | 2043 | { |
2062 | struct xdr_stream xdr; | ||
2063 | struct compound_hdr hdr = { | 2044 | struct compound_hdr hdr = { |
2064 | .nops = 0, | 2045 | .nops = 0, |
2065 | }; | 2046 | }; |
2066 | 2047 | ||
2067 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2048 | encode_compound_hdr(xdr, req, &hdr); |
2068 | encode_compound_hdr(&xdr, req, &hdr); | 2049 | encode_putfh(xdr, args->fh, &hdr); |
2069 | encode_putfh(&xdr, args->fh, &hdr); | 2050 | encode_open_confirm(xdr, args, &hdr); |
2070 | encode_open_confirm(&xdr, args, &hdr); | ||
2071 | encode_nops(&hdr); | 2051 | encode_nops(&hdr); |
2072 | return 0; | ||
2073 | } | 2052 | } |
2074 | 2053 | ||
2075 | /* | 2054 | /* |
2076 | * Encode an OPEN request with no attributes. | 2055 | * Encode an OPEN request with no attributes. |
2077 | */ | 2056 | */ |
2078 | static int nfs4_xdr_enc_open_noattr(struct rpc_rqst *req, __be32 *p, struct nfs_openargs *args) | 2057 | static void nfs4_xdr_enc_open_noattr(struct rpc_rqst *req, |
2058 | struct xdr_stream *xdr, | ||
2059 | struct nfs_openargs *args) | ||
2079 | { | 2060 | { |
2080 | struct xdr_stream xdr; | ||
2081 | struct compound_hdr hdr = { | 2061 | struct compound_hdr hdr = { |
2082 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 2062 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
2083 | }; | 2063 | }; |
2084 | 2064 | ||
2085 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2065 | encode_compound_hdr(xdr, req, &hdr); |
2086 | encode_compound_hdr(&xdr, req, &hdr); | 2066 | encode_sequence(xdr, &args->seq_args, &hdr); |
2087 | encode_sequence(&xdr, &args->seq_args, &hdr); | 2067 | encode_putfh(xdr, args->fh, &hdr); |
2088 | encode_putfh(&xdr, args->fh, &hdr); | 2068 | encode_open(xdr, args, &hdr); |
2089 | encode_open(&xdr, args, &hdr); | 2069 | encode_getfattr(xdr, args->bitmask, &hdr); |
2090 | encode_getfattr(&xdr, args->bitmask, &hdr); | ||
2091 | encode_nops(&hdr); | 2070 | encode_nops(&hdr); |
2092 | return 0; | ||
2093 | } | 2071 | } |
2094 | 2072 | ||
2095 | /* | 2073 | /* |
2096 | * Encode an OPEN_DOWNGRADE request | 2074 | * Encode an OPEN_DOWNGRADE request |
2097 | */ | 2075 | */ |
2098 | static int nfs4_xdr_enc_open_downgrade(struct rpc_rqst *req, __be32 *p, struct nfs_closeargs *args) | 2076 | static void nfs4_xdr_enc_open_downgrade(struct rpc_rqst *req, |
2077 | struct xdr_stream *xdr, | ||
2078 | struct nfs_closeargs *args) | ||
2099 | { | 2079 | { |
2100 | struct xdr_stream xdr; | ||
2101 | struct compound_hdr hdr = { | 2080 | struct compound_hdr hdr = { |
2102 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 2081 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
2103 | }; | 2082 | }; |
2104 | 2083 | ||
2105 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2084 | encode_compound_hdr(xdr, req, &hdr); |
2106 | encode_compound_hdr(&xdr, req, &hdr); | 2085 | encode_sequence(xdr, &args->seq_args, &hdr); |
2107 | encode_sequence(&xdr, &args->seq_args, &hdr); | 2086 | encode_putfh(xdr, args->fh, &hdr); |
2108 | encode_putfh(&xdr, args->fh, &hdr); | 2087 | encode_open_downgrade(xdr, args, &hdr); |
2109 | encode_open_downgrade(&xdr, args, &hdr); | 2088 | encode_getfattr(xdr, args->bitmask, &hdr); |
2110 | encode_getfattr(&xdr, args->bitmask, &hdr); | ||
2111 | encode_nops(&hdr); | 2089 | encode_nops(&hdr); |
2112 | return 0; | ||
2113 | } | 2090 | } |
2114 | 2091 | ||
2115 | /* | 2092 | /* |
2116 | * Encode a LOCK request | 2093 | * Encode a LOCK request |
2117 | */ | 2094 | */ |
2118 | static int nfs4_xdr_enc_lock(struct rpc_rqst *req, __be32 *p, struct nfs_lock_args *args) | 2095 | static void nfs4_xdr_enc_lock(struct rpc_rqst *req, struct xdr_stream *xdr, |
2096 | struct nfs_lock_args *args) | ||
2119 | { | 2097 | { |
2120 | struct xdr_stream xdr; | ||
2121 | struct compound_hdr hdr = { | 2098 | struct compound_hdr hdr = { |
2122 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 2099 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
2123 | }; | 2100 | }; |
2124 | 2101 | ||
2125 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2102 | encode_compound_hdr(xdr, req, &hdr); |
2126 | encode_compound_hdr(&xdr, req, &hdr); | 2103 | encode_sequence(xdr, &args->seq_args, &hdr); |
2127 | encode_sequence(&xdr, &args->seq_args, &hdr); | 2104 | encode_putfh(xdr, args->fh, &hdr); |
2128 | encode_putfh(&xdr, args->fh, &hdr); | 2105 | encode_lock(xdr, args, &hdr); |
2129 | encode_lock(&xdr, args, &hdr); | ||
2130 | encode_nops(&hdr); | 2106 | encode_nops(&hdr); |
2131 | return 0; | ||
2132 | } | 2107 | } |
2133 | 2108 | ||
2134 | /* | 2109 | /* |
2135 | * Encode a LOCKT request | 2110 | * Encode a LOCKT request |
2136 | */ | 2111 | */ |
2137 | static int nfs4_xdr_enc_lockt(struct rpc_rqst *req, __be32 *p, struct nfs_lockt_args *args) | 2112 | static void nfs4_xdr_enc_lockt(struct rpc_rqst *req, struct xdr_stream *xdr, |
2113 | struct nfs_lockt_args *args) | ||
2138 | { | 2114 | { |
2139 | struct xdr_stream xdr; | ||
2140 | struct compound_hdr hdr = { | 2115 | struct compound_hdr hdr = { |
2141 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 2116 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
2142 | }; | 2117 | }; |
2143 | 2118 | ||
2144 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2119 | encode_compound_hdr(xdr, req, &hdr); |
2145 | encode_compound_hdr(&xdr, req, &hdr); | 2120 | encode_sequence(xdr, &args->seq_args, &hdr); |
2146 | encode_sequence(&xdr, &args->seq_args, &hdr); | 2121 | encode_putfh(xdr, args->fh, &hdr); |
2147 | encode_putfh(&xdr, args->fh, &hdr); | 2122 | encode_lockt(xdr, args, &hdr); |
2148 | encode_lockt(&xdr, args, &hdr); | ||
2149 | encode_nops(&hdr); | 2123 | encode_nops(&hdr); |
2150 | return 0; | ||
2151 | } | 2124 | } |
2152 | 2125 | ||
2153 | /* | 2126 | /* |
2154 | * Encode a LOCKU request | 2127 | * Encode a LOCKU request |
2155 | */ | 2128 | */ |
2156 | static int nfs4_xdr_enc_locku(struct rpc_rqst *req, __be32 *p, struct nfs_locku_args *args) | 2129 | static void nfs4_xdr_enc_locku(struct rpc_rqst *req, struct xdr_stream *xdr, |
2130 | struct nfs_locku_args *args) | ||
2157 | { | 2131 | { |
2158 | struct xdr_stream xdr; | ||
2159 | struct compound_hdr hdr = { | 2132 | struct compound_hdr hdr = { |
2160 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 2133 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
2161 | }; | 2134 | }; |
2162 | 2135 | ||
2163 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2136 | encode_compound_hdr(xdr, req, &hdr); |
2164 | encode_compound_hdr(&xdr, req, &hdr); | 2137 | encode_sequence(xdr, &args->seq_args, &hdr); |
2165 | encode_sequence(&xdr, &args->seq_args, &hdr); | 2138 | encode_putfh(xdr, args->fh, &hdr); |
2166 | encode_putfh(&xdr, args->fh, &hdr); | 2139 | encode_locku(xdr, args, &hdr); |
2167 | encode_locku(&xdr, args, &hdr); | ||
2168 | encode_nops(&hdr); | 2140 | encode_nops(&hdr); |
2169 | return 0; | ||
2170 | } | 2141 | } |
2171 | 2142 | ||
2172 | static int nfs4_xdr_enc_release_lockowner(struct rpc_rqst *req, __be32 *p, struct nfs_release_lockowner_args *args) | 2143 | static void nfs4_xdr_enc_release_lockowner(struct rpc_rqst *req, |
2144 | struct xdr_stream *xdr, | ||
2145 | struct nfs_release_lockowner_args *args) | ||
2173 | { | 2146 | { |
2174 | struct xdr_stream xdr; | ||
2175 | struct compound_hdr hdr = { | 2147 | struct compound_hdr hdr = { |
2176 | .minorversion = 0, | 2148 | .minorversion = 0, |
2177 | }; | 2149 | }; |
2178 | 2150 | ||
2179 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2151 | encode_compound_hdr(xdr, req, &hdr); |
2180 | encode_compound_hdr(&xdr, req, &hdr); | 2152 | encode_release_lockowner(xdr, &args->lock_owner, &hdr); |
2181 | encode_release_lockowner(&xdr, &args->lock_owner, &hdr); | ||
2182 | encode_nops(&hdr); | 2153 | encode_nops(&hdr); |
2183 | return 0; | ||
2184 | } | 2154 | } |
2185 | 2155 | ||
2186 | /* | 2156 | /* |
2187 | * Encode a READLINK request | 2157 | * Encode a READLINK request |
2188 | */ | 2158 | */ |
2189 | static int nfs4_xdr_enc_readlink(struct rpc_rqst *req, __be32 *p, const struct nfs4_readlink *args) | 2159 | static void nfs4_xdr_enc_readlink(struct rpc_rqst *req, struct xdr_stream *xdr, |
2160 | const struct nfs4_readlink *args) | ||
2190 | { | 2161 | { |
2191 | struct xdr_stream xdr; | ||
2192 | struct compound_hdr hdr = { | 2162 | struct compound_hdr hdr = { |
2193 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 2163 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
2194 | }; | 2164 | }; |
2195 | 2165 | ||
2196 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2166 | encode_compound_hdr(xdr, req, &hdr); |
2197 | encode_compound_hdr(&xdr, req, &hdr); | 2167 | encode_sequence(xdr, &args->seq_args, &hdr); |
2198 | encode_sequence(&xdr, &args->seq_args, &hdr); | 2168 | encode_putfh(xdr, args->fh, &hdr); |
2199 | encode_putfh(&xdr, args->fh, &hdr); | 2169 | encode_readlink(xdr, args, req, &hdr); |
2200 | encode_readlink(&xdr, args, req, &hdr); | ||
2201 | 2170 | ||
2202 | xdr_inline_pages(&req->rq_rcv_buf, hdr.replen << 2, args->pages, | 2171 | xdr_inline_pages(&req->rq_rcv_buf, hdr.replen << 2, args->pages, |
2203 | args->pgbase, args->pglen); | 2172 | args->pgbase, args->pglen); |
2204 | encode_nops(&hdr); | 2173 | encode_nops(&hdr); |
2205 | return 0; | ||
2206 | } | 2174 | } |
2207 | 2175 | ||
2208 | /* | 2176 | /* |
2209 | * Encode a READDIR request | 2177 | * Encode a READDIR request |
2210 | */ | 2178 | */ |
2211 | static int nfs4_xdr_enc_readdir(struct rpc_rqst *req, __be32 *p, const struct nfs4_readdir_arg *args) | 2179 | static void nfs4_xdr_enc_readdir(struct rpc_rqst *req, struct xdr_stream *xdr, |
2180 | const struct nfs4_readdir_arg *args) | ||
2212 | { | 2181 | { |
2213 | struct xdr_stream xdr; | ||
2214 | struct compound_hdr hdr = { | 2182 | struct compound_hdr hdr = { |
2215 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 2183 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
2216 | }; | 2184 | }; |
2217 | 2185 | ||
2218 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2186 | encode_compound_hdr(xdr, req, &hdr); |
2219 | encode_compound_hdr(&xdr, req, &hdr); | 2187 | encode_sequence(xdr, &args->seq_args, &hdr); |
2220 | encode_sequence(&xdr, &args->seq_args, &hdr); | 2188 | encode_putfh(xdr, args->fh, &hdr); |
2221 | encode_putfh(&xdr, args->fh, &hdr); | 2189 | encode_readdir(xdr, args, req, &hdr); |
2222 | encode_readdir(&xdr, args, req, &hdr); | ||
2223 | 2190 | ||
2224 | xdr_inline_pages(&req->rq_rcv_buf, hdr.replen << 2, args->pages, | 2191 | xdr_inline_pages(&req->rq_rcv_buf, hdr.replen << 2, args->pages, |
2225 | args->pgbase, args->count); | 2192 | args->pgbase, args->count); |
@@ -2227,428 +2194,387 @@ static int nfs4_xdr_enc_readdir(struct rpc_rqst *req, __be32 *p, const struct nf | |||
2227 | __func__, hdr.replen << 2, args->pages, | 2194 | __func__, hdr.replen << 2, args->pages, |
2228 | args->pgbase, args->count); | 2195 | args->pgbase, args->count); |
2229 | encode_nops(&hdr); | 2196 | encode_nops(&hdr); |
2230 | return 0; | ||
2231 | } | 2197 | } |
2232 | 2198 | ||
2233 | /* | 2199 | /* |
2234 | * Encode a READ request | 2200 | * Encode a READ request |
2235 | */ | 2201 | */ |
2236 | static int nfs4_xdr_enc_read(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args) | 2202 | static void nfs4_xdr_enc_read(struct rpc_rqst *req, struct xdr_stream *xdr, |
2203 | struct nfs_readargs *args) | ||
2237 | { | 2204 | { |
2238 | struct xdr_stream xdr; | ||
2239 | struct compound_hdr hdr = { | 2205 | struct compound_hdr hdr = { |
2240 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 2206 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
2241 | }; | 2207 | }; |
2242 | 2208 | ||
2243 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2209 | encode_compound_hdr(xdr, req, &hdr); |
2244 | encode_compound_hdr(&xdr, req, &hdr); | 2210 | encode_sequence(xdr, &args->seq_args, &hdr); |
2245 | encode_sequence(&xdr, &args->seq_args, &hdr); | 2211 | encode_putfh(xdr, args->fh, &hdr); |
2246 | encode_putfh(&xdr, args->fh, &hdr); | 2212 | encode_read(xdr, args, &hdr); |
2247 | encode_read(&xdr, args, &hdr); | ||
2248 | 2213 | ||
2249 | xdr_inline_pages(&req->rq_rcv_buf, hdr.replen << 2, | 2214 | xdr_inline_pages(&req->rq_rcv_buf, hdr.replen << 2, |
2250 | args->pages, args->pgbase, args->count); | 2215 | args->pages, args->pgbase, args->count); |
2251 | req->rq_rcv_buf.flags |= XDRBUF_READ; | 2216 | req->rq_rcv_buf.flags |= XDRBUF_READ; |
2252 | encode_nops(&hdr); | 2217 | encode_nops(&hdr); |
2253 | return 0; | ||
2254 | } | 2218 | } |
2255 | 2219 | ||
2256 | /* | 2220 | /* |
2257 | * Encode an SETATTR request | 2221 | * Encode an SETATTR request |
2258 | */ | 2222 | */ |
2259 | static int nfs4_xdr_enc_setattr(struct rpc_rqst *req, __be32 *p, struct nfs_setattrargs *args) | 2223 | static void nfs4_xdr_enc_setattr(struct rpc_rqst *req, struct xdr_stream *xdr, |
2224 | struct nfs_setattrargs *args) | ||
2260 | { | 2225 | { |
2261 | struct xdr_stream xdr; | ||
2262 | struct compound_hdr hdr = { | 2226 | struct compound_hdr hdr = { |
2263 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 2227 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
2264 | }; | 2228 | }; |
2265 | 2229 | ||
2266 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2230 | encode_compound_hdr(xdr, req, &hdr); |
2267 | encode_compound_hdr(&xdr, req, &hdr); | 2231 | encode_sequence(xdr, &args->seq_args, &hdr); |
2268 | encode_sequence(&xdr, &args->seq_args, &hdr); | 2232 | encode_putfh(xdr, args->fh, &hdr); |
2269 | encode_putfh(&xdr, args->fh, &hdr); | 2233 | encode_setattr(xdr, args, args->server, &hdr); |
2270 | encode_setattr(&xdr, args, args->server, &hdr); | 2234 | encode_getfattr(xdr, args->bitmask, &hdr); |
2271 | encode_getfattr(&xdr, args->bitmask, &hdr); | ||
2272 | encode_nops(&hdr); | 2235 | encode_nops(&hdr); |
2273 | return 0; | ||
2274 | } | 2236 | } |
2275 | 2237 | ||
2276 | /* | 2238 | /* |
2277 | * Encode a GETACL request | 2239 | * Encode a GETACL request |
2278 | */ | 2240 | */ |
2279 | static int | 2241 | static void nfs4_xdr_enc_getacl(struct rpc_rqst *req, struct xdr_stream *xdr, |
2280 | nfs4_xdr_enc_getacl(struct rpc_rqst *req, __be32 *p, | 2242 | struct nfs_getaclargs *args) |
2281 | struct nfs_getaclargs *args) | ||
2282 | { | 2243 | { |
2283 | struct xdr_stream xdr; | ||
2284 | struct compound_hdr hdr = { | 2244 | struct compound_hdr hdr = { |
2285 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 2245 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
2286 | }; | 2246 | }; |
2287 | uint32_t replen; | 2247 | uint32_t replen; |
2288 | 2248 | ||
2289 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2249 | encode_compound_hdr(xdr, req, &hdr); |
2290 | encode_compound_hdr(&xdr, req, &hdr); | 2250 | encode_sequence(xdr, &args->seq_args, &hdr); |
2291 | encode_sequence(&xdr, &args->seq_args, &hdr); | 2251 | encode_putfh(xdr, args->fh, &hdr); |
2292 | encode_putfh(&xdr, args->fh, &hdr); | ||
2293 | replen = hdr.replen + op_decode_hdr_maxsz + nfs4_fattr_bitmap_maxsz + 1; | 2252 | replen = hdr.replen + op_decode_hdr_maxsz + nfs4_fattr_bitmap_maxsz + 1; |
2294 | encode_getattr_two(&xdr, FATTR4_WORD0_ACL, 0, &hdr); | 2253 | encode_getattr_two(xdr, FATTR4_WORD0_ACL, 0, &hdr); |
2295 | 2254 | ||
2296 | xdr_inline_pages(&req->rq_rcv_buf, replen << 2, | 2255 | xdr_inline_pages(&req->rq_rcv_buf, replen << 2, |
2297 | args->acl_pages, args->acl_pgbase, args->acl_len); | 2256 | args->acl_pages, args->acl_pgbase, args->acl_len); |
2298 | encode_nops(&hdr); | 2257 | encode_nops(&hdr); |
2299 | return 0; | ||
2300 | } | 2258 | } |
2301 | 2259 | ||
2302 | /* | 2260 | /* |
2303 | * Encode a WRITE request | 2261 | * Encode a WRITE request |
2304 | */ | 2262 | */ |
2305 | static int nfs4_xdr_enc_write(struct rpc_rqst *req, __be32 *p, struct nfs_writeargs *args) | 2263 | static void nfs4_xdr_enc_write(struct rpc_rqst *req, struct xdr_stream *xdr, |
2264 | struct nfs_writeargs *args) | ||
2306 | { | 2265 | { |
2307 | struct xdr_stream xdr; | ||
2308 | struct compound_hdr hdr = { | 2266 | struct compound_hdr hdr = { |
2309 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 2267 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
2310 | }; | 2268 | }; |
2311 | 2269 | ||
2312 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2270 | encode_compound_hdr(xdr, req, &hdr); |
2313 | encode_compound_hdr(&xdr, req, &hdr); | 2271 | encode_sequence(xdr, &args->seq_args, &hdr); |
2314 | encode_sequence(&xdr, &args->seq_args, &hdr); | 2272 | encode_putfh(xdr, args->fh, &hdr); |
2315 | encode_putfh(&xdr, args->fh, &hdr); | 2273 | encode_write(xdr, args, &hdr); |
2316 | encode_write(&xdr, args, &hdr); | ||
2317 | req->rq_snd_buf.flags |= XDRBUF_WRITE; | 2274 | req->rq_snd_buf.flags |= XDRBUF_WRITE; |
2318 | encode_getfattr(&xdr, args->bitmask, &hdr); | 2275 | encode_getfattr(xdr, args->bitmask, &hdr); |
2319 | encode_nops(&hdr); | 2276 | encode_nops(&hdr); |
2320 | return 0; | ||
2321 | } | 2277 | } |
2322 | 2278 | ||
2323 | /* | 2279 | /* |
2324 | * a COMMIT request | 2280 | * a COMMIT request |
2325 | */ | 2281 | */ |
2326 | static int nfs4_xdr_enc_commit(struct rpc_rqst *req, __be32 *p, struct nfs_writeargs *args) | 2282 | static void nfs4_xdr_enc_commit(struct rpc_rqst *req, struct xdr_stream *xdr, |
2283 | struct nfs_writeargs *args) | ||
2327 | { | 2284 | { |
2328 | struct xdr_stream xdr; | ||
2329 | struct compound_hdr hdr = { | 2285 | struct compound_hdr hdr = { |
2330 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 2286 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
2331 | }; | 2287 | }; |
2332 | 2288 | ||
2333 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2289 | encode_compound_hdr(xdr, req, &hdr); |
2334 | encode_compound_hdr(&xdr, req, &hdr); | 2290 | encode_sequence(xdr, &args->seq_args, &hdr); |
2335 | encode_sequence(&xdr, &args->seq_args, &hdr); | 2291 | encode_putfh(xdr, args->fh, &hdr); |
2336 | encode_putfh(&xdr, args->fh, &hdr); | 2292 | encode_commit(xdr, args, &hdr); |
2337 | encode_commit(&xdr, args, &hdr); | 2293 | encode_getfattr(xdr, args->bitmask, &hdr); |
2338 | encode_getfattr(&xdr, args->bitmask, &hdr); | ||
2339 | encode_nops(&hdr); | 2294 | encode_nops(&hdr); |
2340 | return 0; | ||
2341 | } | 2295 | } |
2342 | 2296 | ||
2343 | /* | 2297 | /* |
2344 | * FSINFO request | 2298 | * FSINFO request |
2345 | */ | 2299 | */ |
2346 | static int nfs4_xdr_enc_fsinfo(struct rpc_rqst *req, __be32 *p, struct nfs4_fsinfo_arg *args) | 2300 | static void nfs4_xdr_enc_fsinfo(struct rpc_rqst *req, struct xdr_stream *xdr, |
2301 | struct nfs4_fsinfo_arg *args) | ||
2347 | { | 2302 | { |
2348 | struct xdr_stream xdr; | ||
2349 | struct compound_hdr hdr = { | 2303 | struct compound_hdr hdr = { |
2350 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 2304 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
2351 | }; | 2305 | }; |
2352 | 2306 | ||
2353 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2307 | encode_compound_hdr(xdr, req, &hdr); |
2354 | encode_compound_hdr(&xdr, req, &hdr); | 2308 | encode_sequence(xdr, &args->seq_args, &hdr); |
2355 | encode_sequence(&xdr, &args->seq_args, &hdr); | 2309 | encode_putfh(xdr, args->fh, &hdr); |
2356 | encode_putfh(&xdr, args->fh, &hdr); | 2310 | encode_fsinfo(xdr, args->bitmask, &hdr); |
2357 | encode_fsinfo(&xdr, args->bitmask, &hdr); | ||
2358 | encode_nops(&hdr); | 2311 | encode_nops(&hdr); |
2359 | return 0; | ||
2360 | } | 2312 | } |
2361 | 2313 | ||
2362 | /* | 2314 | /* |
2363 | * a PATHCONF request | 2315 | * a PATHCONF request |
2364 | */ | 2316 | */ |
2365 | static int nfs4_xdr_enc_pathconf(struct rpc_rqst *req, __be32 *p, const struct nfs4_pathconf_arg *args) | 2317 | static void nfs4_xdr_enc_pathconf(struct rpc_rqst *req, struct xdr_stream *xdr, |
2318 | const struct nfs4_pathconf_arg *args) | ||
2366 | { | 2319 | { |
2367 | struct xdr_stream xdr; | ||
2368 | struct compound_hdr hdr = { | 2320 | struct compound_hdr hdr = { |
2369 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 2321 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
2370 | }; | 2322 | }; |
2371 | 2323 | ||
2372 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2324 | encode_compound_hdr(xdr, req, &hdr); |
2373 | encode_compound_hdr(&xdr, req, &hdr); | 2325 | encode_sequence(xdr, &args->seq_args, &hdr); |
2374 | encode_sequence(&xdr, &args->seq_args, &hdr); | 2326 | encode_putfh(xdr, args->fh, &hdr); |
2375 | encode_putfh(&xdr, args->fh, &hdr); | 2327 | encode_getattr_one(xdr, args->bitmask[0] & nfs4_pathconf_bitmap[0], |
2376 | encode_getattr_one(&xdr, args->bitmask[0] & nfs4_pathconf_bitmap[0], | ||
2377 | &hdr); | 2328 | &hdr); |
2378 | encode_nops(&hdr); | 2329 | encode_nops(&hdr); |
2379 | return 0; | ||
2380 | } | 2330 | } |
2381 | 2331 | ||
2382 | /* | 2332 | /* |
2383 | * a STATFS request | 2333 | * a STATFS request |
2384 | */ | 2334 | */ |
2385 | static int nfs4_xdr_enc_statfs(struct rpc_rqst *req, __be32 *p, const struct nfs4_statfs_arg *args) | 2335 | static void nfs4_xdr_enc_statfs(struct rpc_rqst *req, struct xdr_stream *xdr, |
2336 | const struct nfs4_statfs_arg *args) | ||
2386 | { | 2337 | { |
2387 | struct xdr_stream xdr; | ||
2388 | struct compound_hdr hdr = { | 2338 | struct compound_hdr hdr = { |
2389 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 2339 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
2390 | }; | 2340 | }; |
2391 | 2341 | ||
2392 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2342 | encode_compound_hdr(xdr, req, &hdr); |
2393 | encode_compound_hdr(&xdr, req, &hdr); | 2343 | encode_sequence(xdr, &args->seq_args, &hdr); |
2394 | encode_sequence(&xdr, &args->seq_args, &hdr); | 2344 | encode_putfh(xdr, args->fh, &hdr); |
2395 | encode_putfh(&xdr, args->fh, &hdr); | 2345 | encode_getattr_two(xdr, args->bitmask[0] & nfs4_statfs_bitmap[0], |
2396 | encode_getattr_two(&xdr, args->bitmask[0] & nfs4_statfs_bitmap[0], | ||
2397 | args->bitmask[1] & nfs4_statfs_bitmap[1], &hdr); | 2346 | args->bitmask[1] & nfs4_statfs_bitmap[1], &hdr); |
2398 | encode_nops(&hdr); | 2347 | encode_nops(&hdr); |
2399 | return 0; | ||
2400 | } | 2348 | } |
2401 | 2349 | ||
2402 | /* | 2350 | /* |
2403 | * GETATTR_BITMAP request | 2351 | * GETATTR_BITMAP request |
2404 | */ | 2352 | */ |
2405 | static int nfs4_xdr_enc_server_caps(struct rpc_rqst *req, __be32 *p, | 2353 | static void nfs4_xdr_enc_server_caps(struct rpc_rqst *req, |
2406 | struct nfs4_server_caps_arg *args) | 2354 | struct xdr_stream *xdr, |
2355 | struct nfs4_server_caps_arg *args) | ||
2407 | { | 2356 | { |
2408 | struct xdr_stream xdr; | ||
2409 | struct compound_hdr hdr = { | 2357 | struct compound_hdr hdr = { |
2410 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 2358 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
2411 | }; | 2359 | }; |
2412 | 2360 | ||
2413 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2361 | encode_compound_hdr(xdr, req, &hdr); |
2414 | encode_compound_hdr(&xdr, req, &hdr); | 2362 | encode_sequence(xdr, &args->seq_args, &hdr); |
2415 | encode_sequence(&xdr, &args->seq_args, &hdr); | 2363 | encode_putfh(xdr, args->fhandle, &hdr); |
2416 | encode_putfh(&xdr, args->fhandle, &hdr); | 2364 | encode_getattr_one(xdr, FATTR4_WORD0_SUPPORTED_ATTRS| |
2417 | encode_getattr_one(&xdr, FATTR4_WORD0_SUPPORTED_ATTRS| | ||
2418 | FATTR4_WORD0_LINK_SUPPORT| | 2365 | FATTR4_WORD0_LINK_SUPPORT| |
2419 | FATTR4_WORD0_SYMLINK_SUPPORT| | 2366 | FATTR4_WORD0_SYMLINK_SUPPORT| |
2420 | FATTR4_WORD0_ACLSUPPORT, &hdr); | 2367 | FATTR4_WORD0_ACLSUPPORT, &hdr); |
2421 | encode_nops(&hdr); | 2368 | encode_nops(&hdr); |
2422 | return 0; | ||
2423 | } | 2369 | } |
2424 | 2370 | ||
2425 | /* | 2371 | /* |
2426 | * a RENEW request | 2372 | * a RENEW request |
2427 | */ | 2373 | */ |
2428 | static int nfs4_xdr_enc_renew(struct rpc_rqst *req, __be32 *p, struct nfs_client *clp) | 2374 | static void nfs4_xdr_enc_renew(struct rpc_rqst *req, struct xdr_stream *xdr, |
2375 | struct nfs_client *clp) | ||
2429 | { | 2376 | { |
2430 | struct xdr_stream xdr; | ||
2431 | struct compound_hdr hdr = { | 2377 | struct compound_hdr hdr = { |
2432 | .nops = 0, | 2378 | .nops = 0, |
2433 | }; | 2379 | }; |
2434 | 2380 | ||
2435 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2381 | encode_compound_hdr(xdr, req, &hdr); |
2436 | encode_compound_hdr(&xdr, req, &hdr); | 2382 | encode_renew(xdr, clp, &hdr); |
2437 | encode_renew(&xdr, clp, &hdr); | ||
2438 | encode_nops(&hdr); | 2383 | encode_nops(&hdr); |
2439 | return 0; | ||
2440 | } | 2384 | } |
2441 | 2385 | ||
2442 | /* | 2386 | /* |
2443 | * a SETCLIENTID request | 2387 | * a SETCLIENTID request |
2444 | */ | 2388 | */ |
2445 | static int nfs4_xdr_enc_setclientid(struct rpc_rqst *req, __be32 *p, struct nfs4_setclientid *sc) | 2389 | static void nfs4_xdr_enc_setclientid(struct rpc_rqst *req, |
2390 | struct xdr_stream *xdr, | ||
2391 | struct nfs4_setclientid *sc) | ||
2446 | { | 2392 | { |
2447 | struct xdr_stream xdr; | ||
2448 | struct compound_hdr hdr = { | 2393 | struct compound_hdr hdr = { |
2449 | .nops = 0, | 2394 | .nops = 0, |
2450 | }; | 2395 | }; |
2451 | 2396 | ||
2452 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2397 | encode_compound_hdr(xdr, req, &hdr); |
2453 | encode_compound_hdr(&xdr, req, &hdr); | 2398 | encode_setclientid(xdr, sc, &hdr); |
2454 | encode_setclientid(&xdr, sc, &hdr); | ||
2455 | encode_nops(&hdr); | 2399 | encode_nops(&hdr); |
2456 | return 0; | ||
2457 | } | 2400 | } |
2458 | 2401 | ||
2459 | /* | 2402 | /* |
2460 | * a SETCLIENTID_CONFIRM request | 2403 | * a SETCLIENTID_CONFIRM request |
2461 | */ | 2404 | */ |
2462 | static int nfs4_xdr_enc_setclientid_confirm(struct rpc_rqst *req, __be32 *p, struct nfs4_setclientid_res *arg) | 2405 | static void nfs4_xdr_enc_setclientid_confirm(struct rpc_rqst *req, |
2406 | struct xdr_stream *xdr, | ||
2407 | struct nfs4_setclientid_res *arg) | ||
2463 | { | 2408 | { |
2464 | struct xdr_stream xdr; | ||
2465 | struct compound_hdr hdr = { | 2409 | struct compound_hdr hdr = { |
2466 | .nops = 0, | 2410 | .nops = 0, |
2467 | }; | 2411 | }; |
2468 | const u32 lease_bitmap[2] = { FATTR4_WORD0_LEASE_TIME, 0 }; | 2412 | const u32 lease_bitmap[2] = { FATTR4_WORD0_LEASE_TIME, 0 }; |
2469 | 2413 | ||
2470 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2414 | encode_compound_hdr(xdr, req, &hdr); |
2471 | encode_compound_hdr(&xdr, req, &hdr); | 2415 | encode_setclientid_confirm(xdr, arg, &hdr); |
2472 | encode_setclientid_confirm(&xdr, arg, &hdr); | 2416 | encode_putrootfh(xdr, &hdr); |
2473 | encode_putrootfh(&xdr, &hdr); | 2417 | encode_fsinfo(xdr, lease_bitmap, &hdr); |
2474 | encode_fsinfo(&xdr, lease_bitmap, &hdr); | ||
2475 | encode_nops(&hdr); | 2418 | encode_nops(&hdr); |
2476 | return 0; | ||
2477 | } | 2419 | } |
2478 | 2420 | ||
2479 | /* | 2421 | /* |
2480 | * DELEGRETURN request | 2422 | * DELEGRETURN request |
2481 | */ | 2423 | */ |
2482 | static int nfs4_xdr_enc_delegreturn(struct rpc_rqst *req, __be32 *p, const struct nfs4_delegreturnargs *args) | 2424 | static void nfs4_xdr_enc_delegreturn(struct rpc_rqst *req, |
2425 | struct xdr_stream *xdr, | ||
2426 | const struct nfs4_delegreturnargs *args) | ||
2483 | { | 2427 | { |
2484 | struct xdr_stream xdr; | ||
2485 | struct compound_hdr hdr = { | 2428 | struct compound_hdr hdr = { |
2486 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 2429 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
2487 | }; | 2430 | }; |
2488 | 2431 | ||
2489 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2432 | encode_compound_hdr(xdr, req, &hdr); |
2490 | encode_compound_hdr(&xdr, req, &hdr); | 2433 | encode_sequence(xdr, &args->seq_args, &hdr); |
2491 | encode_sequence(&xdr, &args->seq_args, &hdr); | 2434 | encode_putfh(xdr, args->fhandle, &hdr); |
2492 | encode_putfh(&xdr, args->fhandle, &hdr); | 2435 | encode_delegreturn(xdr, args->stateid, &hdr); |
2493 | encode_delegreturn(&xdr, args->stateid, &hdr); | 2436 | encode_getfattr(xdr, args->bitmask, &hdr); |
2494 | encode_getfattr(&xdr, args->bitmask, &hdr); | ||
2495 | encode_nops(&hdr); | 2437 | encode_nops(&hdr); |
2496 | return 0; | ||
2497 | } | 2438 | } |
2498 | 2439 | ||
2499 | /* | 2440 | /* |
2500 | * Encode FS_LOCATIONS request | 2441 | * Encode FS_LOCATIONS request |
2501 | */ | 2442 | */ |
2502 | static int nfs4_xdr_enc_fs_locations(struct rpc_rqst *req, __be32 *p, struct nfs4_fs_locations_arg *args) | 2443 | static void nfs4_xdr_enc_fs_locations(struct rpc_rqst *req, |
2444 | struct xdr_stream *xdr, | ||
2445 | struct nfs4_fs_locations_arg *args) | ||
2503 | { | 2446 | { |
2504 | struct xdr_stream xdr; | ||
2505 | struct compound_hdr hdr = { | 2447 | struct compound_hdr hdr = { |
2506 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 2448 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
2507 | }; | 2449 | }; |
2508 | uint32_t replen; | 2450 | uint32_t replen; |
2509 | 2451 | ||
2510 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2452 | encode_compound_hdr(xdr, req, &hdr); |
2511 | encode_compound_hdr(&xdr, req, &hdr); | 2453 | encode_sequence(xdr, &args->seq_args, &hdr); |
2512 | encode_sequence(&xdr, &args->seq_args, &hdr); | 2454 | encode_putfh(xdr, args->dir_fh, &hdr); |
2513 | encode_putfh(&xdr, args->dir_fh, &hdr); | 2455 | encode_lookup(xdr, args->name, &hdr); |
2514 | encode_lookup(&xdr, args->name, &hdr); | ||
2515 | replen = hdr.replen; /* get the attribute into args->page */ | 2456 | replen = hdr.replen; /* get the attribute into args->page */ |
2516 | encode_fs_locations(&xdr, args->bitmask, &hdr); | 2457 | encode_fs_locations(xdr, args->bitmask, &hdr); |
2517 | 2458 | ||
2518 | xdr_inline_pages(&req->rq_rcv_buf, replen << 2, &args->page, | 2459 | xdr_inline_pages(&req->rq_rcv_buf, replen << 2, &args->page, |
2519 | 0, PAGE_SIZE); | 2460 | 0, PAGE_SIZE); |
2520 | encode_nops(&hdr); | 2461 | encode_nops(&hdr); |
2521 | return 0; | ||
2522 | } | 2462 | } |
2523 | 2463 | ||
2524 | #if defined(CONFIG_NFS_V4_1) | 2464 | #if defined(CONFIG_NFS_V4_1) |
2525 | /* | 2465 | /* |
2526 | * EXCHANGE_ID request | 2466 | * EXCHANGE_ID request |
2527 | */ | 2467 | */ |
2528 | static int nfs4_xdr_enc_exchange_id(struct rpc_rqst *req, uint32_t *p, | 2468 | static void nfs4_xdr_enc_exchange_id(struct rpc_rqst *req, |
2529 | struct nfs41_exchange_id_args *args) | 2469 | struct xdr_stream *xdr, |
2470 | struct nfs41_exchange_id_args *args) | ||
2530 | { | 2471 | { |
2531 | struct xdr_stream xdr; | ||
2532 | struct compound_hdr hdr = { | 2472 | struct compound_hdr hdr = { |
2533 | .minorversion = args->client->cl_mvops->minor_version, | 2473 | .minorversion = args->client->cl_mvops->minor_version, |
2534 | }; | 2474 | }; |
2535 | 2475 | ||
2536 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2476 | encode_compound_hdr(xdr, req, &hdr); |
2537 | encode_compound_hdr(&xdr, req, &hdr); | 2477 | encode_exchange_id(xdr, args, &hdr); |
2538 | encode_exchange_id(&xdr, args, &hdr); | ||
2539 | encode_nops(&hdr); | 2478 | encode_nops(&hdr); |
2540 | return 0; | ||
2541 | } | 2479 | } |
2542 | 2480 | ||
2543 | /* | 2481 | /* |
2544 | * a CREATE_SESSION request | 2482 | * a CREATE_SESSION request |
2545 | */ | 2483 | */ |
2546 | static int nfs4_xdr_enc_create_session(struct rpc_rqst *req, uint32_t *p, | 2484 | static void nfs4_xdr_enc_create_session(struct rpc_rqst *req, |
2547 | struct nfs41_create_session_args *args) | 2485 | struct xdr_stream *xdr, |
2486 | struct nfs41_create_session_args *args) | ||
2548 | { | 2487 | { |
2549 | struct xdr_stream xdr; | ||
2550 | struct compound_hdr hdr = { | 2488 | struct compound_hdr hdr = { |
2551 | .minorversion = args->client->cl_mvops->minor_version, | 2489 | .minorversion = args->client->cl_mvops->minor_version, |
2552 | }; | 2490 | }; |
2553 | 2491 | ||
2554 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2492 | encode_compound_hdr(xdr, req, &hdr); |
2555 | encode_compound_hdr(&xdr, req, &hdr); | 2493 | encode_create_session(xdr, args, &hdr); |
2556 | encode_create_session(&xdr, args, &hdr); | ||
2557 | encode_nops(&hdr); | 2494 | encode_nops(&hdr); |
2558 | return 0; | ||
2559 | } | 2495 | } |
2560 | 2496 | ||
2561 | /* | 2497 | /* |
2562 | * a DESTROY_SESSION request | 2498 | * a DESTROY_SESSION request |
2563 | */ | 2499 | */ |
2564 | static int nfs4_xdr_enc_destroy_session(struct rpc_rqst *req, uint32_t *p, | 2500 | static void nfs4_xdr_enc_destroy_session(struct rpc_rqst *req, |
2565 | struct nfs4_session *session) | 2501 | struct xdr_stream *xdr, |
2502 | struct nfs4_session *session) | ||
2566 | { | 2503 | { |
2567 | struct xdr_stream xdr; | ||
2568 | struct compound_hdr hdr = { | 2504 | struct compound_hdr hdr = { |
2569 | .minorversion = session->clp->cl_mvops->minor_version, | 2505 | .minorversion = session->clp->cl_mvops->minor_version, |
2570 | }; | 2506 | }; |
2571 | 2507 | ||
2572 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2508 | encode_compound_hdr(xdr, req, &hdr); |
2573 | encode_compound_hdr(&xdr, req, &hdr); | 2509 | encode_destroy_session(xdr, session, &hdr); |
2574 | encode_destroy_session(&xdr, session, &hdr); | ||
2575 | encode_nops(&hdr); | 2510 | encode_nops(&hdr); |
2576 | return 0; | ||
2577 | } | 2511 | } |
2578 | 2512 | ||
2579 | /* | 2513 | /* |
2580 | * a SEQUENCE request | 2514 | * a SEQUENCE request |
2581 | */ | 2515 | */ |
2582 | static int nfs4_xdr_enc_sequence(struct rpc_rqst *req, uint32_t *p, | 2516 | static void nfs4_xdr_enc_sequence(struct rpc_rqst *req, struct xdr_stream *xdr, |
2583 | struct nfs4_sequence_args *args) | 2517 | struct nfs4_sequence_args *args) |
2584 | { | 2518 | { |
2585 | struct xdr_stream xdr; | ||
2586 | struct compound_hdr hdr = { | 2519 | struct compound_hdr hdr = { |
2587 | .minorversion = nfs4_xdr_minorversion(args), | 2520 | .minorversion = nfs4_xdr_minorversion(args), |
2588 | }; | 2521 | }; |
2589 | 2522 | ||
2590 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2523 | encode_compound_hdr(xdr, req, &hdr); |
2591 | encode_compound_hdr(&xdr, req, &hdr); | 2524 | encode_sequence(xdr, args, &hdr); |
2592 | encode_sequence(&xdr, args, &hdr); | ||
2593 | encode_nops(&hdr); | 2525 | encode_nops(&hdr); |
2594 | return 0; | ||
2595 | } | 2526 | } |
2596 | 2527 | ||
2597 | /* | 2528 | /* |
2598 | * a GET_LEASE_TIME request | 2529 | * a GET_LEASE_TIME request |
2599 | */ | 2530 | */ |
2600 | static int nfs4_xdr_enc_get_lease_time(struct rpc_rqst *req, uint32_t *p, | 2531 | static void nfs4_xdr_enc_get_lease_time(struct rpc_rqst *req, |
2601 | struct nfs4_get_lease_time_args *args) | 2532 | struct xdr_stream *xdr, |
2533 | struct nfs4_get_lease_time_args *args) | ||
2602 | { | 2534 | { |
2603 | struct xdr_stream xdr; | ||
2604 | struct compound_hdr hdr = { | 2535 | struct compound_hdr hdr = { |
2605 | .minorversion = nfs4_xdr_minorversion(&args->la_seq_args), | 2536 | .minorversion = nfs4_xdr_minorversion(&args->la_seq_args), |
2606 | }; | 2537 | }; |
2607 | const u32 lease_bitmap[2] = { FATTR4_WORD0_LEASE_TIME, 0 }; | 2538 | const u32 lease_bitmap[2] = { FATTR4_WORD0_LEASE_TIME, 0 }; |
2608 | 2539 | ||
2609 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2540 | encode_compound_hdr(xdr, req, &hdr); |
2610 | encode_compound_hdr(&xdr, req, &hdr); | 2541 | encode_sequence(xdr, &args->la_seq_args, &hdr); |
2611 | encode_sequence(&xdr, &args->la_seq_args, &hdr); | 2542 | encode_putrootfh(xdr, &hdr); |
2612 | encode_putrootfh(&xdr, &hdr); | 2543 | encode_fsinfo(xdr, lease_bitmap, &hdr); |
2613 | encode_fsinfo(&xdr, lease_bitmap, &hdr); | ||
2614 | encode_nops(&hdr); | 2544 | encode_nops(&hdr); |
2615 | return 0; | ||
2616 | } | 2545 | } |
2617 | 2546 | ||
2618 | /* | 2547 | /* |
2619 | * a RECLAIM_COMPLETE request | 2548 | * a RECLAIM_COMPLETE request |
2620 | */ | 2549 | */ |
2621 | static int nfs4_xdr_enc_reclaim_complete(struct rpc_rqst *req, uint32_t *p, | 2550 | static void nfs4_xdr_enc_reclaim_complete(struct rpc_rqst *req, |
2622 | struct nfs41_reclaim_complete_args *args) | 2551 | struct xdr_stream *xdr, |
2552 | struct nfs41_reclaim_complete_args *args) | ||
2623 | { | 2553 | { |
2624 | struct xdr_stream xdr; | ||
2625 | struct compound_hdr hdr = { | 2554 | struct compound_hdr hdr = { |
2626 | .minorversion = nfs4_xdr_minorversion(&args->seq_args) | 2555 | .minorversion = nfs4_xdr_minorversion(&args->seq_args) |
2627 | }; | 2556 | }; |
2628 | 2557 | ||
2629 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2558 | encode_compound_hdr(xdr, req, &hdr); |
2630 | encode_compound_hdr(&xdr, req, &hdr); | 2559 | encode_sequence(xdr, &args->seq_args, &hdr); |
2631 | encode_sequence(&xdr, &args->seq_args, &hdr); | 2560 | encode_reclaim_complete(xdr, args, &hdr); |
2632 | encode_reclaim_complete(&xdr, args, &hdr); | ||
2633 | encode_nops(&hdr); | 2561 | encode_nops(&hdr); |
2634 | return 0; | ||
2635 | } | 2562 | } |
2636 | 2563 | ||
2637 | /* | 2564 | /* |
2638 | * Encode GETDEVICEINFO request | 2565 | * Encode GETDEVICEINFO request |
2639 | */ | 2566 | */ |
2640 | static int nfs4_xdr_enc_getdeviceinfo(struct rpc_rqst *req, uint32_t *p, | 2567 | static void nfs4_xdr_enc_getdeviceinfo(struct rpc_rqst *req, |
2641 | struct nfs4_getdeviceinfo_args *args) | 2568 | struct xdr_stream *xdr, |
2569 | struct nfs4_getdeviceinfo_args *args) | ||
2642 | { | 2570 | { |
2643 | struct xdr_stream xdr; | ||
2644 | struct compound_hdr hdr = { | 2571 | struct compound_hdr hdr = { |
2645 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 2572 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
2646 | }; | 2573 | }; |
2647 | 2574 | ||
2648 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2575 | encode_compound_hdr(xdr, req, &hdr); |
2649 | encode_compound_hdr(&xdr, req, &hdr); | 2576 | encode_sequence(xdr, &args->seq_args, &hdr); |
2650 | encode_sequence(&xdr, &args->seq_args, &hdr); | 2577 | encode_getdeviceinfo(xdr, args, &hdr); |
2651 | encode_getdeviceinfo(&xdr, args, &hdr); | ||
2652 | 2578 | ||
2653 | /* set up reply kvec. Subtract notification bitmap max size (2) | 2579 | /* set up reply kvec. Subtract notification bitmap max size (2) |
2654 | * so that notification bitmap is put in xdr_buf tail */ | 2580 | * so that notification bitmap is put in xdr_buf tail */ |
@@ -2657,27 +2583,24 @@ static int nfs4_xdr_enc_getdeviceinfo(struct rpc_rqst *req, uint32_t *p, | |||
2657 | args->pdev->pglen); | 2583 | args->pdev->pglen); |
2658 | 2584 | ||
2659 | encode_nops(&hdr); | 2585 | encode_nops(&hdr); |
2660 | return 0; | ||
2661 | } | 2586 | } |
2662 | 2587 | ||
2663 | /* | 2588 | /* |
2664 | * Encode LAYOUTGET request | 2589 | * Encode LAYOUTGET request |
2665 | */ | 2590 | */ |
2666 | static int nfs4_xdr_enc_layoutget(struct rpc_rqst *req, uint32_t *p, | 2591 | static void nfs4_xdr_enc_layoutget(struct rpc_rqst *req, |
2667 | struct nfs4_layoutget_args *args) | 2592 | struct xdr_stream *xdr, |
2593 | struct nfs4_layoutget_args *args) | ||
2668 | { | 2594 | { |
2669 | struct xdr_stream xdr; | ||
2670 | struct compound_hdr hdr = { | 2595 | struct compound_hdr hdr = { |
2671 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 2596 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
2672 | }; | 2597 | }; |
2673 | 2598 | ||
2674 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 2599 | encode_compound_hdr(xdr, req, &hdr); |
2675 | encode_compound_hdr(&xdr, req, &hdr); | 2600 | encode_sequence(xdr, &args->seq_args, &hdr); |
2676 | encode_sequence(&xdr, &args->seq_args, &hdr); | 2601 | encode_putfh(xdr, NFS_FH(args->inode), &hdr); |
2677 | encode_putfh(&xdr, NFS_FH(args->inode), &hdr); | 2602 | encode_layoutget(xdr, args, &hdr); |
2678 | encode_layoutget(&xdr, args, &hdr); | ||
2679 | encode_nops(&hdr); | 2603 | encode_nops(&hdr); |
2680 | return 0; | ||
2681 | } | 2604 | } |
2682 | #endif /* CONFIG_NFS_V4_1 */ | 2605 | #endif /* CONFIG_NFS_V4_1 */ |
2683 | 2606 | ||
@@ -5368,22 +5291,18 @@ out: | |||
5368 | /* | 5291 | /* |
5369 | * Encode an SETACL request | 5292 | * Encode an SETACL request |
5370 | */ | 5293 | */ |
5371 | static int | 5294 | static void nfs4_xdr_enc_setacl(struct rpc_rqst *req, struct xdr_stream *xdr, |
5372 | nfs4_xdr_enc_setacl(struct rpc_rqst *req, __be32 *p, struct nfs_setaclargs *args) | 5295 | struct nfs_setaclargs *args) |
5373 | { | 5296 | { |
5374 | struct xdr_stream xdr; | ||
5375 | struct compound_hdr hdr = { | 5297 | struct compound_hdr hdr = { |
5376 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), | 5298 | .minorversion = nfs4_xdr_minorversion(&args->seq_args), |
5377 | }; | 5299 | }; |
5378 | int status; | ||
5379 | 5300 | ||
5380 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 5301 | encode_compound_hdr(xdr, req, &hdr); |
5381 | encode_compound_hdr(&xdr, req, &hdr); | 5302 | encode_sequence(xdr, &args->seq_args, &hdr); |
5382 | encode_sequence(&xdr, &args->seq_args, &hdr); | 5303 | encode_putfh(xdr, args->fh, &hdr); |
5383 | encode_putfh(&xdr, args->fh, &hdr); | 5304 | encode_setacl(xdr, args, &hdr); |
5384 | status = encode_setacl(&xdr, args, &hdr); | ||
5385 | encode_nops(&hdr); | 5305 | encode_nops(&hdr); |
5386 | return status; | ||
5387 | } | 5306 | } |
5388 | 5307 | ||
5389 | /* | 5308 | /* |
@@ -6316,7 +6235,7 @@ nfs4_stat_to_errno(int stat) | |||
6316 | #define PROC(proc, argtype, restype) \ | 6235 | #define PROC(proc, argtype, restype) \ |
6317 | [NFSPROC4_CLNT_##proc] = { \ | 6236 | [NFSPROC4_CLNT_##proc] = { \ |
6318 | .p_proc = NFSPROC4_COMPOUND, \ | 6237 | .p_proc = NFSPROC4_COMPOUND, \ |
6319 | .p_encode = (kxdrproc_t)nfs4_xdr_##argtype, \ | 6238 | .p_encode = (kxdreproc_t)nfs4_xdr_##argtype, \ |
6320 | .p_decode = (kxdrproc_t)nfs4_xdr_##restype, \ | 6239 | .p_decode = (kxdrproc_t)nfs4_xdr_##restype, \ |
6321 | .p_arglen = NFS4_##argtype##_sz, \ | 6240 | .p_arglen = NFS4_##argtype##_sz, \ |
6322 | .p_replen = NFS4_##restype##_sz, \ | 6241 | .p_replen = NFS4_##restype##_sz, \ |
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index 6529534d7aae..c363efda8ecf 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c | |||
@@ -499,34 +499,28 @@ out_default: | |||
499 | /* | 499 | /* |
500 | * NB: Without this zero space reservation, callbacks over krb5p fail | 500 | * NB: Without this zero space reservation, callbacks over krb5p fail |
501 | */ | 501 | */ |
502 | static int nfs4_xdr_enc_cb_null(struct rpc_rqst *req, __be32 *p, void *__unused) | 502 | static void nfs4_xdr_enc_cb_null(struct rpc_rqst *req, struct xdr_stream *xdr, |
503 | void *__unused) | ||
503 | { | 504 | { |
504 | struct xdr_stream xdrs, *xdr = &xdrs; | ||
505 | |||
506 | xdr_init_encode(&xdrs, &req->rq_snd_buf, p); | ||
507 | xdr_reserve_space(xdr, 0); | 505 | xdr_reserve_space(xdr, 0); |
508 | return 0; | ||
509 | } | 506 | } |
510 | 507 | ||
511 | /* | 508 | /* |
512 | * 20.2. Operation 4: CB_RECALL - Recall a Delegation | 509 | * 20.2. Operation 4: CB_RECALL - Recall a Delegation |
513 | */ | 510 | */ |
514 | static int nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, __be32 *p, | 511 | static void nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, struct xdr_stream *xdr, |
515 | const struct nfsd4_callback *cb) | 512 | const struct nfsd4_callback *cb) |
516 | { | 513 | { |
517 | struct xdr_stream xdr; | ||
518 | const struct nfs4_delegation *args = cb->cb_op; | 514 | const struct nfs4_delegation *args = cb->cb_op; |
519 | struct nfs4_cb_compound_hdr hdr = { | 515 | struct nfs4_cb_compound_hdr hdr = { |
520 | .ident = cb->cb_clp->cl_cb_ident, | 516 | .ident = cb->cb_clp->cl_cb_ident, |
521 | .minorversion = cb->cb_minorversion, | 517 | .minorversion = cb->cb_minorversion, |
522 | }; | 518 | }; |
523 | 519 | ||
524 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 520 | encode_cb_compound4args(xdr, &hdr); |
525 | encode_cb_compound4args(&xdr, &hdr); | 521 | encode_cb_sequence4args(xdr, cb, &hdr); |
526 | encode_cb_sequence4args(&xdr, cb, &hdr); | 522 | encode_cb_recall4args(xdr, args, &hdr); |
527 | encode_cb_recall4args(&xdr, args, &hdr); | ||
528 | encode_cb_nops(&hdr); | 523 | encode_cb_nops(&hdr); |
529 | return 0; | ||
530 | } | 524 | } |
531 | 525 | ||
532 | 526 | ||
@@ -583,7 +577,7 @@ out_default: | |||
583 | #define PROC(proc, call, argtype, restype) \ | 577 | #define PROC(proc, call, argtype, restype) \ |
584 | [NFSPROC4_CLNT_##proc] = { \ | 578 | [NFSPROC4_CLNT_##proc] = { \ |
585 | .p_proc = NFSPROC4_CB_##call, \ | 579 | .p_proc = NFSPROC4_CB_##call, \ |
586 | .p_encode = (kxdrproc_t)nfs4_xdr_enc_##argtype, \ | 580 | .p_encode = (kxdreproc_t)nfs4_xdr_enc_##argtype, \ |
587 | .p_decode = (kxdrproc_t)nfs4_xdr_dec_##restype, \ | 581 | .p_decode = (kxdrproc_t)nfs4_xdr_dec_##restype, \ |
588 | .p_arglen = NFS4_enc_##argtype##_sz, \ | 582 | .p_arglen = NFS4_enc_##argtype##_sz, \ |
589 | .p_replen = NFS4_dec_##restype##_sz, \ | 583 | .p_replen = NFS4_dec_##restype##_sz, \ |
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h index b2024757edd5..d88cffbaa6df 100644 --- a/include/linux/sunrpc/auth.h +++ b/include/linux/sunrpc/auth.h | |||
@@ -110,7 +110,7 @@ struct rpc_credops { | |||
110 | __be32 * (*crmarshal)(struct rpc_task *, __be32 *); | 110 | __be32 * (*crmarshal)(struct rpc_task *, __be32 *); |
111 | int (*crrefresh)(struct rpc_task *); | 111 | int (*crrefresh)(struct rpc_task *); |
112 | __be32 * (*crvalidate)(struct rpc_task *, __be32 *); | 112 | __be32 * (*crvalidate)(struct rpc_task *, __be32 *); |
113 | int (*crwrap_req)(struct rpc_task *, kxdrproc_t, | 113 | int (*crwrap_req)(struct rpc_task *, kxdreproc_t, |
114 | void *, __be32 *, void *); | 114 | void *, __be32 *, void *); |
115 | int (*crunwrap_resp)(struct rpc_task *, kxdrproc_t, | 115 | int (*crunwrap_resp)(struct rpc_task *, kxdrproc_t, |
116 | void *, __be32 *, void *); | 116 | void *, __be32 *, void *); |
@@ -139,7 +139,7 @@ struct rpc_cred * rpcauth_generic_bind_cred(struct rpc_task *, struct rpc_cred * | |||
139 | void put_rpccred(struct rpc_cred *); | 139 | void put_rpccred(struct rpc_cred *); |
140 | __be32 * rpcauth_marshcred(struct rpc_task *, __be32 *); | 140 | __be32 * rpcauth_marshcred(struct rpc_task *, __be32 *); |
141 | __be32 * rpcauth_checkverf(struct rpc_task *, __be32 *); | 141 | __be32 * rpcauth_checkverf(struct rpc_task *, __be32 *); |
142 | int rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp, __be32 *data, void *obj); | 142 | int rpcauth_wrap_req(struct rpc_task *task, kxdreproc_t encode, void *rqstp, __be32 *data, void *obj); |
143 | int rpcauth_unwrap_resp(struct rpc_task *task, kxdrproc_t decode, void *rqstp, __be32 *data, void *obj); | 143 | int rpcauth_unwrap_resp(struct rpc_task *task, kxdrproc_t decode, void *rqstp, __be32 *data, void *obj); |
144 | int rpcauth_refreshcred(struct rpc_task *); | 144 | int rpcauth_refreshcred(struct rpc_task *); |
145 | void rpcauth_invalcred(struct rpc_task *); | 145 | void rpcauth_invalcred(struct rpc_task *); |
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index a5a55f284b7d..7b19c4e1ce53 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h | |||
@@ -89,7 +89,7 @@ struct rpc_version { | |||
89 | */ | 89 | */ |
90 | struct rpc_procinfo { | 90 | struct rpc_procinfo { |
91 | u32 p_proc; /* RPC procedure number */ | 91 | u32 p_proc; /* RPC procedure number */ |
92 | kxdrproc_t p_encode; /* XDR encode function */ | 92 | kxdreproc_t p_encode; /* XDR encode function */ |
93 | kxdrproc_t p_decode; /* XDR decode function */ | 93 | kxdrproc_t p_decode; /* XDR decode function */ |
94 | unsigned int p_arglen; /* argument hdr length (u32) */ | 94 | unsigned int p_arglen; /* argument hdr length (u32) */ |
95 | unsigned int p_replen; /* reply hdr length (u32) */ | 95 | unsigned int p_replen; /* reply hdr length (u32) */ |
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h index 498ab93a81e4..a21cf5378c1d 100644 --- a/include/linux/sunrpc/xdr.h +++ b/include/linux/sunrpc/xdr.h | |||
@@ -33,8 +33,8 @@ struct xdr_netobj { | |||
33 | }; | 33 | }; |
34 | 34 | ||
35 | /* | 35 | /* |
36 | * This is the generic XDR function. rqstp is either a rpc_rqst (client | 36 | * This is the legacy generic XDR function. rqstp is either a rpc_rqst |
37 | * side) or svc_rqst pointer (server side). | 37 | * (client side) or svc_rqst pointer (server side). |
38 | * Encode functions always assume there's enough room in the buffer. | 38 | * Encode functions always assume there's enough room in the buffer. |
39 | */ | 39 | */ |
40 | typedef int (*kxdrproc_t)(void *rqstp, __be32 *data, void *obj); | 40 | typedef int (*kxdrproc_t)(void *rqstp, __be32 *data, void *obj); |
@@ -203,6 +203,11 @@ struct xdr_stream { | |||
203 | struct kvec *iov; /* pointer to the current kvec */ | 203 | struct kvec *iov; /* pointer to the current kvec */ |
204 | }; | 204 | }; |
205 | 205 | ||
206 | /* | ||
207 | * This is the xdr_stream style generic XDR function. | ||
208 | */ | ||
209 | typedef void (*kxdreproc_t)(void *rqstp, struct xdr_stream *xdr, void *obj); | ||
210 | |||
206 | extern void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p); | 211 | extern void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p); |
207 | extern __be32 *xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes); | 212 | extern __be32 *xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes); |
208 | extern void xdr_write_pages(struct xdr_stream *xdr, struct page **pages, | 213 | extern void xdr_write_pages(struct xdr_stream *xdr, struct page **pages, |
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c index afe67849269f..651c9da703cb 100644 --- a/net/sunrpc/auth.c +++ b/net/sunrpc/auth.c | |||
@@ -563,8 +563,17 @@ rpcauth_checkverf(struct rpc_task *task, __be32 *p) | |||
563 | return cred->cr_ops->crvalidate(task, p); | 563 | return cred->cr_ops->crvalidate(task, p); |
564 | } | 564 | } |
565 | 565 | ||
566 | static void rpcauth_wrap_req_encode(kxdreproc_t encode, struct rpc_rqst *rqstp, | ||
567 | __be32 *data, void *obj) | ||
568 | { | ||
569 | struct xdr_stream xdr; | ||
570 | |||
571 | xdr_init_encode(&xdr, &rqstp->rq_snd_buf, data); | ||
572 | encode(rqstp, &xdr, obj); | ||
573 | } | ||
574 | |||
566 | int | 575 | int |
567 | rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp, | 576 | rpcauth_wrap_req(struct rpc_task *task, kxdreproc_t encode, void *rqstp, |
568 | __be32 *data, void *obj) | 577 | __be32 *data, void *obj) |
569 | { | 578 | { |
570 | struct rpc_cred *cred = task->tk_rqstp->rq_cred; | 579 | struct rpc_cred *cred = task->tk_rqstp->rq_cred; |
@@ -574,7 +583,8 @@ rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp, | |||
574 | if (cred->cr_ops->crwrap_req) | 583 | if (cred->cr_ops->crwrap_req) |
575 | return cred->cr_ops->crwrap_req(task, encode, rqstp, data, obj); | 584 | return cred->cr_ops->crwrap_req(task, encode, rqstp, data, obj); |
576 | /* By default, we encode the arguments normally. */ | 585 | /* By default, we encode the arguments normally. */ |
577 | return encode(rqstp, data, obj); | 586 | rpcauth_wrap_req_encode(encode, rqstp, data, obj); |
587 | return 0; | ||
578 | } | 588 | } |
579 | 589 | ||
580 | int | 590 | int |
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index 3835ce35e224..42b46f9a670a 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -1231,9 +1231,19 @@ out_bad: | |||
1231 | return NULL; | 1231 | return NULL; |
1232 | } | 1232 | } |
1233 | 1233 | ||
1234 | static void gss_wrap_req_encode(kxdreproc_t encode, struct rpc_rqst *rqstp, | ||
1235 | __be32 *p, void *obj) | ||
1236 | { | ||
1237 | struct xdr_stream xdr; | ||
1238 | |||
1239 | xdr_init_encode(&xdr, &rqstp->rq_snd_buf, p); | ||
1240 | encode(rqstp, &xdr, obj); | ||
1241 | } | ||
1242 | |||
1234 | static inline int | 1243 | static inline int |
1235 | gss_wrap_req_integ(struct rpc_cred *cred, struct gss_cl_ctx *ctx, | 1244 | gss_wrap_req_integ(struct rpc_cred *cred, struct gss_cl_ctx *ctx, |
1236 | kxdrproc_t encode, struct rpc_rqst *rqstp, __be32 *p, void *obj) | 1245 | kxdreproc_t encode, struct rpc_rqst *rqstp, |
1246 | __be32 *p, void *obj) | ||
1237 | { | 1247 | { |
1238 | struct xdr_buf *snd_buf = &rqstp->rq_snd_buf; | 1248 | struct xdr_buf *snd_buf = &rqstp->rq_snd_buf; |
1239 | struct xdr_buf integ_buf; | 1249 | struct xdr_buf integ_buf; |
@@ -1249,9 +1259,7 @@ gss_wrap_req_integ(struct rpc_cred *cred, struct gss_cl_ctx *ctx, | |||
1249 | offset = (u8 *)p - (u8 *)snd_buf->head[0].iov_base; | 1259 | offset = (u8 *)p - (u8 *)snd_buf->head[0].iov_base; |
1250 | *p++ = htonl(rqstp->rq_seqno); | 1260 | *p++ = htonl(rqstp->rq_seqno); |
1251 | 1261 | ||
1252 | status = encode(rqstp, p, obj); | 1262 | gss_wrap_req_encode(encode, rqstp, p, obj); |
1253 | if (status) | ||
1254 | return status; | ||
1255 | 1263 | ||
1256 | if (xdr_buf_subsegment(snd_buf, &integ_buf, | 1264 | if (xdr_buf_subsegment(snd_buf, &integ_buf, |
1257 | offset, snd_buf->len - offset)) | 1265 | offset, snd_buf->len - offset)) |
@@ -1325,7 +1333,8 @@ out: | |||
1325 | 1333 | ||
1326 | static inline int | 1334 | static inline int |
1327 | gss_wrap_req_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx, | 1335 | gss_wrap_req_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx, |
1328 | kxdrproc_t encode, struct rpc_rqst *rqstp, __be32 *p, void *obj) | 1336 | kxdreproc_t encode, struct rpc_rqst *rqstp, |
1337 | __be32 *p, void *obj) | ||
1329 | { | 1338 | { |
1330 | struct xdr_buf *snd_buf = &rqstp->rq_snd_buf; | 1339 | struct xdr_buf *snd_buf = &rqstp->rq_snd_buf; |
1331 | u32 offset; | 1340 | u32 offset; |
@@ -1342,9 +1351,7 @@ gss_wrap_req_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx, | |||
1342 | offset = (u8 *)p - (u8 *)snd_buf->head[0].iov_base; | 1351 | offset = (u8 *)p - (u8 *)snd_buf->head[0].iov_base; |
1343 | *p++ = htonl(rqstp->rq_seqno); | 1352 | *p++ = htonl(rqstp->rq_seqno); |
1344 | 1353 | ||
1345 | status = encode(rqstp, p, obj); | 1354 | gss_wrap_req_encode(encode, rqstp, p, obj); |
1346 | if (status) | ||
1347 | return status; | ||
1348 | 1355 | ||
1349 | status = alloc_enc_pages(rqstp); | 1356 | status = alloc_enc_pages(rqstp); |
1350 | if (status) | 1357 | if (status) |
@@ -1394,7 +1401,7 @@ gss_wrap_req_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx, | |||
1394 | 1401 | ||
1395 | static int | 1402 | static int |
1396 | gss_wrap_req(struct rpc_task *task, | 1403 | gss_wrap_req(struct rpc_task *task, |
1397 | kxdrproc_t encode, void *rqstp, __be32 *p, void *obj) | 1404 | kxdreproc_t encode, void *rqstp, __be32 *p, void *obj) |
1398 | { | 1405 | { |
1399 | struct rpc_cred *cred = task->tk_rqstp->rq_cred; | 1406 | struct rpc_cred *cred = task->tk_rqstp->rq_cred; |
1400 | struct gss_cred *gss_cred = container_of(cred, struct gss_cred, | 1407 | struct gss_cred *gss_cred = container_of(cred, struct gss_cred, |
@@ -1407,12 +1414,14 @@ gss_wrap_req(struct rpc_task *task, | |||
1407 | /* The spec seems a little ambiguous here, but I think that not | 1414 | /* The spec seems a little ambiguous here, but I think that not |
1408 | * wrapping context destruction requests makes the most sense. | 1415 | * wrapping context destruction requests makes the most sense. |
1409 | */ | 1416 | */ |
1410 | status = encode(rqstp, p, obj); | 1417 | gss_wrap_req_encode(encode, rqstp, p, obj); |
1418 | status = 0; | ||
1411 | goto out; | 1419 | goto out; |
1412 | } | 1420 | } |
1413 | switch (gss_cred->gc_service) { | 1421 | switch (gss_cred->gc_service) { |
1414 | case RPC_GSS_SVC_NONE: | 1422 | case RPC_GSS_SVC_NONE: |
1415 | status = encode(rqstp, p, obj); | 1423 | gss_wrap_req_encode(encode, rqstp, p, obj); |
1424 | status = 0; | ||
1416 | break; | 1425 | break; |
1417 | case RPC_GSS_SVC_INTEGRITY: | 1426 | case RPC_GSS_SVC_INTEGRITY: |
1418 | status = gss_wrap_req_integ(cred, ctx, encode, | 1427 | status = gss_wrap_req_integ(cred, ctx, encode, |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 92ce94f5146b..d446a32be667 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -1095,7 +1095,7 @@ static void | |||
1095 | rpc_xdr_encode(struct rpc_task *task) | 1095 | rpc_xdr_encode(struct rpc_task *task) |
1096 | { | 1096 | { |
1097 | struct rpc_rqst *req = task->tk_rqstp; | 1097 | struct rpc_rqst *req = task->tk_rqstp; |
1098 | kxdrproc_t encode; | 1098 | kxdreproc_t encode; |
1099 | __be32 *p; | 1099 | __be32 *p; |
1100 | 1100 | ||
1101 | dprint_status(task); | 1101 | dprint_status(task); |
@@ -1776,9 +1776,8 @@ out_overflow: | |||
1776 | goto out_garbage; | 1776 | goto out_garbage; |
1777 | } | 1777 | } |
1778 | 1778 | ||
1779 | static int rpcproc_encode_null(void *rqstp, __be32 *data, void *obj) | 1779 | static void rpcproc_encode_null(void *rqstp, struct xdr_stream *xdr, void *obj) |
1780 | { | 1780 | { |
1781 | return 0; | ||
1782 | } | 1781 | } |
1783 | 1782 | ||
1784 | static int rpcproc_decode_null(void *rqstp, __be32 *data, void *obj) | 1783 | static int rpcproc_decode_null(void *rqstp, __be32 *data, void *obj) |
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c index 43838c72b778..63912a1a2983 100644 --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c | |||
@@ -689,25 +689,21 @@ static void rpcb_getport_done(struct rpc_task *child, void *data) | |||
689 | * XDR functions for rpcbind | 689 | * XDR functions for rpcbind |
690 | */ | 690 | */ |
691 | 691 | ||
692 | static int rpcb_enc_mapping(struct rpc_rqst *req, __be32 *p, | 692 | static void rpcb_enc_mapping(struct rpc_rqst *req, struct xdr_stream *xdr, |
693 | const struct rpcbind_args *rpcb) | 693 | const struct rpcbind_args *rpcb) |
694 | { | 694 | { |
695 | struct rpc_task *task = req->rq_task; | 695 | struct rpc_task *task = req->rq_task; |
696 | struct xdr_stream xdr; | 696 | __be32 *p; |
697 | 697 | ||
698 | dprintk("RPC: %5u encoding PMAP_%s call (%u, %u, %d, %u)\n", | 698 | dprintk("RPC: %5u encoding PMAP_%s call (%u, %u, %d, %u)\n", |
699 | task->tk_pid, task->tk_msg.rpc_proc->p_name, | 699 | task->tk_pid, task->tk_msg.rpc_proc->p_name, |
700 | rpcb->r_prog, rpcb->r_vers, rpcb->r_prot, rpcb->r_port); | 700 | rpcb->r_prog, rpcb->r_vers, rpcb->r_prot, rpcb->r_port); |
701 | 701 | ||
702 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 702 | p = xdr_reserve_space(xdr, RPCB_mappingargs_sz << 2); |
703 | |||
704 | p = xdr_reserve_space(&xdr, RPCB_mappingargs_sz << 2); | ||
705 | *p++ = cpu_to_be32(rpcb->r_prog); | 703 | *p++ = cpu_to_be32(rpcb->r_prog); |
706 | *p++ = cpu_to_be32(rpcb->r_vers); | 704 | *p++ = cpu_to_be32(rpcb->r_vers); |
707 | *p++ = cpu_to_be32(rpcb->r_prot); | 705 | *p++ = cpu_to_be32(rpcb->r_prot); |
708 | *p = cpu_to_be32(rpcb->r_port); | 706 | *p = cpu_to_be32(rpcb->r_port); |
709 | |||
710 | return 0; | ||
711 | } | 707 | } |
712 | 708 | ||
713 | static int rpcb_dec_getport(struct rpc_rqst *req, __be32 *p, | 709 | static int rpcb_dec_getport(struct rpc_rqst *req, __be32 *p, |
@@ -769,27 +765,24 @@ static void encode_rpcb_string(struct xdr_stream *xdr, const char *string, | |||
769 | xdr_encode_opaque(p, string, len); | 765 | xdr_encode_opaque(p, string, len); |
770 | } | 766 | } |
771 | 767 | ||
772 | static int rpcb_enc_getaddr(struct rpc_rqst *req, __be32 *p, | 768 | static void rpcb_enc_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr, |
773 | const struct rpcbind_args *rpcb) | 769 | const struct rpcbind_args *rpcb) |
774 | { | 770 | { |
775 | struct rpc_task *task = req->rq_task; | 771 | struct rpc_task *task = req->rq_task; |
776 | struct xdr_stream xdr; | 772 | __be32 *p; |
777 | 773 | ||
778 | dprintk("RPC: %5u encoding RPCB_%s call (%u, %u, '%s', '%s')\n", | 774 | dprintk("RPC: %5u encoding RPCB_%s call (%u, %u, '%s', '%s')\n", |
779 | task->tk_pid, task->tk_msg.rpc_proc->p_name, | 775 | task->tk_pid, task->tk_msg.rpc_proc->p_name, |
780 | rpcb->r_prog, rpcb->r_vers, | 776 | rpcb->r_prog, rpcb->r_vers, |
781 | rpcb->r_netid, rpcb->r_addr); | 777 | rpcb->r_netid, rpcb->r_addr); |
782 | 778 | ||
783 | xdr_init_encode(&xdr, &req->rq_snd_buf, p); | 779 | p = xdr_reserve_space(xdr, (RPCB_program_sz + RPCB_version_sz) << 2); |
784 | |||
785 | p = xdr_reserve_space(&xdr, (RPCB_program_sz + RPCB_version_sz) << 2); | ||
786 | *p++ = cpu_to_be32(rpcb->r_prog); | 780 | *p++ = cpu_to_be32(rpcb->r_prog); |
787 | *p = cpu_to_be32(rpcb->r_vers); | 781 | *p = cpu_to_be32(rpcb->r_vers); |
788 | 782 | ||
789 | encode_rpcb_string(&xdr, rpcb->r_netid, RPCBIND_MAXNETIDLEN); | 783 | encode_rpcb_string(xdr, rpcb->r_netid, RPCBIND_MAXNETIDLEN); |
790 | encode_rpcb_string(&xdr, rpcb->r_addr, RPCBIND_MAXUADDRLEN); | 784 | encode_rpcb_string(xdr, rpcb->r_addr, RPCBIND_MAXUADDRLEN); |
791 | encode_rpcb_string(&xdr, rpcb->r_owner, RPCB_MAXOWNERLEN); | 785 | encode_rpcb_string(xdr, rpcb->r_owner, RPCB_MAXOWNERLEN); |
792 | return 0; | ||
793 | } | 786 | } |
794 | 787 | ||
795 | static int rpcb_dec_getaddr(struct rpc_rqst *req, __be32 *p, | 788 | static int rpcb_dec_getaddr(struct rpc_rqst *req, __be32 *p, |
@@ -849,7 +842,7 @@ out_fail: | |||
849 | static struct rpc_procinfo rpcb_procedures2[] = { | 842 | static struct rpc_procinfo rpcb_procedures2[] = { |
850 | [RPCBPROC_SET] = { | 843 | [RPCBPROC_SET] = { |
851 | .p_proc = RPCBPROC_SET, | 844 | .p_proc = RPCBPROC_SET, |
852 | .p_encode = (kxdrproc_t)rpcb_enc_mapping, | 845 | .p_encode = (kxdreproc_t)rpcb_enc_mapping, |
853 | .p_decode = (kxdrproc_t)rpcb_dec_set, | 846 | .p_decode = (kxdrproc_t)rpcb_dec_set, |
854 | .p_arglen = RPCB_mappingargs_sz, | 847 | .p_arglen = RPCB_mappingargs_sz, |
855 | .p_replen = RPCB_setres_sz, | 848 | .p_replen = RPCB_setres_sz, |
@@ -859,7 +852,7 @@ static struct rpc_procinfo rpcb_procedures2[] = { | |||
859 | }, | 852 | }, |
860 | [RPCBPROC_UNSET] = { | 853 | [RPCBPROC_UNSET] = { |
861 | .p_proc = RPCBPROC_UNSET, | 854 | .p_proc = RPCBPROC_UNSET, |
862 | .p_encode = (kxdrproc_t)rpcb_enc_mapping, | 855 | .p_encode = (kxdreproc_t)rpcb_enc_mapping, |
863 | .p_decode = (kxdrproc_t)rpcb_dec_set, | 856 | .p_decode = (kxdrproc_t)rpcb_dec_set, |
864 | .p_arglen = RPCB_mappingargs_sz, | 857 | .p_arglen = RPCB_mappingargs_sz, |
865 | .p_replen = RPCB_setres_sz, | 858 | .p_replen = RPCB_setres_sz, |
@@ -869,7 +862,7 @@ static struct rpc_procinfo rpcb_procedures2[] = { | |||
869 | }, | 862 | }, |
870 | [RPCBPROC_GETPORT] = { | 863 | [RPCBPROC_GETPORT] = { |
871 | .p_proc = RPCBPROC_GETPORT, | 864 | .p_proc = RPCBPROC_GETPORT, |
872 | .p_encode = (kxdrproc_t)rpcb_enc_mapping, | 865 | .p_encode = (kxdreproc_t)rpcb_enc_mapping, |
873 | .p_decode = (kxdrproc_t)rpcb_dec_getport, | 866 | .p_decode = (kxdrproc_t)rpcb_dec_getport, |
874 | .p_arglen = RPCB_mappingargs_sz, | 867 | .p_arglen = RPCB_mappingargs_sz, |
875 | .p_replen = RPCB_getportres_sz, | 868 | .p_replen = RPCB_getportres_sz, |
@@ -882,7 +875,7 @@ static struct rpc_procinfo rpcb_procedures2[] = { | |||
882 | static struct rpc_procinfo rpcb_procedures3[] = { | 875 | static struct rpc_procinfo rpcb_procedures3[] = { |
883 | [RPCBPROC_SET] = { | 876 | [RPCBPROC_SET] = { |
884 | .p_proc = RPCBPROC_SET, | 877 | .p_proc = RPCBPROC_SET, |
885 | .p_encode = (kxdrproc_t)rpcb_enc_getaddr, | 878 | .p_encode = (kxdreproc_t)rpcb_enc_getaddr, |
886 | .p_decode = (kxdrproc_t)rpcb_dec_set, | 879 | .p_decode = (kxdrproc_t)rpcb_dec_set, |
887 | .p_arglen = RPCB_getaddrargs_sz, | 880 | .p_arglen = RPCB_getaddrargs_sz, |
888 | .p_replen = RPCB_setres_sz, | 881 | .p_replen = RPCB_setres_sz, |
@@ -892,7 +885,7 @@ static struct rpc_procinfo rpcb_procedures3[] = { | |||
892 | }, | 885 | }, |
893 | [RPCBPROC_UNSET] = { | 886 | [RPCBPROC_UNSET] = { |
894 | .p_proc = RPCBPROC_UNSET, | 887 | .p_proc = RPCBPROC_UNSET, |
895 | .p_encode = (kxdrproc_t)rpcb_enc_getaddr, | 888 | .p_encode = (kxdreproc_t)rpcb_enc_getaddr, |
896 | .p_decode = (kxdrproc_t)rpcb_dec_set, | 889 | .p_decode = (kxdrproc_t)rpcb_dec_set, |
897 | .p_arglen = RPCB_getaddrargs_sz, | 890 | .p_arglen = RPCB_getaddrargs_sz, |
898 | .p_replen = RPCB_setres_sz, | 891 | .p_replen = RPCB_setres_sz, |
@@ -902,7 +895,7 @@ static struct rpc_procinfo rpcb_procedures3[] = { | |||
902 | }, | 895 | }, |
903 | [RPCBPROC_GETADDR] = { | 896 | [RPCBPROC_GETADDR] = { |
904 | .p_proc = RPCBPROC_GETADDR, | 897 | .p_proc = RPCBPROC_GETADDR, |
905 | .p_encode = (kxdrproc_t)rpcb_enc_getaddr, | 898 | .p_encode = (kxdreproc_t)rpcb_enc_getaddr, |
906 | .p_decode = (kxdrproc_t)rpcb_dec_getaddr, | 899 | .p_decode = (kxdrproc_t)rpcb_dec_getaddr, |
907 | .p_arglen = RPCB_getaddrargs_sz, | 900 | .p_arglen = RPCB_getaddrargs_sz, |
908 | .p_replen = RPCB_getaddrres_sz, | 901 | .p_replen = RPCB_getaddrres_sz, |
@@ -915,7 +908,7 @@ static struct rpc_procinfo rpcb_procedures3[] = { | |||
915 | static struct rpc_procinfo rpcb_procedures4[] = { | 908 | static struct rpc_procinfo rpcb_procedures4[] = { |
916 | [RPCBPROC_SET] = { | 909 | [RPCBPROC_SET] = { |
917 | .p_proc = RPCBPROC_SET, | 910 | .p_proc = RPCBPROC_SET, |
918 | .p_encode = (kxdrproc_t)rpcb_enc_getaddr, | 911 | .p_encode = (kxdreproc_t)rpcb_enc_getaddr, |
919 | .p_decode = (kxdrproc_t)rpcb_dec_set, | 912 | .p_decode = (kxdrproc_t)rpcb_dec_set, |
920 | .p_arglen = RPCB_getaddrargs_sz, | 913 | .p_arglen = RPCB_getaddrargs_sz, |
921 | .p_replen = RPCB_setres_sz, | 914 | .p_replen = RPCB_setres_sz, |
@@ -925,7 +918,7 @@ static struct rpc_procinfo rpcb_procedures4[] = { | |||
925 | }, | 918 | }, |
926 | [RPCBPROC_UNSET] = { | 919 | [RPCBPROC_UNSET] = { |
927 | .p_proc = RPCBPROC_UNSET, | 920 | .p_proc = RPCBPROC_UNSET, |
928 | .p_encode = (kxdrproc_t)rpcb_enc_getaddr, | 921 | .p_encode = (kxdreproc_t)rpcb_enc_getaddr, |
929 | .p_decode = (kxdrproc_t)rpcb_dec_set, | 922 | .p_decode = (kxdrproc_t)rpcb_dec_set, |
930 | .p_arglen = RPCB_getaddrargs_sz, | 923 | .p_arglen = RPCB_getaddrargs_sz, |
931 | .p_replen = RPCB_setres_sz, | 924 | .p_replen = RPCB_setres_sz, |
@@ -935,7 +928,7 @@ static struct rpc_procinfo rpcb_procedures4[] = { | |||
935 | }, | 928 | }, |
936 | [RPCBPROC_GETADDR] = { | 929 | [RPCBPROC_GETADDR] = { |
937 | .p_proc = RPCBPROC_GETADDR, | 930 | .p_proc = RPCBPROC_GETADDR, |
938 | .p_encode = (kxdrproc_t)rpcb_enc_getaddr, | 931 | .p_encode = (kxdreproc_t)rpcb_enc_getaddr, |
939 | .p_decode = (kxdrproc_t)rpcb_dec_getaddr, | 932 | .p_decode = (kxdrproc_t)rpcb_dec_getaddr, |
940 | .p_arglen = RPCB_getaddrargs_sz, | 933 | .p_arglen = RPCB_getaddrargs_sz, |
941 | .p_replen = RPCB_getaddrres_sz, | 934 | .p_replen = RPCB_getaddrres_sz, |