Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 63f8de37 authored by Christoph Hellwig's avatar Christoph Hellwig
Browse files

sunrpc: properly type pc_encode callbacks



Drop the resp argument as it can trivially be derived from the rqstp
argument.  With that all functions now have the same prototype, and we
can remove the unsafe casting to kxdrproc_t.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent 026fec7e
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -497,7 +497,7 @@ struct nlm_void { int dummy; };
#define PROC(name, xargt, xrest, argt, rest, respsize)	\
#define PROC(name, xargt, xrest, argt, rest, respsize)	\
 { .pc_func	= nlm4svc_proc_##name,	\
 { .pc_func	= nlm4svc_proc_##name,	\
   .pc_decode	= nlm4svc_decode_##xargt,	\
   .pc_decode	= nlm4svc_decode_##xargt,	\
   .pc_encode	= (kxdrproc_t) nlm4svc_encode_##xrest,	\
   .pc_encode	= nlm4svc_encode_##xrest,	\
   .pc_release	= NULL,					\
   .pc_release	= NULL,					\
   .pc_argsize	= sizeof(struct nlm_##argt),		\
   .pc_argsize	= sizeof(struct nlm_##argt),		\
   .pc_ressize	= sizeof(struct nlm_##rest),		\
   .pc_ressize	= sizeof(struct nlm_##rest),		\
+1 −1
Original line number Original line Diff line number Diff line
@@ -539,7 +539,7 @@ struct nlm_void { int dummy; };
#define PROC(name, xargt, xrest, argt, rest, respsize)	\
#define PROC(name, xargt, xrest, argt, rest, respsize)	\
 { .pc_func	= nlmsvc_proc_##name,			\
 { .pc_func	= nlmsvc_proc_##name,			\
   .pc_decode	= nlmsvc_decode_##xargt,		\
   .pc_decode	= nlmsvc_decode_##xargt,		\
   .pc_encode	= (kxdrproc_t) nlmsvc_encode_##xrest,	\
   .pc_encode	= nlmsvc_encode_##xrest,		\
   .pc_release	= NULL,					\
   .pc_release	= NULL,					\
   .pc_argsize	= sizeof(struct nlm_##argt),		\
   .pc_argsize	= sizeof(struct nlm_##argt),		\
   .pc_ressize	= sizeof(struct nlm_##rest),		\
   .pc_ressize	= sizeof(struct nlm_##rest),		\
+10 −4
Original line number Original line Diff line number Diff line
@@ -200,8 +200,10 @@ nlmsvc_decode_testargs(struct svc_rqst *rqstp, __be32 *p)
}
}


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

	if (!(p = nlm_encode_testres(p, resp)))
	if (!(p = nlm_encode_testres(p, resp)))
		return 0;
		return 0;
	return xdr_ressize_check(rqstp, p);
	return xdr_ressize_check(rqstp, p);
@@ -280,8 +282,10 @@ nlmsvc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p)
}
}


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

	if (!(p = nlm_encode_cookie(p, &resp->cookie)))
	if (!(p = nlm_encode_cookie(p, &resp->cookie)))
		return 0;
		return 0;
	*p++ = resp->status;
	*p++ = resp->status;
@@ -290,8 +294,10 @@ nlmsvc_encode_shareres(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
}
}


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

	if (!(p = nlm_encode_cookie(p, &resp->cookie)))
	if (!(p = nlm_encode_cookie(p, &resp->cookie)))
		return 0;
		return 0;
	*p++ = resp->status;
	*p++ = resp->status;
@@ -342,7 +348,7 @@ nlmsvc_decode_void(struct svc_rqst *rqstp, __be32 *p)
}
}


int
int
nlmsvc_encode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy)
nlmsvc_encode_void(struct svc_rqst *rqstp, __be32 *p)
{
{
	return xdr_ressize_check(rqstp, p);
	return xdr_ressize_check(rqstp, p);
}
}
+10 −4
Original line number Original line Diff line number Diff line
@@ -197,8 +197,10 @@ nlm4svc_decode_testargs(struct svc_rqst *rqstp, __be32 *p)
}
}


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

	if (!(p = nlm4_encode_testres(p, resp)))
	if (!(p = nlm4_encode_testres(p, resp)))
		return 0;
		return 0;
	return xdr_ressize_check(rqstp, p);
	return xdr_ressize_check(rqstp, p);
@@ -277,8 +279,10 @@ nlm4svc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p)
}
}


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

	if (!(p = nlm4_encode_cookie(p, &resp->cookie)))
	if (!(p = nlm4_encode_cookie(p, &resp->cookie)))
		return 0;
		return 0;
	*p++ = resp->status;
	*p++ = resp->status;
@@ -287,8 +291,10 @@ nlm4svc_encode_shareres(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
}
}


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

	if (!(p = nlm4_encode_cookie(p, &resp->cookie)))
	if (!(p = nlm4_encode_cookie(p, &resp->cookie)))
		return 0;
		return 0;
	*p++ = resp->status;
	*p++ = resp->status;
@@ -339,7 +345,7 @@ nlm4svc_decode_void(struct svc_rqst *rqstp, __be32 *p)
}
}


int
int
nlm4svc_encode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy)
nlm4svc_encode_void(struct svc_rqst *rqstp, __be32 *p)
{
{
	return xdr_ressize_check(rqstp, p);
	return xdr_ressize_check(rqstp, p);
}
}
+3 −3
Original line number Original line Diff line number Diff line
@@ -63,7 +63,7 @@ static int nfs4_decode_void(struct svc_rqst *rqstp, __be32 *p)
	return xdr_argsize_check(rqstp, p);
	return xdr_argsize_check(rqstp, p);
}
}


static int nfs4_encode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy)
static int nfs4_encode_void(struct svc_rqst *rqstp, __be32 *p)
{
{
	return xdr_ressize_check(rqstp, p);
	return xdr_ressize_check(rqstp, p);
}
}
@@ -999,12 +999,12 @@ static struct svc_procedure nfs4_callback_procedures1[] = {
	[CB_NULL] = {
	[CB_NULL] = {
		.pc_func = nfs4_callback_null,
		.pc_func = nfs4_callback_null,
		.pc_decode = nfs4_decode_void,
		.pc_decode = nfs4_decode_void,
		.pc_encode = (kxdrproc_t)nfs4_encode_void,
		.pc_encode = nfs4_encode_void,
		.pc_xdrressize = 1,
		.pc_xdrressize = 1,
	},
	},
	[CB_COMPOUND] = {
	[CB_COMPOUND] = {
		.pc_func = nfs4_callback_compound,
		.pc_func = nfs4_callback_compound,
		.pc_encode = (kxdrproc_t)nfs4_encode_void,
		.pc_encode = nfs4_encode_void,
		.pc_argsize = 256,
		.pc_argsize = 256,
		.pc_ressize = 256,
		.pc_ressize = 256,
		.pc_xdrressize = NFS4_CALLBACK_BUFSIZE,
		.pc_xdrressize = NFS4_CALLBACK_BUFSIZE,
Loading