diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2010-12-14 17:59:18 +0300 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-12-16 20:37:25 +0300 |
commit | 9f06c719f474be7003763284a990bed6377bb0d4 (patch) | |
tree | 409ebc3505f943bfdb933ab0acd76ffb5347b372 /fs/lockd/clnt4xdr.c | |
parent | 1ac7c23e4af5e83525137661595000099f1ce94f (diff) | |
download | linux-9f06c719f474be7003763284a990bed6377bb0d4.tar.xz |
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/lockd/clnt4xdr.c')
-rw-r--r-- | fs/lockd/clnt4xdr.c | 92 |
1 files changed, 39 insertions, 53 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, * struct nlm4_lock alock; * }; */ -static int nlm4_xdr_enc_testargs(struct rpc_rqst *req, __be32 *p, - const struct nlm_args *args) +static void nlm4_xdr_enc_testargs(struct rpc_rqst *req, + struct xdr_stream *xdr, + const struct nlm_args *args) { const struct nlm_lock *lock = &args->lock; - struct xdr_stream xdr; - xdr_init_encode(&xdr, &req->rq_snd_buf, p); - encode_cookie(&xdr, &args->cookie); - encode_bool(&xdr, lock->fl.fl_type == F_WRLCK); - encode_nlm4_lock(&xdr, lock); - return 0; + encode_cookie(xdr, &args->cookie); + encode_bool(xdr, lock->fl.fl_type == F_WRLCK); + encode_nlm4_lock(xdr, lock); } /* @@ -408,20 +406,18 @@ static int nlm4_xdr_enc_testargs(struct rpc_rqst *req, __be32 *p, * int state; * }; */ -static int nlm4_xdr_enc_lockargs(struct rpc_rqst *req, __be32 *p, - const struct nlm_args *args) +static void nlm4_xdr_enc_lockargs(struct rpc_rqst *req, + struct xdr_stream *xdr, + const struct nlm_args *args) { const struct nlm_lock *lock = &args->lock; - struct xdr_stream xdr; - xdr_init_encode(&xdr, &req->rq_snd_buf, p); - encode_cookie(&xdr, &args->cookie); - encode_bool(&xdr, args->block); - encode_bool(&xdr, lock->fl.fl_type == F_WRLCK); - encode_nlm4_lock(&xdr, lock); - encode_bool(&xdr, args->reclaim); - encode_int32(&xdr, args->state); - return 0; + encode_cookie(xdr, &args->cookie); + encode_bool(xdr, args->block); + encode_bool(xdr, lock->fl.fl_type == F_WRLCK); + encode_nlm4_lock(xdr, lock); + encode_bool(xdr, args->reclaim); + encode_int32(xdr, args->state); } /* @@ -432,18 +428,16 @@ static int nlm4_xdr_enc_lockargs(struct rpc_rqst *req, __be32 *p, * struct nlm4_lock alock; * }; */ -static int nlm4_xdr_enc_cancargs(struct rpc_rqst *req, __be32 *p, - const struct nlm_args *args) +static void nlm4_xdr_enc_cancargs(struct rpc_rqst *req, + struct xdr_stream *xdr, + const struct nlm_args *args) { const struct nlm_lock *lock = &args->lock; - struct xdr_stream xdr; - xdr_init_encode(&xdr, &req->rq_snd_buf, p); - encode_cookie(&xdr, &args->cookie); - encode_bool(&xdr, args->block); - encode_bool(&xdr, lock->fl.fl_type == F_WRLCK); - encode_nlm4_lock(&xdr, lock); - return 0; + encode_cookie(xdr, &args->cookie); + encode_bool(xdr, args->block); + encode_bool(xdr, lock->fl.fl_type == F_WRLCK); + encode_nlm4_lock(xdr, lock); } /* @@ -452,16 +446,14 @@ static int nlm4_xdr_enc_cancargs(struct rpc_rqst *req, __be32 *p, * struct nlm4_lock alock; * }; */ -static int nlm4_xdr_enc_unlockargs(struct rpc_rqst *req, __be32 *p, - const struct nlm_args *args) +static void nlm4_xdr_enc_unlockargs(struct rpc_rqst *req, + struct xdr_stream *xdr, + const struct nlm_args *args) { const struct nlm_lock *lock = &args->lock; - struct xdr_stream xdr; - xdr_init_encode(&xdr, &req->rq_snd_buf, p); - encode_cookie(&xdr, &args->cookie); - encode_nlm4_lock(&xdr, lock); - return 0; + encode_cookie(xdr, &args->cookie); + encode_nlm4_lock(xdr, lock); } /* @@ -470,15 +462,12 @@ static int nlm4_xdr_enc_unlockargs(struct rpc_rqst *req, __be32 *p, * nlm4_stat stat; * }; */ -static int nlm4_xdr_enc_res(struct rpc_rqst *req, __be32 *p, - const struct nlm_res *result) +static void nlm4_xdr_enc_res(struct rpc_rqst *req, + struct xdr_stream *xdr, + const struct nlm_res *result) { - struct xdr_stream xdr; - - xdr_init_encode(&xdr, &req->rq_snd_buf, p); - encode_cookie(&xdr, &result->cookie); - encode_nlm4_stat(&xdr, result->status); - return 0; + encode_cookie(xdr, &result->cookie); + encode_nlm4_stat(xdr, result->status); } /* @@ -494,17 +483,14 @@ static int nlm4_xdr_enc_res(struct rpc_rqst *req, __be32 *p, * nlm4_testrply test_stat; * }; */ -static int nlm4_xdr_enc_testres(struct rpc_rqst *req, __be32 *p, - const struct nlm_res *result) +static void nlm4_xdr_enc_testres(struct rpc_rqst *req, + struct xdr_stream *xdr, + const struct nlm_res *result) { - struct xdr_stream xdr; - - xdr_init_encode(&xdr, &req->rq_snd_buf, p); - encode_cookie(&xdr, &result->cookie); - encode_nlm4_stat(&xdr, result->status); + encode_cookie(xdr, &result->cookie); + encode_nlm4_stat(xdr, result->status); if (result->status == nlm_lck_denied) - encode_nlm4_holder(&xdr, result); - return 0; + encode_nlm4_holder(xdr, result); } @@ -588,7 +574,7 @@ out: #define PROC(proc, argtype, restype) \ [NLMPROC_##proc] = { \ .p_proc = NLMPROC_##proc, \ - .p_encode = (kxdrproc_t)nlm4_xdr_enc_##argtype, \ + .p_encode = (kxdreproc_t)nlm4_xdr_enc_##argtype, \ .p_decode = (kxdrproc_t)nlm4_xdr_dec_##restype, \ .p_arglen = NLM4_##argtype##_sz, \ .p_replen = NLM4_##restype##_sz, \ |