All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Trond Myklebust <trond.myklebust@primarydata.com>,
	Anna Schumaker <anna.schumaker@netapp.com>,
	"J. Bruce Fields" <bfields@fieldses.org>,
	Jeff Layton <jlayton@poochiereds.net>
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 08/33] sunrpc: fix decoder callback prototypes
Date: Fri, 12 May 2017 18:16:36 +0200	[thread overview]
Message-ID: <20170512161701.22468-9-hch@lst.de> (raw)
In-Reply-To: <20170512161701.22468-1-hch@lst.de>

Declare the p_decode callbacks with the proper prototype instead of
casting to kxdrdproc_t and losing all type safety.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
---
 net/sunrpc/rpcb_clnt.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c
index d0269a39afdf..f67b9e2897b4 100644
--- a/net/sunrpc/rpcb_clnt.c
+++ b/net/sunrpc/rpcb_clnt.c
@@ -861,8 +861,9 @@ static void rpcb_enc_mapping(struct rpc_rqst *req, struct xdr_stream *xdr,
 }
 
 static int rpcb_dec_getport(struct rpc_rqst *req, struct xdr_stream *xdr,
-			    struct rpcbind_args *rpcb)
+			    void *data)
 {
+	struct rpcbind_args *rpcb = data;
 	unsigned long port;
 	__be32 *p;
 
@@ -883,8 +884,9 @@ static int rpcb_dec_getport(struct rpc_rqst *req, struct xdr_stream *xdr,
 }
 
 static int rpcb_dec_set(struct rpc_rqst *req, struct xdr_stream *xdr,
-			unsigned int *boolp)
+			void *data)
 {
+	unsigned int *boolp = data;
 	__be32 *p;
 
 	p = xdr_inline_decode(xdr, 4);
@@ -939,8 +941,9 @@ static void rpcb_enc_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr,
 }
 
 static int rpcb_dec_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr,
-			    struct rpcbind_args *rpcb)
+			    void *data)
 {
+	struct rpcbind_args *rpcb = data;
 	struct sockaddr_storage address;
 	struct sockaddr *sap = (struct sockaddr *)&address;
 	__be32 *p;
@@ -995,7 +998,7 @@ static struct rpc_procinfo rpcb_procedures2[] = {
 	[RPCBPROC_SET] = {
 		.p_proc		= RPCBPROC_SET,
 		.p_encode	= rpcb_enc_mapping,
-		.p_decode	= (kxdrdproc_t)rpcb_dec_set,
+		.p_decode	= rpcb_dec_set,
 		.p_arglen	= RPCB_mappingargs_sz,
 		.p_replen	= RPCB_setres_sz,
 		.p_statidx	= RPCBPROC_SET,
@@ -1005,7 +1008,7 @@ static struct rpc_procinfo rpcb_procedures2[] = {
 	[RPCBPROC_UNSET] = {
 		.p_proc		= RPCBPROC_UNSET,
 		.p_encode	= rpcb_enc_mapping,
-		.p_decode	= (kxdrdproc_t)rpcb_dec_set,
+		.p_decode	= rpcb_dec_set,
 		.p_arglen	= RPCB_mappingargs_sz,
 		.p_replen	= RPCB_setres_sz,
 		.p_statidx	= RPCBPROC_UNSET,
@@ -1015,7 +1018,7 @@ static struct rpc_procinfo rpcb_procedures2[] = {
 	[RPCBPROC_GETPORT] = {
 		.p_proc		= RPCBPROC_GETPORT,
 		.p_encode	= rpcb_enc_mapping,
-		.p_decode	= (kxdrdproc_t)rpcb_dec_getport,
+		.p_decode	= rpcb_dec_getport,
 		.p_arglen	= RPCB_mappingargs_sz,
 		.p_replen	= RPCB_getportres_sz,
 		.p_statidx	= RPCBPROC_GETPORT,
@@ -1028,7 +1031,7 @@ static struct rpc_procinfo rpcb_procedures3[] = {
 	[RPCBPROC_SET] = {
 		.p_proc		= RPCBPROC_SET,
 		.p_encode	= rpcb_enc_getaddr,
-		.p_decode	= (kxdrdproc_t)rpcb_dec_set,
+		.p_decode	= rpcb_dec_set,
 		.p_arglen	= RPCB_getaddrargs_sz,
 		.p_replen	= RPCB_setres_sz,
 		.p_statidx	= RPCBPROC_SET,
@@ -1038,7 +1041,7 @@ static struct rpc_procinfo rpcb_procedures3[] = {
 	[RPCBPROC_UNSET] = {
 		.p_proc		= RPCBPROC_UNSET,
 		.p_encode	= rpcb_enc_getaddr,
-		.p_decode	= (kxdrdproc_t)rpcb_dec_set,
+		.p_decode	= rpcb_dec_set,
 		.p_arglen	= RPCB_getaddrargs_sz,
 		.p_replen	= RPCB_setres_sz,
 		.p_statidx	= RPCBPROC_UNSET,
@@ -1048,7 +1051,7 @@ static struct rpc_procinfo rpcb_procedures3[] = {
 	[RPCBPROC_GETADDR] = {
 		.p_proc		= RPCBPROC_GETADDR,
 		.p_encode	= rpcb_enc_getaddr,
-		.p_decode	= (kxdrdproc_t)rpcb_dec_getaddr,
+		.p_decode	= rpcb_dec_getaddr,
 		.p_arglen	= RPCB_getaddrargs_sz,
 		.p_replen	= RPCB_getaddrres_sz,
 		.p_statidx	= RPCBPROC_GETADDR,
@@ -1061,7 +1064,7 @@ static struct rpc_procinfo rpcb_procedures4[] = {
 	[RPCBPROC_SET] = {
 		.p_proc		= RPCBPROC_SET,
 		.p_encode	= rpcb_enc_getaddr,
-		.p_decode	= (kxdrdproc_t)rpcb_dec_set,
+		.p_decode	= rpcb_dec_set,
 		.p_arglen	= RPCB_getaddrargs_sz,
 		.p_replen	= RPCB_setres_sz,
 		.p_statidx	= RPCBPROC_SET,
@@ -1071,7 +1074,7 @@ static struct rpc_procinfo rpcb_procedures4[] = {
 	[RPCBPROC_UNSET] = {
 		.p_proc		= RPCBPROC_UNSET,
 		.p_encode	= rpcb_enc_getaddr,
-		.p_decode	= (kxdrdproc_t)rpcb_dec_set,
+		.p_decode	= rpcb_dec_set,
 		.p_arglen	= RPCB_getaddrargs_sz,
 		.p_replen	= RPCB_setres_sz,
 		.p_statidx	= RPCBPROC_UNSET,
@@ -1081,7 +1084,7 @@ static struct rpc_procinfo rpcb_procedures4[] = {
 	[RPCBPROC_GETADDR] = {
 		.p_proc		= RPCBPROC_GETADDR,
 		.p_encode	= rpcb_enc_getaddr,
-		.p_decode	= (kxdrdproc_t)rpcb_dec_getaddr,
+		.p_decode	= rpcb_dec_getaddr,
 		.p_arglen	= RPCB_getaddrargs_sz,
 		.p_replen	= RPCB_getaddrres_sz,
 		.p_statidx	= RPCBPROC_GETADDR,
-- 
2.11.0


  parent reply	other threads:[~2017-05-12 16:17 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-12 16:16 remove function pointer casts and constify function tables Christoph Hellwig
2017-05-12 16:16 ` [PATCH 01/33] sunrpc: properly type argument to kxdreproc_t Christoph Hellwig
2017-05-12 16:16 ` [PATCH 02/33] sunrpc: fix encoder callback prototypes Christoph Hellwig
2017-05-12 16:16 ` [PATCH 03/33] lockd: " Christoph Hellwig
2017-05-12 16:16 ` [PATCH 04/33] nfs: " Christoph Hellwig
2017-05-12 16:16 ` [PATCH 05/33] nfsd: " Christoph Hellwig
2017-05-12 16:16 ` [PATCH 06/33] sunrpc/auth_gss: " Christoph Hellwig
2017-05-12 16:16 ` [PATCH 07/33] sunrpc: properly type argument to kxdrdproc_t Christoph Hellwig
2017-05-12 16:16 ` Christoph Hellwig [this message]
2017-05-12 16:16 ` [PATCH 09/33] sunrpc/auth_gss: fix decoder callback prototypes Christoph Hellwig
2017-05-12 16:16 ` [PATCH 10/33] nfsd: " Christoph Hellwig
2017-05-12 16:16 ` [PATCH 11/33] lockd: " Christoph Hellwig
2017-05-12 16:16 ` [PATCH 12/33] nfs: " Christoph Hellwig
2017-05-12 16:16 ` [PATCH 13/33] nfs: don't cast callback decode/proc/encode routines Christoph Hellwig
2017-05-12 16:16 ` [PATCH 14/33] lockd: fix some weird indentation Christoph Hellwig
2017-05-12 18:01   ` Jeff Layton
2017-05-12 16:16 ` [PATCH 15/33] sunrpc: move p_count out of struct rpc_procinfo Christoph Hellwig
2017-05-12 18:24   ` Jeff Layton
2017-05-12 16:16 ` [PATCH 16/33] nfs: use ARRAY_SIZE() in the nfsacl_version3 declaration Christoph Hellwig
2017-05-12 18:25   ` Jeff Layton
2017-05-12 16:16 ` [PATCH 17/33] sunrpc: mark all struct rpc_procinfo instances as const Christoph Hellwig
2017-05-12 18:30   ` Jeff Layton
2017-05-12 16:16 ` [PATCH 18/33] nfsd4: const-ify nfs_cb_version4 Christoph Hellwig
2017-05-12 18:31   ` Jeff Layton
2017-05-12 16:16 ` [PATCH 19/33] nfsd: use named initializers in PROC() Christoph Hellwig
2017-05-12 18:32   ` Jeff Layton
2017-05-12 16:16 ` [PATCH 20/33] nfsd: remove the unused PROC() macro in nfs3proc.c Christoph Hellwig
2017-05-12 18:33   ` Jeff Layton
2017-05-12 16:16 ` [PATCH 21/33] sunrpc: properly type pc_func callbacks Christoph Hellwig
2017-05-12 18:34   ` Jeff Layton
2017-05-12 16:16 ` [PATCH 22/33] sunrpc: properly type pc_release callbacks Christoph Hellwig
2017-05-12 16:16 ` [PATCH 23/33] sunrpc: properly type pc_decode callbacks Christoph Hellwig
2017-05-12 16:16 ` [PATCH 24/33] sunrpc: properly type pc_encode callbacks Christoph Hellwig
2017-05-12 16:16 ` [PATCH 25/33] sunrpc: remove kxdrproc_t Christoph Hellwig
2017-05-12 16:16 ` [PATCH 26/33] nfsd4: properly type op_set_currentstateid callbacks Christoph Hellwig
2017-05-12 16:16 ` [PATCH 27/33] nfsd4: properly type op_get_currentstateid callbacks Christoph Hellwig
2017-05-12 16:16 ` [PATCH 28/33] nfsd4: remove nfsd4op_rsize Christoph Hellwig
2017-05-12 16:16 ` [PATCH 29/33] nfsd4: properly type op_func callbacks Christoph Hellwig
2017-05-12 16:16 ` [PATCH 30/33] sunrpc: move pc_count out of struct svc_procinfo Christoph Hellwig
2017-05-12 16:16 ` [PATCH 31/33] sunrpc: mark all struct svc_procinfo instances as const Christoph Hellwig
2017-05-12 16:17 ` [PATCH 32/33] sunrpc: mark all struct svc_version " Christoph Hellwig
2017-05-12 16:17 ` [PATCH 33/33] nfsd4: const-ify nfsd4_ops Christoph Hellwig
2017-05-12 18:42   ` Jeff Layton
2017-05-12 20:14 ` remove function pointer casts and constify function tables Trond Myklebust
2017-05-12 22:04   ` bfields
2017-05-13  7:25   ` hch
2017-05-13 16:10     ` Trond Myklebust
2017-05-15 15:21       ` bfields
2017-05-15 15:44         ` hch
2017-05-23  8:11           ` hch
2017-05-23 12:23             ` bfields
2017-05-26 15:08               ` bfields
2017-05-26 15:09                 ` bfields
2017-05-26 19:31                   ` bfields
2017-05-30 16:26                     ` Michael S. Tsirkin
2017-05-30 16:26                       ` Michael S. Tsirkin
2017-05-30 16:58                       ` Michael S. Tsirkin
2017-05-31 20:57                         ` bfields
2017-05-31 20:57                         ` bfields
2017-05-30 16:58                       ` Michael S. Tsirkin
2017-05-31 21:09                       ` bfields
2017-05-31 21:09                       ` bfields
2017-05-31 21:15                         ` bfields
2017-05-31 21:15                         ` bfields
2017-05-30 17:03                     ` Michael S. Tsirkin
2017-05-30 17:03                     ` Michael S. Tsirkin
2017-05-31 21:00                       ` bfields
2017-05-31 21:00                       ` bfields
2017-05-26 19:31                   ` bfields
2017-05-26 15:09                 ` bfields

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170512161701.22468-9-hch@lst.de \
    --to=hch@lst.de \
    --cc=anna.schumaker@netapp.com \
    --cc=bfields@fieldses.org \
    --cc=jlayton@poochiereds.net \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@primarydata.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.