Commit fda49441 authored by Chuck Lever's avatar Chuck Lever Committed by J. Bruce Fields
Browse files

SUNRPC: Replace the "__be32 *p" parameter to .pc_encode



The passed-in value of the "__be32 *p" parameter is now unused in
every server-side XDR encoder, and can be removed.

Note also that there is a line in each encoder that sets up a local
pointer to a struct xdr_stream. Passing that pointer from the
dispatcher instead saves one line per encoder function.

Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 3b0ebb25
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -780,7 +780,6 @@ module_exit(exit_nlm);
static int nlmsvc_dispatch(struct svc_rqst *rqstp, __be32 *statp)
{
	const struct svc_procedure *procp = rqstp->rq_procinfo;
	struct kvec *resv = rqstp->rq_res.head;

	svcxdr_init_decode(rqstp);
	if (!procp->pc_decode(rqstp, &rqstp->rq_arg_stream))
@@ -793,7 +792,7 @@ static int nlmsvc_dispatch(struct svc_rqst *rqstp, __be32 *statp)
		return 1;

	svcxdr_init_encode(rqstp);
	if (!procp->pc_encode(rqstp, resv->iov_base + resv->iov_len))
	if (!procp->pc_encode(rqstp, &rqstp->rq_res_stream))
		goto out_encode_err;

	return 1;
+4 −7
Original line number Diff line number Diff line
@@ -314,15 +314,14 @@ nlmsvc_decode_notify(struct svc_rqst *rqstp, struct xdr_stream *xdr)
 */

int
nlmsvc_encode_void(struct svc_rqst *rqstp, __be32 *p)
nlmsvc_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{
	return 1;
}

int
nlmsvc_encode_testres(struct svc_rqst *rqstp, __be32 *p)
nlmsvc_encode_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{
	struct xdr_stream *xdr = &rqstp->rq_res_stream;
	struct nlm_res *resp = rqstp->rq_resp;

	return svcxdr_encode_cookie(xdr, &resp->cookie) &&
@@ -330,9 +329,8 @@ nlmsvc_encode_testres(struct svc_rqst *rqstp, __be32 *p)
}

int
nlmsvc_encode_res(struct svc_rqst *rqstp, __be32 *p)
nlmsvc_encode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{
	struct xdr_stream *xdr = &rqstp->rq_res_stream;
	struct nlm_res *resp = rqstp->rq_resp;

	return svcxdr_encode_cookie(xdr, &resp->cookie) &&
@@ -340,9 +338,8 @@ nlmsvc_encode_res(struct svc_rqst *rqstp, __be32 *p)
}

int
nlmsvc_encode_shareres(struct svc_rqst *rqstp, __be32 *p)
nlmsvc_encode_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{
	struct xdr_stream *xdr = &rqstp->rq_res_stream;
	struct nlm_res *resp = rqstp->rq_resp;

	if (!svcxdr_encode_cookie(xdr, &resp->cookie))
+4 −7
Original line number Diff line number Diff line
@@ -313,15 +313,14 @@ nlm4svc_decode_notify(struct svc_rqst *rqstp, struct xdr_stream *xdr)
 */

int
nlm4svc_encode_void(struct svc_rqst *rqstp, __be32 *p)
nlm4svc_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{
	return 1;
}

int
nlm4svc_encode_testres(struct svc_rqst *rqstp, __be32 *p)
nlm4svc_encode_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{
	struct xdr_stream *xdr = &rqstp->rq_res_stream;
	struct nlm_res *resp = rqstp->rq_resp;

	return svcxdr_encode_cookie(xdr, &resp->cookie) &&
@@ -329,9 +328,8 @@ nlm4svc_encode_testres(struct svc_rqst *rqstp, __be32 *p)
}

int
nlm4svc_encode_res(struct svc_rqst *rqstp, __be32 *p)
nlm4svc_encode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{
	struct xdr_stream *xdr = &rqstp->rq_res_stream;
	struct nlm_res *resp = rqstp->rq_resp;

	return svcxdr_encode_cookie(xdr, &resp->cookie) &&
@@ -339,9 +337,8 @@ nlm4svc_encode_res(struct svc_rqst *rqstp, __be32 *p)
}

int
nlm4svc_encode_shareres(struct svc_rqst *rqstp, __be32 *p)
nlm4svc_encode_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{
	struct xdr_stream *xdr = &rqstp->rq_res_stream;
	struct nlm_res *resp = rqstp->rq_resp;

	if (!svcxdr_encode_cookie(xdr, &resp->cookie))
+2 −2
Original line number Diff line number Diff line
@@ -67,9 +67,9 @@ static __be32 nfs4_callback_null(struct svc_rqst *rqstp)
 * svc_process_common() looks for an XDR encoder to know when
 * not to drop a Reply.
 */
static int nfs4_encode_void(struct svc_rqst *rqstp, __be32 *p)
static int nfs4_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{
	return xdr_ressize_check(rqstp, p);
	return 1;
}

static __be32 decode_string(struct xdr_stream *xdr, unsigned int *len,
+4 −4
Original line number Diff line number Diff line
@@ -240,9 +240,9 @@ nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
 */

/* GETACL */
static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p)
static int
nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{
	struct xdr_stream *xdr = &rqstp->rq_res_stream;
	struct nfsd3_getaclres *resp = rqstp->rq_resp;
	struct dentry *dentry = resp->fh.fh_dentry;
	struct inode *inode;
@@ -280,9 +280,9 @@ static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p)
}

/* ACCESS */
static int nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, __be32 *p)
static int
nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{
	struct xdr_stream *xdr = &rqstp->rq_res_stream;
	struct nfsd3_accessres *resp = rqstp->rq_resp;

	if (!svcxdr_encode_stat(xdr, resp->status))
Loading