aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2010-12-14 09:59:18 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-12-16 12:37:25 -0500
commit9f06c719f474be7003763284a990bed6377bb0d4 (patch)
tree409ebc3505f943bfdb933ab0acd76ffb5347b372 /fs/nfsd
parent1ac7c23e4af5e83525137661595000099f1ce94f (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>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/nfs4callback.c22
1 files changed, 8 insertions, 14 deletions
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 */
502static int nfs4_xdr_enc_cb_null(struct rpc_rqst *req, __be32 *p, void *__unused) 502static 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 */
514static int nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, __be32 *p, 511static 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, \