* [PATCH resend] net/sunrpc: Remove uses of NIPQUAD, use %pI4
@ 2010-03-06 6:46 Joe Perches
2010-03-07 23:28 ` David Miller
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Joe Perches @ 2010-03-06 6:46 UTC (permalink / raw)
To: Trond Myklebust; +Cc: linux-nfs, LKML
Originally submitted Jan 1, 2010
http://patchwork.kernel.org/patch/71221/
Convert NIPQUAD to the %pI4 format extension where possible
Convert %02x%02x%02x%02x/NIPQUAD to %08x/ntohl
Signed-off-by: Joe Perches <joe@perches.com>
---
net/sunrpc/xprtrdma/transport.c | 3 +--
net/sunrpc/xprtsock.c | 5 ++---
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c
index 7018eef..83d339f 100644
--- a/net/sunrpc/xprtrdma/transport.c
+++ b/net/sunrpc/xprtrdma/transport.c
@@ -165,8 +165,7 @@ xprt_rdma_format_addresses(struct rpc_xprt *xprt)
xprt->address_strings[RPC_DISPLAY_PROTO] = "rdma";
- (void)snprintf(buf, sizeof(buf), "%02x%02x%02x%02x",
- NIPQUAD(sin->sin_addr.s_addr));
+ (void)snprintf(buf, sizeof(buf), "%08x", ntohl(sin->sin_addr.s_addr));
xprt->address_strings[RPC_DISPLAY_HEX_ADDR] = kstrdup(buf, GFP_KERNEL);
(void)snprintf(buf, sizeof(buf), "%4hx", rpc_get_port(sap));
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 3d739e5..86234bc 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -297,12 +297,11 @@ static void xs_format_common_peer_addresses(struct rpc_xprt *xprt)
switch (sap->sa_family) {
case AF_INET:
sin = xs_addr_in(xprt);
- (void)snprintf(buf, sizeof(buf), "%02x%02x%02x%02x",
- NIPQUAD(sin->sin_addr.s_addr));
+ snprintf(buf, sizeof(buf), "%08x", ntohl(sin->sin_addr.s_addr));
break;
case AF_INET6:
sin6 = xs_addr_in6(xprt);
- (void)snprintf(buf, sizeof(buf), "%pi6", &sin6->sin6_addr);
+ snprintf(buf, sizeof(buf), "%pi6", &sin6->sin6_addr);
break;
default:
BUG();
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH resend] net/sunrpc: Remove uses of NIPQUAD, use %pI4 2010-03-06 6:46 [PATCH resend] net/sunrpc: Remove uses of NIPQUAD, use %pI4 Joe Perches @ 2010-03-07 23:28 ` David Miller 2010-03-08 13:58 ` Trond Myklebust 2010-03-08 15:46 ` Chuck Lever 2010-03-08 20:15 ` [PATCH resend] net/sunrpc: Remove uses of NIPQUAD, use %pI4 David Miller 2 siblings, 1 reply; 8+ messages in thread From: David Miller @ 2010-03-07 23:28 UTC (permalink / raw) To: joe; +Cc: Trond.Myklebust, linux-nfs, linux-kernel From: Joe Perches <joe@perches.com> Date: Fri, 05 Mar 2010 22:46:20 -0800 > Originally submitted Jan 1, 2010 > http://patchwork.kernel.org/patch/71221/ > > Convert NIPQUAD to the %pI4 format extension where possible > Convert %02x%02x%02x%02x/NIPQUAD to %08x/ntohl > > Signed-off-by: Joe Perches <joe@perches.com> Trond, are you going to integrate this? Otherwise I'm going to. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH resend] net/sunrpc: Remove uses of NIPQUAD, use %pI4 2010-03-07 23:28 ` David Miller @ 2010-03-08 13:58 ` Trond Myklebust 0 siblings, 0 replies; 8+ messages in thread From: Trond Myklebust @ 2010-03-08 13:58 UTC (permalink / raw) To: David Miller; +Cc: joe, linux-nfs, linux-kernel On Sun, 2010-03-07 at 15:28 -0800, David Miller wrote: > From: Joe Perches <joe@perches.com> > Date: Fri, 05 Mar 2010 22:46:20 -0800 > > > Originally submitted Jan 1, 2010 > > http://patchwork.kernel.org/patch/71221/ > > > > Convert NIPQUAD to the %pI4 format extension where possible > > Convert %02x%02x%02x%02x/NIPQUAD to %08x/ntohl > > > > Signed-off-by: Joe Perches <joe@perches.com> > > Trond, are you going to integrate this? > > Otherwise I'm going to. If you're planning another push to Linus then feel free to push this too. If not, then I do have a couple of small cleanups and fixes that I want to push before the merge window closes, so I could send Joe's patch together with those... Cheers Trond ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH resend] net/sunrpc: Remove uses of NIPQUAD, use %pI4 2010-03-06 6:46 [PATCH resend] net/sunrpc: Remove uses of NIPQUAD, use %pI4 Joe Perches 2010-03-07 23:28 ` David Miller @ 2010-03-08 15:46 ` Chuck Lever 2010-03-08 16:14 ` Joe Perches 2010-03-08 16:38 ` [PATCH] net/sunrpc: Convert (void)snprintf to snprintf Joe Perches 2010-03-08 20:15 ` [PATCH resend] net/sunrpc: Remove uses of NIPQUAD, use %pI4 David Miller 2 siblings, 2 replies; 8+ messages in thread From: Chuck Lever @ 2010-03-08 15:46 UTC (permalink / raw) To: Joe Perches; +Cc: Trond Myklebust, linux-nfs, LKML On 03/06/2010 01:46 AM, Joe Perches wrote: > Originally submitted Jan 1, 2010 > http://patchwork.kernel.org/patch/71221/ > > Convert NIPQUAD to the %pI4 format extension where possible > Convert %02x%02x%02x%02x/NIPQUAD to %08x/ntohl > > Signed-off-by: Joe Perches<joe@perches.com> > --- > net/sunrpc/xprtrdma/transport.c | 3 +-- > net/sunrpc/xprtsock.c | 5 ++--- > 2 files changed, 3 insertions(+), 5 deletions(-) > > diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c > index 7018eef..83d339f 100644 > --- a/net/sunrpc/xprtrdma/transport.c > +++ b/net/sunrpc/xprtrdma/transport.c > @@ -165,8 +165,7 @@ xprt_rdma_format_addresses(struct rpc_xprt *xprt) > > xprt->address_strings[RPC_DISPLAY_PROTO] = "rdma"; > > - (void)snprintf(buf, sizeof(buf), "%02x%02x%02x%02x", > - NIPQUAD(sin->sin_addr.s_addr)); > + (void)snprintf(buf, sizeof(buf), "%08x", ntohl(sin->sin_addr.s_addr)); > xprt->address_strings[RPC_DISPLAY_HEX_ADDR] = kstrdup(buf, GFP_KERNEL); > > (void)snprintf(buf, sizeof(buf), "%4hx", rpc_get_port(sap)); > diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c > index 3d739e5..86234bc 100644 > --- a/net/sunrpc/xprtsock.c > +++ b/net/sunrpc/xprtsock.c > @@ -297,12 +297,11 @@ static void xs_format_common_peer_addresses(struct rpc_xprt *xprt) > switch (sap->sa_family) { > case AF_INET: > sin = xs_addr_in(xprt); > - (void)snprintf(buf, sizeof(buf), "%02x%02x%02x%02x", > - NIPQUAD(sin->sin_addr.s_addr)); > + snprintf(buf, sizeof(buf), "%08x", ntohl(sin->sin_addr.s_addr)); > break; > case AF_INET6: > sin6 = xs_addr_in6(xprt); > - (void)snprintf(buf, sizeof(buf), "%pi6",&sin6->sin6_addr); > + snprintf(buf, sizeof(buf), "%pi6",&sin6->sin6_addr); Why remove the (void) here, but not in xprtrdma/transport.c? IMO the (void) cast should be left in place at all three call sites. > break; > default: > BUG(); > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-nfs" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- chuck[dot]lever[at]oracle[dot]com ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH resend] net/sunrpc: Remove uses of NIPQUAD, use %pI4 2010-03-08 15:46 ` Chuck Lever @ 2010-03-08 16:14 ` Joe Perches 2010-03-08 16:38 ` [PATCH] net/sunrpc: Convert (void)snprintf to snprintf Joe Perches 1 sibling, 0 replies; 8+ messages in thread From: Joe Perches @ 2010-03-08 16:14 UTC (permalink / raw) To: Chuck Lever; +Cc: Trond Myklebust, linux-nfs, LKML On Mon, 2010-03-08 at 10:46 -0500, Chuck Lever wrote: > Why remove the (void) here, but not in xprtrdma/transport.c? IMO the > (void) cast should be left in place at all three call sites. I didn't notice it in xprtrdma/transport.c, otherwise I'd've removed it there too. When the result is not used, snprintf is most commonly not cast at all. (There's a space and a tab in the brackets of the grep string) $ grep -rP --include=*.[ch] "^[ ]+snprintf\s*\(" * | wc -l 1301 $ grep -rP --include=*.[ch] "^[ ]+\(\s*void\s*\)\s*snprintf\s*\(" * | wc -l 9 net/sunrpc/ has 7 of those. I'll get around to submitting patches for all of them. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] net/sunrpc: Convert (void)snprintf to snprintf 2010-03-08 15:46 ` Chuck Lever 2010-03-08 16:14 ` Joe Perches @ 2010-03-08 16:38 ` Joe Perches 2010-03-08 20:16 ` David Miller 1 sibling, 1 reply; 8+ messages in thread From: Joe Perches @ 2010-03-08 16:38 UTC (permalink / raw) To: Chuck Lever; +Cc: Trond Myklebust, linux-nfs, LKML (Applies on top of "Remove uses of NIPQUAD, use %pI4") Casts to void of snprintf are most uncommon in kernel source. 9 use casts, 1301 do not. Remove the remaining uses in net/sunrpc/ Signed-off-by: Joe Perches <joe@perches.com> --- net/sunrpc/xprtrdma/transport.c | 6 +++--- net/sunrpc/xprtsock.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c index 83d339f..f96c2fe 100644 --- a/net/sunrpc/xprtrdma/transport.c +++ b/net/sunrpc/xprtrdma/transport.c @@ -160,15 +160,15 @@ xprt_rdma_format_addresses(struct rpc_xprt *xprt) (void)rpc_ntop(sap, buf, sizeof(buf)); xprt->address_strings[RPC_DISPLAY_ADDR] = kstrdup(buf, GFP_KERNEL); - (void)snprintf(buf, sizeof(buf), "%u", rpc_get_port(sap)); + snprintf(buf, sizeof(buf), "%u", rpc_get_port(sap)); xprt->address_strings[RPC_DISPLAY_PORT] = kstrdup(buf, GFP_KERNEL); xprt->address_strings[RPC_DISPLAY_PROTO] = "rdma"; - (void)snprintf(buf, sizeof(buf), "%08x", ntohl(sin->sin_addr.s_addr)); + snprintf(buf, sizeof(buf), "%08x", ntohl(sin->sin_addr.s_addr)); xprt->address_strings[RPC_DISPLAY_HEX_ADDR] = kstrdup(buf, GFP_KERNEL); - (void)snprintf(buf, sizeof(buf), "%4hx", rpc_get_port(sap)); + snprintf(buf, sizeof(buf), "%4hx", rpc_get_port(sap)); xprt->address_strings[RPC_DISPLAY_HEX_PORT] = kstrdup(buf, GFP_KERNEL); /* netid */ diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 11f417b..75ab08e 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c @@ -314,10 +314,10 @@ static void xs_format_common_peer_ports(struct rpc_xprt *xprt) struct sockaddr *sap = xs_addr(xprt); char buf[128]; - (void)snprintf(buf, sizeof(buf), "%u", rpc_get_port(sap)); + snprintf(buf, sizeof(buf), "%u", rpc_get_port(sap)); xprt->address_strings[RPC_DISPLAY_PORT] = kstrdup(buf, GFP_KERNEL); - (void)snprintf(buf, sizeof(buf), "%4hx", rpc_get_port(sap)); + snprintf(buf, sizeof(buf), "%4hx", rpc_get_port(sap)); xprt->address_strings[RPC_DISPLAY_HEX_PORT] = kstrdup(buf, GFP_KERNEL); } ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] net/sunrpc: Convert (void)snprintf to snprintf 2010-03-08 16:38 ` [PATCH] net/sunrpc: Convert (void)snprintf to snprintf Joe Perches @ 2010-03-08 20:16 ` David Miller 0 siblings, 0 replies; 8+ messages in thread From: David Miller @ 2010-03-08 20:16 UTC (permalink / raw) To: joe; +Cc: chuck.lever, Trond.Myklebust, linux-nfs, linux-kernel From: Joe Perches <joe@perches.com> Date: Mon, 08 Mar 2010 08:38:30 -0800 > (Applies on top of "Remove uses of NIPQUAD, use %pI4") > > Casts to void of snprintf are most uncommon in kernel source. > 9 use casts, 1301 do not. > > Remove the remaining uses in net/sunrpc/ > > Signed-off-by: Joe Perches <joe@perches.com> Also applied, thanks Joe. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH resend] net/sunrpc: Remove uses of NIPQUAD, use %pI4 2010-03-06 6:46 [PATCH resend] net/sunrpc: Remove uses of NIPQUAD, use %pI4 Joe Perches 2010-03-07 23:28 ` David Miller 2010-03-08 15:46 ` Chuck Lever @ 2010-03-08 20:15 ` David Miller 2 siblings, 0 replies; 8+ messages in thread From: David Miller @ 2010-03-08 20:15 UTC (permalink / raw) To: joe; +Cc: Trond.Myklebust, linux-nfs, linux-kernel From: Joe Perches <joe@perches.com> Date: Fri, 05 Mar 2010 22:46:20 -0800 > Originally submitted Jan 1, 2010 > http://patchwork.kernel.org/patch/71221/ > > Convert NIPQUAD to the %pI4 format extension where possible > Convert %02x%02x%02x%02x/NIPQUAD to %08x/ntohl > > Signed-off-by: Joe Perches <joe@perches.com> Applied. ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-03-08 20:15 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-03-06 6:46 [PATCH resend] net/sunrpc: Remove uses of NIPQUAD, use %pI4 Joe Perches 2010-03-07 23:28 ` David Miller 2010-03-08 13:58 ` Trond Myklebust 2010-03-08 15:46 ` Chuck Lever 2010-03-08 16:14 ` Joe Perches 2010-03-08 16:38 ` [PATCH] net/sunrpc: Convert (void)snprintf to snprintf Joe Perches 2010-03-08 20:16 ` David Miller 2010-03-08 20:15 ` [PATCH resend] net/sunrpc: Remove uses of NIPQUAD, use %pI4 David Miller
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox