net/sunrpc: Remove uses of NIPQUAD, use %pI4
authorJoe Perches <joe@perches.com>
Mon, 8 Mar 2010 20:15:28 +0000 (12:15 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 8 Mar 2010 20:15:28 +0000 (12:15 -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>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sunrpc/xprtrdma/transport.c
net/sunrpc/xprtsock.c

index 7018eef1dcdd970c381195c54928196100039416..83d339fd66d592f94d0f530005adb751d1fd04c7 100644 (file)
@@ -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));
index 3d739e5d15d8b65a77be7fcb80a9ed012ba7c0d3..86234bcf2e898b9a2b84b3894707ff3c7f6ecae2 100644 (file)
@@ -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();