mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
SUNRPC: New xdr_streams XDR decoder API
Now that all client-side XDR decoder routines use xdr_streams, there should be no need to support the legacy calling sequence [rpc_rqst *, __be32 *, RPC res *] anywhere. We can construct an xdr_stream in the generic RPC code, instead of in each decoder function. This is a refactoring change. It should not cause different behavior. Signed-off-by: Chuck Lever <[email protected]> Tested-by: J. Bruce Fields <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
This commit is contained in:
parent
9f06c719f4
commit
bf2695516d
15 changed files with 518 additions and 566 deletions
|
|
@ -529,17 +529,16 @@ out:
|
|||
return error;
|
||||
}
|
||||
|
||||
static int nlm4_xdr_dec_testres(struct rpc_rqst *req, __be32 *p,
|
||||
static int nlm4_xdr_dec_testres(struct rpc_rqst *req,
|
||||
struct xdr_stream *xdr,
|
||||
struct nlm_res *result)
|
||||
{
|
||||
struct xdr_stream xdr;
|
||||
int error;
|
||||
|
||||
xdr_init_decode(&xdr, &req->rq_rcv_buf, p);
|
||||
error = decode_cookie(&xdr, &result->cookie);
|
||||
error = decode_cookie(xdr, &result->cookie);
|
||||
if (unlikely(error))
|
||||
goto out;
|
||||
error = decode_nlm4_testrply(&xdr, result);
|
||||
error = decode_nlm4_testrply(xdr, result);
|
||||
out:
|
||||
return error;
|
||||
}
|
||||
|
|
@ -550,17 +549,16 @@ out:
|
|||
* nlm4_stat stat;
|
||||
* };
|
||||
*/
|
||||
static int nlm4_xdr_dec_res(struct rpc_rqst *req, __be32 *p,
|
||||
static int nlm4_xdr_dec_res(struct rpc_rqst *req,
|
||||
struct xdr_stream *xdr,
|
||||
struct nlm_res *result)
|
||||
{
|
||||
struct xdr_stream xdr;
|
||||
int error;
|
||||
|
||||
xdr_init_decode(&xdr, &req->rq_rcv_buf, p);
|
||||
error = decode_cookie(&xdr, &result->cookie);
|
||||
error = decode_cookie(xdr, &result->cookie);
|
||||
if (unlikely(error))
|
||||
goto out;
|
||||
error = decode_nlm4_stat(&xdr, &result->status);
|
||||
error = decode_nlm4_stat(xdr, &result->status);
|
||||
out:
|
||||
return error;
|
||||
}
|
||||
|
|
@ -575,7 +573,7 @@ out:
|
|||
[NLMPROC_##proc] = { \
|
||||
.p_proc = NLMPROC_##proc, \
|
||||
.p_encode = (kxdreproc_t)nlm4_xdr_enc_##argtype, \
|
||||
.p_decode = (kxdrproc_t)nlm4_xdr_dec_##restype, \
|
||||
.p_decode = (kxdrdproc_t)nlm4_xdr_dec_##restype, \
|
||||
.p_arglen = NLM4_##argtype##_sz, \
|
||||
.p_replen = NLM4_##restype##_sz, \
|
||||
.p_statidx = NLMPROC_##proc, \
|
||||
|
|
|
|||
|
|
@ -527,17 +527,16 @@ out:
|
|||
return error;
|
||||
}
|
||||
|
||||
static int nlm_xdr_dec_testres(struct rpc_rqst *req, __be32 *p,
|
||||
static int nlm_xdr_dec_testres(struct rpc_rqst *req,
|
||||
struct xdr_stream *xdr,
|
||||
struct nlm_res *result)
|
||||
{
|
||||
struct xdr_stream xdr;
|
||||
int error;
|
||||
|
||||
xdr_init_decode(&xdr, &req->rq_rcv_buf, p);
|
||||
error = decode_cookie(&xdr, &result->cookie);
|
||||
error = decode_cookie(xdr, &result->cookie);
|
||||
if (unlikely(error))
|
||||
goto out;
|
||||
error = decode_nlm_testrply(&xdr, result);
|
||||
error = decode_nlm_testrply(xdr, result);
|
||||
out:
|
||||
return error;
|
||||
}
|
||||
|
|
@ -548,17 +547,16 @@ out:
|
|||
* nlm_stat stat;
|
||||
* };
|
||||
*/
|
||||
static int nlm_xdr_dec_res(struct rpc_rqst *req, __be32 *p,
|
||||
static int nlm_xdr_dec_res(struct rpc_rqst *req,
|
||||
struct xdr_stream *xdr,
|
||||
struct nlm_res *result)
|
||||
{
|
||||
struct xdr_stream xdr;
|
||||
int error;
|
||||
|
||||
xdr_init_decode(&xdr, &req->rq_rcv_buf, p);
|
||||
error = decode_cookie(&xdr, &result->cookie);
|
||||
error = decode_cookie(xdr, &result->cookie);
|
||||
if (unlikely(error))
|
||||
goto out;
|
||||
error = decode_nlm_stat(&xdr, &result->status);
|
||||
error = decode_nlm_stat(xdr, &result->status);
|
||||
out:
|
||||
return error;
|
||||
}
|
||||
|
|
@ -573,7 +571,7 @@ out:
|
|||
[NLMPROC_##proc] = { \
|
||||
.p_proc = NLMPROC_##proc, \
|
||||
.p_encode = (kxdreproc_t)nlm_xdr_enc_##argtype, \
|
||||
.p_decode = (kxdrproc_t)nlm_xdr_dec_##restype, \
|
||||
.p_decode = (kxdrdproc_t)nlm_xdr_dec_##restype, \
|
||||
.p_arglen = NLM_##argtype##_sz, \
|
||||
.p_replen = NLM_##restype##_sz, \
|
||||
.p_statidx = NLMPROC_##proc, \
|
||||
|
|
|
|||
|
|
@ -472,35 +472,35 @@ static void nsm_xdr_enc_unmon(struct rpc_rqst *req, struct xdr_stream *xdr,
|
|||
encode_mon_id(xdr, argp);
|
||||
}
|
||||
|
||||
static int xdr_dec_stat_res(struct rpc_rqst *rqstp, __be32 *p,
|
||||
struct nsm_res *resp)
|
||||
static int nsm_xdr_dec_stat_res(struct rpc_rqst *rqstp,
|
||||
struct xdr_stream *xdr,
|
||||
struct nsm_res *resp)
|
||||
{
|
||||
struct xdr_stream xdr;
|
||||
__be32 *p;
|
||||
|
||||
xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p);
|
||||
p = xdr_inline_decode(&xdr, 4 + 4);
|
||||
p = xdr_inline_decode(xdr, 4 + 4);
|
||||
if (unlikely(p == NULL))
|
||||
return -EIO;
|
||||
resp->status = be32_to_cpup(p++);
|
||||
resp->state = be32_to_cpup(p);
|
||||
|
||||
dprintk("lockd: xdr_dec_stat_res status %d state %d\n",
|
||||
resp->status, resp->state);
|
||||
dprintk("lockd: %s status %d state %d\n",
|
||||
__func__, resp->status, resp->state);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int xdr_dec_stat(struct rpc_rqst *rqstp, __be32 *p,
|
||||
struct nsm_res *resp)
|
||||
static int nsm_xdr_dec_stat(struct rpc_rqst *rqstp,
|
||||
struct xdr_stream *xdr,
|
||||
struct nsm_res *resp)
|
||||
{
|
||||
struct xdr_stream xdr;
|
||||
__be32 *p;
|
||||
|
||||
xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p);
|
||||
p = xdr_inline_decode(&xdr, 4);
|
||||
p = xdr_inline_decode(xdr, 4);
|
||||
if (unlikely(p == NULL))
|
||||
return -EIO;
|
||||
resp->state = be32_to_cpup(p);
|
||||
|
||||
dprintk("lockd: xdr_dec_stat state %d\n", resp->state);
|
||||
dprintk("lockd: %s state %d\n", __func__, resp->state);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -517,7 +517,7 @@ static struct rpc_procinfo nsm_procedures[] = {
|
|||
[NSMPROC_MON] = {
|
||||
.p_proc = NSMPROC_MON,
|
||||
.p_encode = (kxdreproc_t)nsm_xdr_enc_mon,
|
||||
.p_decode = (kxdrproc_t)xdr_dec_stat_res,
|
||||
.p_decode = (kxdrdproc_t)nsm_xdr_dec_stat_res,
|
||||
.p_arglen = SM_mon_sz,
|
||||
.p_replen = SM_monres_sz,
|
||||
.p_statidx = NSMPROC_MON,
|
||||
|
|
@ -526,7 +526,7 @@ static struct rpc_procinfo nsm_procedures[] = {
|
|||
[NSMPROC_UNMON] = {
|
||||
.p_proc = NSMPROC_UNMON,
|
||||
.p_encode = (kxdreproc_t)nsm_xdr_enc_unmon,
|
||||
.p_decode = (kxdrproc_t)xdr_dec_stat,
|
||||
.p_decode = (kxdrdproc_t)nsm_xdr_dec_stat,
|
||||
.p_arglen = SM_mon_id_sz,
|
||||
.p_replen = SM_unmonres_sz,
|
||||
.p_statidx = NSMPROC_UNMON,
|
||||
|
|
|
|||
Loading…
Reference in a new issue