Commit 9f06c719 authored by Chuck Lever's avatar Chuck Lever Committed by Trond Myklebust

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: default avatarChuck Lever <chuck.lever@oracle.com>
Tested-by: default avatarJ. Bruce Fields <bfields@redhat.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 1ac7c23e
......@@ -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 @@ static int nlm4_xdr_dec_res(struct rpc_rqst *req, __be32 *p,
#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, \
......
......@@ -378,17 +378,15 @@ static void encode_nlm_lock(struct xdr_stream *xdr,
* struct nlm_lock alock;
* };
*/
static int nlm_xdr_enc_testargs(struct rpc_rqst *req, __be32 *p,
const struct nlm_args *args)
static void nlm_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_nlm_lock(&xdr, lock);
return 0;
encode_cookie(xdr, &args->cookie);
encode_bool(xdr, lock->fl.fl_type == F_WRLCK);
encode_nlm_lock(xdr, lock);
}
/*
......@@ -401,20 +399,18 @@ static int nlm_xdr_enc_testargs(struct rpc_rqst *req, __be32 *p,
* int state;
* };
*/
static int nlm_xdr_enc_lockargs(struct rpc_rqst *req, __be32 *p,
const struct nlm_args *args)
static void nlm_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_nlm_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_nlm_lock(xdr, lock);
encode_bool(xdr, args->reclaim);
encode_int32(xdr, args->state);
}
/*
......@@ -425,18 +421,16 @@ static int nlm_xdr_enc_lockargs(struct rpc_rqst *req, __be32 *p,
* struct nlm_lock alock;
* };
*/
static int nlm_xdr_enc_cancargs(struct rpc_rqst *req, __be32 *p,
const struct nlm_args *args)
static void nlm_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_nlm_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_nlm_lock(xdr, lock);
}
/*
......@@ -445,16 +439,14 @@ static int nlm_xdr_enc_cancargs(struct rpc_rqst *req, __be32 *p,
* struct nlm_lock alock;
* };
*/
static int nlm_xdr_enc_unlockargs(struct rpc_rqst *req, __be32 *p,
const struct nlm_args *args)
static void nlm_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_nlm_lock(&xdr, lock);
return 0;
encode_cookie(xdr, &args->cookie);
encode_nlm_lock(xdr, lock);
}
/*
......@@ -463,15 +455,12 @@ static int nlm_xdr_enc_unlockargs(struct rpc_rqst *req, __be32 *p,
* nlm_stat stat;
* };
*/
static int nlm_xdr_enc_res(struct rpc_rqst *req, __be32 *p,
const struct nlm_res *result)
static void nlm_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_nlm_stat(&xdr, result->status);
return 0;
encode_cookie(xdr, &result->cookie);
encode_nlm_stat(xdr, result->status);
}
/*
......@@ -494,16 +483,13 @@ static void encode_nlm_testrply(struct xdr_stream *xdr,
encode_nlm_holder(xdr, result);
}
static int nlm_xdr_enc_testres(struct rpc_rqst *req, __be32 *p,
const struct nlm_res *result)
static void nlm_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_nlm_stat(&xdr, result->status);
encode_nlm_testrply(&xdr, result);
return 0;
encode_cookie(xdr, &result->cookie);
encode_nlm_stat(xdr, result->status);
encode_nlm_testrply(xdr, result);
}
......@@ -586,7 +572,7 @@ static int nlm_xdr_dec_res(struct rpc_rqst *req, __be32 *p,
#define PROC(proc, argtype, restype) \
[NLMPROC_##proc] = { \
.p_proc = NLMPROC_##proc, \
.p_encode = (kxdrproc_t)nlm_xdr_enc_##argtype, \
.p_encode = (kxdreproc_t)nlm_xdr_enc_##argtype, \
.p_decode = (kxdrproc_t)nlm_xdr_dec_##restype, \
.p_arglen = NLM_##argtype##_sz, \
.p_replen = NLM_##restype##_sz, \
......
......@@ -459,25 +459,17 @@ static void encode_priv(struct xdr_stream *xdr, const struct nsm_args *argp)
xdr_encode_opaque_fixed(p, argp->priv->data, SM_PRIV_SIZE);
}
static int xdr_enc_mon(struct rpc_rqst *req, __be32 *p,
const struct nsm_args *argp)
static void nsm_xdr_enc_mon(struct rpc_rqst *req, struct xdr_stream *xdr,
const struct nsm_args *argp)
{
struct xdr_stream xdr;
xdr_init_encode(&xdr, &req->rq_snd_buf, p);
encode_mon_id(&xdr, argp);
encode_priv(&xdr, argp);
return 0;
encode_mon_id(xdr, argp);
encode_priv(xdr, argp);
}
static int xdr_enc_unmon(struct rpc_rqst *req, __be32 *p,
const struct nsm_args *argp)
static void nsm_xdr_enc_unmon(struct rpc_rqst *req, struct xdr_stream *xdr,
const struct nsm_args *argp)
{
struct xdr_stream xdr;
xdr_init_encode(&xdr, &req->rq_snd_buf, p);
encode_mon_id(&xdr, argp);
return 0;
encode_mon_id(xdr, argp);
}
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,
static struct rpc_procinfo nsm_procedures[] = {
[NSMPROC_MON] = {
.p_proc = NSMPROC_MON,
.p_encode = (kxdrproc_t)xdr_enc_mon,
.p_encode = (kxdreproc_t)nsm_xdr_enc_mon,
.p_decode = (kxdrproc_t)xdr_dec_stat_res,
.p_arglen = SM_mon_sz,
.p_replen = SM_monres_sz,
......@@ -533,7 +525,7 @@ static struct rpc_procinfo nsm_procedures[] = {
},
[NSMPROC_UNMON] = {
.p_proc = NSMPROC_UNMON,
.p_encode = (kxdrproc_t)xdr_enc_unmon,
.p_encode = (kxdreproc_t)nsm_xdr_enc_unmon,
.p_decode = (kxdrproc_t)xdr_dec_stat,
.p_arglen = SM_mon_id_sz,
.p_replen = SM_unmonres_sz,
......
......@@ -288,14 +288,10 @@ static void encode_mntdirpath(struct xdr_stream *xdr, const char *pathname)
xdr_encode_opaque(p, pathname, pathname_len);
}
static int mnt_enc_dirpath(struct rpc_rqst *req, __be32 *p,
const char *dirpath)
static void mnt_xdr_enc_dirpath(struct rpc_rqst *req, struct xdr_stream *xdr,
const char *dirpath)
{
struct xdr_stream xdr;
xdr_init_encode(&xdr, &req->rq_snd_buf, p);
encode_mntdirpath(&xdr, dirpath);
return 0;
encode_mntdirpath(xdr, dirpath);
}
/*
......@@ -460,7 +456,7 @@ static int mnt_dec_mountres3(struct rpc_rqst *req, __be32 *p,
static struct rpc_procinfo mnt_procedures[] = {
[MOUNTPROC_MNT] = {
.p_proc = MOUNTPROC_MNT,
.p_encode = (kxdrproc_t)mnt_enc_dirpath,
.p_encode = (kxdreproc_t)mnt_xdr_enc_dirpath,
.p_decode = (kxdrproc_t)mnt_dec_mountres,
.p_arglen = MNT_enc_dirpath_sz,
.p_replen = MNT_dec_mountres_sz,
......@@ -469,7 +465,7 @@ static struct rpc_procinfo mnt_procedures[] = {
},
[MOUNTPROC_UMNT] = {
.p_proc = MOUNTPROC_UMNT,
.p_encode = (kxdrproc_t)mnt_enc_dirpath,
.p_encode = (kxdreproc_t)mnt_xdr_enc_dirpath,
.p_arglen = MNT_enc_dirpath_sz,
.p_statidx = MOUNTPROC_UMNT,
.p_name = "UMOUNT",
......@@ -479,7 +475,7 @@ static struct rpc_procinfo mnt_procedures[] = {
static struct rpc_procinfo mnt3_procedures[] = {
[MOUNTPROC3_MNT] = {
.p_proc = MOUNTPROC3_MNT,
.p_encode = (kxdrproc_t)mnt_enc_dirpath,
.p_encode = (kxdreproc_t)mnt_xdr_enc_dirpath,
.p_decode = (kxdrproc_t)mnt_dec_mountres3,
.p_arglen = MNT_enc_dirpath_sz,
.p_replen = MNT_dec_mountres3_sz,
......@@ -488,7 +484,7 @@ static struct rpc_procinfo mnt3_procedures[] = {
},
[MOUNTPROC3_UMNT] = {
.p_proc = MOUNTPROC3_UMNT,
.p_encode = (kxdrproc_t)mnt_enc_dirpath,
.p_encode = (kxdreproc_t)mnt_xdr_enc_dirpath,
.p_arglen = MNT_enc_dirpath_sz,
.p_statidx = MOUNTPROC3_UMNT,
.p_name = "UMOUNT",
......
......@@ -558,14 +558,11 @@ static int decode_diropres(struct xdr_stream *xdr, struct nfs_diropok *result)
* "NFS: Network File System Protocol Specification".
*/
static int nfs2_xdr_enc_fhandle(struct rpc_rqst *req, __be32 *p,
const struct nfs_fh *fh)
static void nfs2_xdr_enc_fhandle(struct rpc_rqst *req,
struct xdr_stream *xdr,
const struct nfs_fh *fh)
{
struct xdr_stream xdr;
xdr_init_encode(&xdr, &req->rq_snd_buf, p);
encode_fhandle(&xdr, fh);
return 0;
encode_fhandle(xdr, fh);
}
/*
......@@ -576,37 +573,28 @@ static int nfs2_xdr_enc_fhandle(struct rpc_rqst *req, __be32 *p,
* sattr attributes;
* };
*/
static int nfs2_xdr_enc_sattrargs(struct rpc_rqst *req, __be32 *p,
const struct nfs_sattrargs *args)
static void nfs2_xdr_enc_sattrargs(struct rpc_rqst *req,
struct xdr_stream *xdr,
const struct nfs_sattrargs *args)
{
struct xdr_stream xdr;
xdr_init_encode(&xdr, &req->rq_snd_buf, p);
encode_fhandle(&xdr, args->fh);
encode_sattr(&xdr, args->sattr);
return 0;
encode_fhandle(xdr, args->fh);
encode_sattr(xdr, args->sattr);
}
static int nfs2_xdr_enc_diropargs(struct rpc_rqst *req, __be32 *p,
const struct nfs_diropargs *args)
static void nfs2_xdr_enc_diropargs(struct rpc_rqst *req,
struct xdr_stream *xdr,
const struct nfs_diropargs *args)
{
struct xdr_stream xdr;
xdr_init_encode(&xdr, &req->rq_snd_buf, p);
encode_diropargs(&xdr, args->fh, args->name, args->len);
return 0;
encode_diropargs(xdr, args->fh, args->name, args->len);
}
static int nfs2_xdr_enc_readlinkargs(struct rpc_rqst *req, __be32 *p,
const struct nfs_readlinkargs *args)
static void nfs2_xdr_enc_readlinkargs(struct rpc_rqst *req,
struct xdr_stream *xdr,
const struct nfs_readlinkargs *args)
{
struct xdr_stream xdr;
xdr_init_encode(&xdr, &req->rq_snd_buf, p);
encode_fhandle(&xdr, args->fh);
encode_fhandle(xdr, args->fh);
prepare_reply_buffer(req, args->pages, args->pgbase,
args->pglen, NFS_readlinkres_sz);
return 0;
}
/*
......@@ -634,17 +622,14 @@ static void encode_readargs(struct xdr_stream *xdr,
*p = cpu_to_be32(count);
}
static int nfs2_xdr_enc_readargs(struct rpc_rqst *req, __be32 *p,
const struct nfs_readargs *args)
static void nfs2_xdr_enc_readargs(struct rpc_rqst *req,
struct xdr_stream *xdr,
const struct nfs_readargs *args)
{
struct xdr_stream xdr;
xdr_init_encode(&xdr, &req->rq_snd_buf, p);
encode_readargs(&xdr, args);
encode_readargs(xdr, args);
prepare_reply_buffer(req, args->pages, args->pgbase,
args->count, NFS_readres_sz);
req->rq_rcv_buf.flags |= XDRBUF_READ;
return 0;
}
/*
......@@ -677,15 +662,12 @@ static void encode_writeargs(struct xdr_stream *xdr,
xdr_write_pages(xdr, args->pages, args->pgbase, count);
}
static int nfs2_xdr_enc_writeargs(struct rpc_rqst *req, __be32 *p,
const struct nfs_writeargs *args)
static void nfs2_xdr_enc_writeargs(struct rpc_rqst *req,
struct xdr_stream *xdr,
const struct nfs_writeargs *args)
{
struct xdr_stream xdr;
xdr_init_encode(&xdr, &req->rq_snd_buf, p);
encode_writeargs(&xdr, args);
xdr.buf->flags |= XDRBUF_WRITE;
return 0;
encode_writeargs(xdr, args);
xdr->buf->flags |= XDRBUF_WRITE;
}
/*
......@@ -696,25 +678,19 @@ static int nfs2_xdr_enc_writeargs(struct rpc_rqst *req, __be32 *p,
* sattr attributes;
* };
*/
static int nfs2_xdr_enc_createargs(struct rpc_rqst *req, __be32 *p,
const struct nfs_createargs *args)
static void nfs2_xdr_enc_createargs(struct rpc_rqst *req,
struct xdr_stream *xdr,
const struct nfs_createargs *args)
{
struct xdr_stream xdr;
xdr_init_encode(&xdr, &req->rq_snd_buf, p);
encode_diropargs(&xdr, args->fh, args->name, args->len);
encode_sattr(&xdr, args->sattr);
return 0;
encode_diropargs(xdr, args->fh, args->name, args->len);
encode_sattr(xdr, args->sattr);
}
static int nfs2_xdr_enc_removeargs(struct rpc_rqst *req, __be32 *p,
const struct nfs_removeargs *args)
static void nfs2_xdr_enc_removeargs(struct rpc_rqst *req,
struct xdr_stream *xdr,
const struct nfs_removeargs *args)
{
struct xdr_stream xdr;
xdr_init_encode(&xdr, &req->rq_snd_buf, p);
encode_diropargs(&xdr, args->fh, args->name.name, args->name.len);
return 0;
encode_diropargs(xdr, args->fh, args->name.name, args->name.len);
}
/*
......@@ -725,17 +701,15 @@ static int nfs2_xdr_enc_removeargs(struct rpc_rqst *req, __be32 *p,
* diropargs to;
* };
*/
static int nfs2_xdr_enc_renameargs(struct rpc_rqst *req, __be32 *p,
const struct nfs_renameargs *args)
static void nfs2_xdr_enc_renameargs(struct rpc_rqst *req,
struct xdr_stream *xdr,
const struct nfs_renameargs *args)
{
const struct qstr *old = args->old_name;
const struct qstr *new = args->new_name;
struct xdr_stream xdr;
xdr_init_encode(&xdr, &req->rq_snd_buf, p);
encode_diropargs(&xdr, args->old_dir, old->name, old->len);
encode_diropargs(&xdr, args->new_dir, new->name, new->len);
return 0;
encode_diropargs(xdr, args->old_dir, old->name, old->len);
encode_diropargs(xdr, args->new_dir, new->name, new->len);
}
/*
......@@ -746,15 +720,12 @@ static int nfs2_xdr_enc_renameargs(struct rpc_rqst *req, __be32 *p,
* diropargs to;
* };
*/
static int nfs2_xdr_enc_linkargs(struct rpc_rqst *req, __be32 *p,
const struct nfs_linkargs *args)
static void nfs2_xdr_enc_linkargs(struct rpc_rqst *req,
struct xdr_stream *xdr,
const struct nfs_linkargs *args)
{
struct xdr_stream xdr;
xdr_init_encode(&xdr, &req->rq_snd_buf, p);
encode_fhandle(&xdr, args->fromfh);
encode_diropargs(&xdr, args->tofh, args->toname, args->tolen);
return 0;
encode_fhandle(xdr, args->fromfh);
encode_diropargs(xdr, args->tofh, args->toname, args->tolen);
}
/*
......@@ -766,16 +737,13 @@ static int nfs2_xdr_enc_linkargs(struct rpc_rqst *req, __be32 *p,
* sattr attributes;
* };
*/
static int nfs2_xdr_enc_symlinkargs(struct rpc_rqst *req, __be32 *p,
const struct nfs_symlinkargs *args)
static void nfs2_xdr_enc_symlinkargs(struct rpc_rqst *req,
struct xdr_stream *xdr,
const struct nfs_symlinkargs *args)
{
struct xdr_stream xdr;
xdr_init_encode(&xdr, &req->rq_snd_buf, p);
encode_diropargs(&xdr, args->fromfh, args->fromname, args->fromlen);
encode_path(&xdr, args->pages, args->pathlen);
encode_sattr(&xdr, args->sattr);
return 0;
encode_diropargs(xdr, args->fromfh, args->fromname, args->fromlen);
encode_path(xdr, args->pages, args->pathlen);
encode_sattr(xdr, args->sattr);
}
/*
......@@ -799,16 +767,13 @@ static void encode_readdirargs(struct xdr_stream *xdr,
*p = cpu_to_be32(args->count);
}
static int nfs2_xdr_enc_readdirargs(struct rpc_rqst *req, __be32 *p,
const struct nfs_readdirargs *args)
static void nfs2_xdr_enc_readdirargs(struct rpc_rqst *req,
struct xdr_stream *xdr,
const struct nfs_readdirargs *args)
{
struct xdr_stream xdr;
xdr_init_encode(&xdr, &req->rq_snd_buf, p);
encode_readdirargs(&xdr, args);
encode_readdirargs(xdr, args);
prepare_reply_buffer(req, args->pages, 0,
args->count, NFS_readdirres_sz);
return 0;
}
/*
......@@ -1184,7 +1149,7 @@ int nfs_stat_to_errno(enum nfs_stat status)
#define PROC(proc, argtype, restype, timer) \
[NFSPROC_##proc] = { \
.p_proc = NFSPROC_##proc, \
.p_encode = (kxdrproc_t)nfs2_xdr_enc_##argtype, \
.p_encode = (kxdreproc_t)nfs2_xdr_enc_##argtype, \
.p_decode = (kxdrproc_t)nfs2_xdr_dec_##restype, \
.p_arglen = NFS_##argtype##_sz, \
.p_replen = NFS_##restype##_sz, \
......
This diff is collapsed.
This diff is collapsed.
......@@ -499,34 +499,28 @@ static int decode_cb_sequence4res(struct xdr_stream *xdr,
/*
* NB: Without this zero space reservation, callbacks over krb5p fail
*/
static int nfs4_xdr_enc_cb_null(struct rpc_rqst *req, __be32 *p, void *__unused)
static void nfs4_xdr_enc_cb_null(struct rpc_rqst *req, struct xdr_stream *xdr,
void *__unused)
{
struct xdr_stream xdrs, *xdr = &xdrs;
xdr_init_encode(&xdrs, &req->rq_snd_buf, p);
xdr_reserve_space(xdr, 0);
return 0;
}
/*
* 20.2. Operation 4: CB_RECALL - Recall a Delegation
*/
static int nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, __be32 *p,
const struct nfsd4_callback *cb)
static void nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, struct xdr_stream *xdr,
const struct nfsd4_callback *cb)
{
struct xdr_stream xdr;
const struct nfs4_delegation *args = cb->cb_op;
struct nfs4_cb_compound_hdr hdr = {
.ident = cb->cb_clp->cl_cb_ident,
.minorversion = cb->cb_minorversion,
};
xdr_init_encode(&xdr, &req->rq_snd_buf, p);
encode_cb_compound4args(&xdr, &hdr);
encode_cb_sequence4args(&xdr, cb, &hdr);
encode_cb_recall4args(&xdr, args, &hdr);
encode_cb_compound4args(xdr, &hdr);
encode_cb_sequence4args(xdr, cb, &hdr);
encode_cb_recall4args(xdr, args, &hdr);
encode_cb_nops(&hdr);
return 0;
}
......@@ -583,7 +577,7 @@ static int nfs4_xdr_dec_cb_recall(struct rpc_rqst *rqstp, __be32 *p,
#define PROC(proc, call, argtype, restype) \
[NFSPROC4_CLNT_##proc] = { \
.p_proc = NFSPROC4_CB_##call, \
.p_encode = (kxdrproc_t)nfs4_xdr_enc_##argtype, \
.p_encode = (kxdreproc_t)nfs4_xdr_enc_##argtype, \
.p_decode = (kxdrproc_t)nfs4_xdr_dec_##restype, \
.p_arglen = NFS4_enc_##argtype##_sz, \
.p_replen = NFS4_dec_##restype##_sz, \
......
......@@ -110,7 +110,7 @@ struct rpc_credops {
__be32 * (*crmarshal)(struct rpc_task *, __be32 *);
int (*crrefresh)(struct rpc_task *);
__be32 * (*crvalidate)(struct rpc_task *, __be32 *);
int (*crwrap_req)(struct rpc_task *, kxdrproc_t,
int (*crwrap_req)(struct rpc_task *, kxdreproc_t,
void *, __be32 *, void *);
int (*crunwrap_resp)(struct rpc_task *, kxdrproc_t,
void *, __be32 *, void *);
......@@ -139,7 +139,7 @@ struct rpc_cred * rpcauth_generic_bind_cred(struct rpc_task *, struct rpc_cred *