aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
authorHarvey Harrison <harvey.harrison@gmail.com>2008-10-31 03:54:56 -0400
committerDavid S. Miller <davem@davemloft.net>2008-10-31 03:54:56 -0400
commit21454aaad30651ba0dcc16fe5271bc12ee21f132 (patch)
treeeb525494d6f80a0e855840bc588ae1f422348b04 /net/sunrpc
parent14d5e834f6b36667c7da56374645f99b6cf30814 (diff)
net: replace NIPQUAD() in net/*/
Using NIPQUAD() with NIPQUAD_FMT, %d.%d.%d.%d or %u.%u.%u.%u can be replaced with %pI4 Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/clnt.c4
-rw-r--r--net/sunrpc/rpcb_clnt.c11
-rw-r--r--net/sunrpc/svcauth_unix.c17
-rw-r--r--net/sunrpc/svcsock.c6
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_transport.c12
-rw-r--r--net/sunrpc/xprtrdma/transport.c14
-rw-r--r--net/sunrpc/xprtrdma/verbs.c14
-rw-r--r--net/sunrpc/xprtsock.c15
8 files changed, 40 insertions, 53 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 8f067497c212..3ca518386d15 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -271,8 +271,8 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args)
271 case AF_INET: { 271 case AF_INET: {
272 struct sockaddr_in *sin = 272 struct sockaddr_in *sin =
273 (struct sockaddr_in *)args->address; 273 (struct sockaddr_in *)args->address;
274 snprintf(servername, sizeof(servername), NIPQUAD_FMT, 274 snprintf(servername, sizeof(servername), "%pI4",
275 NIPQUAD(sin->sin_addr.s_addr)); 275 &sin->sin_addr.s_addr);
276 break; 276 break;
277 } 277 }
278 case AF_INET6: { 278 case AF_INET6: {
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c
index 4c8adadc214d..03ae007641e4 100644
--- a/net/sunrpc/rpcb_clnt.c
+++ b/net/sunrpc/rpcb_clnt.c
@@ -270,10 +270,9 @@ static int rpcb_register_netid4(struct sockaddr_in *address_to_register,
270 char buf[32]; 270 char buf[32];
271 271
272 /* Construct AF_INET universal address */ 272 /* Construct AF_INET universal address */
273 snprintf(buf, sizeof(buf), 273 snprintf(buf, sizeof(buf), "%pI4.%u.%u",
274 NIPQUAD_FMT".%u.%u", 274 &address_to_register->sin_addr.s_addr,
275 NIPQUAD(address_to_register->sin_addr.s_addr), 275 port >> 8, port & 0xff);
276 port >> 8, port & 0xff);
277 map->r_addr = buf; 276 map->r_addr = buf;
278 277
279 dprintk("RPC: %sregistering [%u, %u, %s, '%s'] with " 278 dprintk("RPC: %sregistering [%u, %u, %s, '%s'] with "
@@ -422,8 +421,8 @@ int rpcb_getport_sync(struct sockaddr_in *sin, u32 prog, u32 vers, int prot)
422 struct rpc_clnt *rpcb_clnt; 421 struct rpc_clnt *rpcb_clnt;
423 int status; 422 int status;
424 423
425 dprintk("RPC: %s(" NIPQUAD_FMT ", %u, %u, %d)\n", 424 dprintk("RPC: %s(%pI4, %u, %u, %d)\n",
426 __func__, NIPQUAD(sin->sin_addr.s_addr), prog, vers, prot); 425 __func__, &sin->sin_addr.s_addr, prog, vers, prot);
427 426
428 rpcb_clnt = rpcb_create(NULL, (struct sockaddr *)sin, 427 rpcb_clnt = rpcb_create(NULL, (struct sockaddr *)sin,
429 sizeof(*sin), prot, RPCBVERS_2); 428 sizeof(*sin), prot, RPCBVERS_2);
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
index 16f714a247bc..82240e6127b2 100644
--- a/net/sunrpc/svcauth_unix.c
+++ b/net/sunrpc/svcauth_unix.c
@@ -162,11 +162,7 @@ static void ip_map_request(struct cache_detail *cd,
162 struct ip_map *im = container_of(h, struct ip_map, h); 162 struct ip_map *im = container_of(h, struct ip_map, h);
163 163
164 if (ipv6_addr_v4mapped(&(im->m_addr))) { 164 if (ipv6_addr_v4mapped(&(im->m_addr))) {
165 snprintf(text_addr, 20, NIPQUAD_FMT, 165 snprintf(text_addr, 20, "%pI4", &im->m_addr.s6_addr32[3]);
166 ntohl(im->m_addr.s6_addr32[3]) >> 24 & 0xff,
167 ntohl(im->m_addr.s6_addr32[3]) >> 16 & 0xff,
168 ntohl(im->m_addr.s6_addr32[3]) >> 8 & 0xff,
169 ntohl(im->m_addr.s6_addr32[3]) >> 0 & 0xff);
170 } else { 166 } else {
171 snprintf(text_addr, 40, "%pI6", &im->m_addr); 167 snprintf(text_addr, 40, "%pI6", &im->m_addr);
172 } 168 }
@@ -208,7 +204,7 @@ static int ip_map_parse(struct cache_detail *cd,
208 len = qword_get(&mesg, buf, mlen); 204 len = qword_get(&mesg, buf, mlen);
209 if (len <= 0) return -EINVAL; 205 if (len <= 0) return -EINVAL;
210 206
211 if (sscanf(buf, NIPQUAD_FMT "%c", &b1, &b2, &b3, &b4, &c) == 4) { 207 if (sscanf(buf, "%u.%u.%u.%u%c", &b1, &b2, &b3, &b4, &c) == 4) {
212 addr.s6_addr32[0] = 0; 208 addr.s6_addr32[0] = 0;
213 addr.s6_addr32[1] = 0; 209 addr.s6_addr32[1] = 0;
214 addr.s6_addr32[2] = htonl(0xffff); 210 addr.s6_addr32[2] = htonl(0xffff);
@@ -278,13 +274,8 @@ static int ip_map_show(struct seq_file *m,
278 dom = im->m_client->h.name; 274 dom = im->m_client->h.name;
279 275
280 if (ipv6_addr_v4mapped(&addr)) { 276 if (ipv6_addr_v4mapped(&addr)) {
281 seq_printf(m, "%s " NIPQUAD_FMT " %s\n", 277 seq_printf(m, "%s %pI4 %s\n",
282 im->m_class, 278 im->m_class, &addr.s6_addr32[3], dom);
283 ntohl(addr.s6_addr32[3]) >> 24 & 0xff,
284 ntohl(addr.s6_addr32[3]) >> 16 & 0xff,
285 ntohl(addr.s6_addr32[3]) >> 8 & 0xff,
286 ntohl(addr.s6_addr32[3]) >> 0 & 0xff,
287 dom);
288 } else { 279 } else {
289 seq_printf(m, "%s %pI6 %s\n", im->m_class, &addr, dom); 280 seq_printf(m, "%s %pI6 %s\n", im->m_class, &addr, dom);
290 } 281 }
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 95293f549e9c..6f7d1f2d2f36 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -250,10 +250,10 @@ static int one_sock_name(char *buf, struct svc_sock *svsk)
250 250
251 switch(svsk->sk_sk->sk_family) { 251 switch(svsk->sk_sk->sk_family) {
252 case AF_INET: 252 case AF_INET:
253 len = sprintf(buf, "ipv4 %s %u.%u.%u.%u %d\n", 253 len = sprintf(buf, "ipv4 %s %pI4 %d\n",
254 svsk->sk_sk->sk_protocol==IPPROTO_UDP? 254 svsk->sk_sk->sk_protocol == IPPROTO_UDP ?
255 "udp" : "tcp", 255 "udp" : "tcp",
256 NIPQUAD(inet_sk(svsk->sk_sk)->rcv_saddr), 256 &inet_sk(svsk->sk_sk)->rcv_saddr,
257 inet_sk(svsk->sk_sk)->num); 257 inet_sk(svsk->sk_sk)->num);
258 break; 258 break;
259 default: 259 default:
diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
index 6fb493cbd29f..f8500f018f8a 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
@@ -1048,21 +1048,21 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt)
1048 1048
1049 dprintk("svcrdma: new connection %p accepted with the following " 1049 dprintk("svcrdma: new connection %p accepted with the following "
1050 "attributes:\n" 1050 "attributes:\n"
1051 " local_ip : %d.%d.%d.%d\n" 1051 " local_ip : %pI4\n"
1052 " local_port : %d\n" 1052 " local_port : %d\n"
1053 " remote_ip : %d.%d.%d.%d\n" 1053 " remote_ip : %pI4\n"
1054 " remote_port : %d\n" 1054 " remote_port : %d\n"
1055 " max_sge : %d\n" 1055 " max_sge : %d\n"
1056 " sq_depth : %d\n" 1056 " sq_depth : %d\n"
1057 " max_requests : %d\n" 1057 " max_requests : %d\n"
1058 " ord : %d\n", 1058 " ord : %d\n",
1059 newxprt, 1059 newxprt,
1060 NIPQUAD(((struct sockaddr_in *)&newxprt->sc_cm_id-> 1060 &((struct sockaddr_in *)&newxprt->sc_cm_id->
1061 route.addr.src_addr)->sin_addr.s_addr), 1061 route.addr.src_addr)->sin_addr.s_addr,
1062 ntohs(((struct sockaddr_in *)&newxprt->sc_cm_id-> 1062 ntohs(((struct sockaddr_in *)&newxprt->sc_cm_id->
1063 route.addr.src_addr)->sin_port), 1063 route.addr.src_addr)->sin_port),
1064 NIPQUAD(((struct sockaddr_in *)&newxprt->sc_cm_id-> 1064 &((struct sockaddr_in *)&newxprt->sc_cm_id->
1065 route.addr.dst_addr)->sin_addr.s_addr), 1065 route.addr.dst_addr)->sin_addr.s_addr,
1066 ntohs(((struct sockaddr_in *)&newxprt->sc_cm_id-> 1066 ntohs(((struct sockaddr_in *)&newxprt->sc_cm_id->
1067 route.addr.dst_addr)->sin_port), 1067 route.addr.dst_addr)->sin_port),
1068 newxprt->sc_max_sge, 1068 newxprt->sc_max_sge,
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c
index 9839c3d94145..1dd6123070e9 100644
--- a/net/sunrpc/xprtrdma/transport.c
+++ b/net/sunrpc/xprtrdma/transport.c
@@ -174,7 +174,7 @@ xprt_rdma_format_addresses(struct rpc_xprt *xprt)
174 174
175 buf = kzalloc(20, GFP_KERNEL); 175 buf = kzalloc(20, GFP_KERNEL);
176 if (buf) 176 if (buf)
177 snprintf(buf, 20, NIPQUAD_FMT, NIPQUAD(addr->sin_addr.s_addr)); 177 snprintf(buf, 20, "%pI4", &addr->sin_addr.s_addr);
178 xprt->address_strings[RPC_DISPLAY_ADDR] = buf; 178 xprt->address_strings[RPC_DISPLAY_ADDR] = buf;
179 179
180 buf = kzalloc(8, GFP_KERNEL); 180 buf = kzalloc(8, GFP_KERNEL);
@@ -186,8 +186,8 @@ xprt_rdma_format_addresses(struct rpc_xprt *xprt)
186 186
187 buf = kzalloc(48, GFP_KERNEL); 187 buf = kzalloc(48, GFP_KERNEL);
188 if (buf) 188 if (buf)
189 snprintf(buf, 48, "addr="NIPQUAD_FMT" port=%u proto=%s", 189 snprintf(buf, 48, "addr=%pI4 port=%u proto=%s",
190 NIPQUAD(addr->sin_addr.s_addr), 190 &addr->sin_addr.s_addr,
191 ntohs(addr->sin_port), "rdma"); 191 ntohs(addr->sin_port), "rdma");
192 xprt->address_strings[RPC_DISPLAY_ALL] = buf; 192 xprt->address_strings[RPC_DISPLAY_ALL] = buf;
193 193
@@ -204,8 +204,8 @@ xprt_rdma_format_addresses(struct rpc_xprt *xprt)
204 204
205 buf = kzalloc(30, GFP_KERNEL); 205 buf = kzalloc(30, GFP_KERNEL);
206 if (buf) 206 if (buf)
207 snprintf(buf, 30, NIPQUAD_FMT".%u.%u", 207 snprintf(buf, 30, "%pI4.%u.%u",
208 NIPQUAD(addr->sin_addr.s_addr), 208 &addr->sin_addr.s_addr,
209 ntohs(addr->sin_port) >> 8, 209 ntohs(addr->sin_port) >> 8,
210 ntohs(addr->sin_port) & 0xff); 210 ntohs(addr->sin_port) & 0xff);
211 xprt->address_strings[RPC_DISPLAY_UNIVERSAL_ADDR] = buf; 211 xprt->address_strings[RPC_DISPLAY_UNIVERSAL_ADDR] = buf;
@@ -369,8 +369,8 @@ xprt_setup_rdma(struct xprt_create *args)
369 if (ntohs(sin->sin_port) != 0) 369 if (ntohs(sin->sin_port) != 0)
370 xprt_set_bound(xprt); 370 xprt_set_bound(xprt);
371 371
372 dprintk("RPC: %s: %u.%u.%u.%u:%u\n", __func__, 372 dprintk("RPC: %s: %pI4:%u\n",
373 NIPQUAD(sin->sin_addr.s_addr), ntohs(sin->sin_port)); 373 __func__, &sin->sin_addr.s_addr, ntohs(sin->sin_port));
374 374
375 /* Set max requests */ 375 /* Set max requests */
376 cdata.max_requests = xprt->max_reqs; 376 cdata.max_requests = xprt->max_reqs;
diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
index a5fef5e6c323..78f7f728ef10 100644
--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -323,12 +323,11 @@ rpcrdma_conn_upcall(struct rdma_cm_id *id, struct rdma_cm_event *event)
323 case RDMA_CM_EVENT_DEVICE_REMOVAL: 323 case RDMA_CM_EVENT_DEVICE_REMOVAL:
324 connstate = -ENODEV; 324 connstate = -ENODEV;
325connected: 325connected:
326 dprintk("RPC: %s: %s: %u.%u.%u.%u:%u" 326 dprintk("RPC: %s: %s: %pI4:%u (ep 0x%p event 0x%x)\n",
327 " (ep 0x%p event 0x%x)\n",
328 __func__, 327 __func__,
329 (event->event <= 11) ? conn[event->event] : 328 (event->event <= 11) ? conn[event->event] :
330 "unknown connection error", 329 "unknown connection error",
331 NIPQUAD(addr->sin_addr.s_addr), 330 &addr->sin_addr.s_addr,
332 ntohs(addr->sin_port), 331 ntohs(addr->sin_port),
333 ep, event->event); 332 ep, event->event);
334 atomic_set(&rpcx_to_rdmax(ep->rep_xprt)->rx_buf.rb_credits, 1); 333 atomic_set(&rpcx_to_rdmax(ep->rep_xprt)->rx_buf.rb_credits, 1);
@@ -348,18 +347,17 @@ connected:
348 if (connstate == 1) { 347 if (connstate == 1) {
349 int ird = attr.max_dest_rd_atomic; 348 int ird = attr.max_dest_rd_atomic;
350 int tird = ep->rep_remote_cma.responder_resources; 349 int tird = ep->rep_remote_cma.responder_resources;
351 printk(KERN_INFO "rpcrdma: connection to %u.%u.%u.%u:%u " 350 printk(KERN_INFO "rpcrdma: connection to %pI4:%u "
352 "on %s, memreg %d slots %d ird %d%s\n", 351 "on %s, memreg %d slots %d ird %d%s\n",
353 NIPQUAD(addr->sin_addr.s_addr), 352 &addr->sin_addr.s_addr,
354 ntohs(addr->sin_port), 353 ntohs(addr->sin_port),
355 ia->ri_id->device->name, 354 ia->ri_id->device->name,
356 ia->ri_memreg_strategy, 355 ia->ri_memreg_strategy,
357 xprt->rx_buf.rb_max_requests, 356 xprt->rx_buf.rb_max_requests,
358 ird, ird < 4 && ird < tird / 2 ? " (low!)" : ""); 357 ird, ird < 4 && ird < tird / 2 ? " (low!)" : "");
359 } else if (connstate < 0) { 358 } else if (connstate < 0) {
360 printk(KERN_INFO "rpcrdma: connection to %u.%u.%u.%u:%u " 359 printk(KERN_INFO "rpcrdma: connection to %pI4:%u closed (%d)\n",
361 "closed (%d)\n", 360 &addr->sin_addr.s_addr,
362 NIPQUAD(addr->sin_addr.s_addr),
363 ntohs(addr->sin_port), 361 ntohs(addr->sin_port),
364 connstate); 362 connstate);
365 } 363 }
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 82a9b6286dd3..c14d3fd8f328 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -284,8 +284,7 @@ static void xs_format_ipv4_peer_addresses(struct rpc_xprt *xprt,
284 284
285 buf = kzalloc(20, GFP_KERNEL); 285 buf = kzalloc(20, GFP_KERNEL);
286 if (buf) { 286 if (buf) {
287 snprintf(buf, 20, NIPQUAD_FMT, 287 snprintf(buf, 20, "pI4", &addr->sin_addr.s_addr);
288 NIPQUAD(addr->sin_addr.s_addr));
289 } 288 }
290 xprt->address_strings[RPC_DISPLAY_ADDR] = buf; 289 xprt->address_strings[RPC_DISPLAY_ADDR] = buf;
291 290
@@ -300,8 +299,8 @@ static void xs_format_ipv4_peer_addresses(struct rpc_xprt *xprt,
300 299
301 buf = kzalloc(48, GFP_KERNEL); 300 buf = kzalloc(48, GFP_KERNEL);
302 if (buf) { 301 if (buf) {
303 snprintf(buf, 48, "addr="NIPQUAD_FMT" port=%u proto=%s", 302 snprintf(buf, 48, "addr=%pI4 port=%u proto=%s",
304 NIPQUAD(addr->sin_addr.s_addr), 303 &addr->sin_addr.s_addr,
305 ntohs(addr->sin_port), 304 ntohs(addr->sin_port),
306 protocol); 305 protocol);
307 } 306 }
@@ -323,8 +322,8 @@ static void xs_format_ipv4_peer_addresses(struct rpc_xprt *xprt,
323 322
324 buf = kzalloc(30, GFP_KERNEL); 323 buf = kzalloc(30, GFP_KERNEL);
325 if (buf) { 324 if (buf) {
326 snprintf(buf, 30, NIPQUAD_FMT".%u.%u", 325 snprintf(buf, 30, "%pI4.%u.%u",
327 NIPQUAD(addr->sin_addr.s_addr), 326 &addr->sin_addr.s_addr,
328 ntohs(addr->sin_port) >> 8, 327 ntohs(addr->sin_port) >> 8,
329 ntohs(addr->sin_port) & 0xff); 328 ntohs(addr->sin_port) & 0xff);
330 } 329 }
@@ -1413,8 +1412,8 @@ static int xs_bind4(struct sock_xprt *transport, struct socket *sock)
1413 if (port > last) 1412 if (port > last)
1414 nloop++; 1413 nloop++;
1415 } while (err == -EADDRINUSE && nloop != 2); 1414 } while (err == -EADDRINUSE && nloop != 2);
1416 dprintk("RPC: %s "NIPQUAD_FMT":%u: %s (%d)\n", 1415 dprintk("RPC: %s %pI4:%u: %s (%d)\n",
1417 __func__, NIPQUAD(myaddr.sin_addr), 1416 __func__, &myaddr.sin_addr,
1418 port, err ? "failed" : "ok", err); 1417 port, err ? "failed" : "ok", err);
1419 return err; 1418 return err;
1420} 1419}