Commit be859405487324ed548f1ba11dc949b8230ab991

Authored by Harvey Harrison
Committed by David S. Miller
1 parent 63779436ab

fs: replace NIPQUAD()

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>

Showing 13 changed files with 39 additions and 43 deletions Side-by-side Diff

... ... @@ -646,7 +646,7 @@
646 646 }
647 647  
648 648 /* display one cell per line on subsequent lines */
649   - seq_printf(m, "%u.%u.%u.%u\n", NIPQUAD(addr->s_addr));
  649 + seq_printf(m, "%pI4\n", &addr->s_addr);
650 650 return 0;
651 651 }
652 652  
... ... @@ -737,7 +737,7 @@
737 737 }
738 738  
739 739 /* display one cell per line on subsequent lines */
740   - sprintf(ipaddr, "%u.%u.%u.%u", NIPQUAD(server->addr));
  740 + sprintf(ipaddr, "%pI4", &server->addr);
741 741 seq_printf(m, "%3d %-15.15s %5d\n",
742 742 atomic_read(&server->usage), ipaddr, server->fs_state);
743 743  
... ... @@ -105,7 +105,7 @@
105 105 {
106 106 struct afs_server *server, *candidate;
107 107  
108   - _enter("%p,"NIPQUAD_FMT, cell, NIPQUAD(addr->s_addr));
  108 + _enter("%p,%pI4", cell, &addr->s_addr);
109 109  
110 110 /* quick scan of the list to see if we already have the server */
111 111 read_lock(&cell->servers_lock);
... ... @@ -168,9 +168,8 @@
168 168 server_in_two_cells:
169 169 write_unlock(&cell->servers_lock);
170 170 kfree(candidate);
171   - printk(KERN_NOTICE "kAFS:"
172   - " Server "NIPQUAD_FMT" appears to be in two cells\n",
173   - NIPQUAD(*addr));
  171 + printk(KERN_NOTICE "kAFS: Server %pI4 appears to be in two cells\n",
  172 + addr);
174 173 _leave(" = -EEXIST");
175 174 return ERR_PTR(-EEXIST);
176 175 }
... ... @@ -184,7 +183,7 @@
184 183 struct rb_node *p;
185 184 struct in_addr addr = *_addr;
186 185  
187   - _enter(NIPQUAD_FMT, NIPQUAD(addr.s_addr));
  186 + _enter("%pI4", &addr.s_addr);
188 187  
189 188 read_lock(&afs_servers_lock);
190 189  
fs/cifs/cifs_spnego.c
... ... @@ -121,8 +121,7 @@
121 121  
122 122 /* add the server address */
123 123 if (server->addr.sockAddr.sin_family == AF_INET)
124   - sprintf(dp, "ip4=" NIPQUAD_FMT,
125   - NIPQUAD(server->addr.sockAddr.sin_addr));
  124 + sprintf(dp, "ip4=%pI4", &server->addr.sockAddr.sin_addr);
126 125 else if (server->addr.sockAddr.sin_family == AF_INET6)
127 126 sprintf(dp, "ip6=%pi6", &server->addr.sockAddr6.sin6_addr);
128 127 else
... ... @@ -2058,8 +2058,8 @@
2058 2058 rc = -ENOMEM;
2059 2059 else {
2060 2060 pSesInfo->server = srvTcp;
2061   - sprintf(pSesInfo->serverName, "%u.%u.%u.%u",
2062   - NIPQUAD(sin_server.sin_addr.s_addr));
  2061 + sprintf(pSesInfo->serverName, "%pI4",
  2062 + &sin_server.sin_addr.s_addr);
2063 2063 }
2064 2064  
2065 2065 if (!rc) {
... ... @@ -115,12 +115,12 @@
115 115 snprintf(buf, len, "unspecified");
116 116 break;
117 117 case AF_INET:
118   - snprintf(buf, len, NIPQUAD_FMT, NIPQUAD(sin->sin_addr.s_addr));
  118 + snprintf(buf, len, "%pI4", &sin->sin_addr.s_addr);
119 119 break;
120 120 case AF_INET6:
121 121 if (ipv6_addr_v4mapped(&sin6->sin6_addr))
122   - snprintf(buf, len, NIPQUAD_FMT,
123   - NIPQUAD(sin6->sin6_addr.s6_addr32[3]));
  122 + snprintf(buf, len, "%pI4",
  123 + &sin6->sin6_addr.s6_addr32[3]);
124 124 else
125 125 snprintf(buf, len, "%pI6", &sin6->sin6_addr);
126 126 break;
... ... @@ -179,7 +179,7 @@
179 179  
180 180 if (!nsm_use_hostnames) {
181 181 snprintf(buffer, XDR_ADDRBUF_LEN,
182   - NIPQUAD_FMT, NIPQUAD(argp->addr));
  182 + "%pI4", &argp->addr);
183 183 name = buffer;
184 184 }
185 185  
... ... @@ -329,7 +329,7 @@
329 329 }
330 330  
331 331 snprintf(nfs_data.hostname, sizeof(nfs_data.hostname),
332   - "%u.%u.%u.%u", NIPQUAD(servaddr));
  332 + "%pI4", &servaddr);
333 333 return 0;
334 334 }
335 335  
... ... @@ -421,8 +421,8 @@
421 421 {
422 422 struct sockaddr_in sin;
423 423  
424   - printk(KERN_NOTICE "Looking up port of RPC %d/%d on %u.%u.%u.%u\n",
425   - program, version, NIPQUAD(servaddr));
  424 + printk(KERN_NOTICE "Looking up port of RPC %d/%d on %pI4\n",
  425 + program, version, &servaddr);
426 426 set_sockaddr(&sin, servaddr, 0);
427 427 return rpcb_getport_sync(&sin, program, version, proto);
428 428 }
... ... @@ -462,8 +462,7 @@
462 462 switch (sap->sa_family) {
463 463 case AF_INET: {
464 464 struct sockaddr_in *sin = (struct sockaddr_in *)sap;
465   - seq_printf(m, ",mountaddr=" NIPQUAD_FMT,
466   - NIPQUAD(sin->sin_addr.s_addr));
  465 + seq_printf(m, ",mountaddr=%pI4", &sin->sin_addr.s_addr);
467 466 break;
468 467 }
469 468 case AF_INET6: {
... ... @@ -719,8 +719,8 @@
719 719 status = nfserr_clid_inuse;
720 720 if (!same_creds(&conf->cl_cred, &rqstp->rq_cred)
721 721 || conf->cl_addr != sin->sin_addr.s_addr) {
722   - dprintk("NFSD: setclientid: string in use by client"
723   - "at %u.%u.%u.%u\n", NIPQUAD(conf->cl_addr));
  722 + dprintk("NFSD: setclientid: string in use by clientat %pI4\n",
  723 + &conf->cl_addr);
724 724 goto out;
725 725 }
726 726 }
... ... @@ -330,7 +330,7 @@
330 330 return -EINVAL;
331 331  
332 332 /* get ipv4 address */
333   - if (sscanf(fo_path, NIPQUAD_FMT "%c", &b1, &b2, &b3, &b4, &c) != 4)
  333 + if (sscanf(fo_path, "%u.%u.%u.%u%c", &b1, &b2, &b3, &b4, &c) != 4)
334 334 return -EINVAL;
335 335 if (b1 > 255 || b2 > 255 || b3 > 255 || b4 > 255)
336 336 return -EINVAL;
fs/ocfs2/cluster/netdebug.c
... ... @@ -304,8 +304,8 @@
304 304 * use of it here generates a warning with -Wbitwise */
305 305 seq_printf(seq, "%p:\n"
306 306 " krefs: %d\n"
307   - " sock: %u.%u.%u.%u:%u -> "
308   - "%u.%u.%u.%u:%u\n"
  307 + " sock: %pI4:%u -> "
  308 + "%pI4:%u\n"
309 309 " remote node: %s\n"
310 310 " page off: %zu\n"
311 311 " handshake ok: %u\n"
... ... @@ -319,8 +319,8 @@
319 319 " func type: %u\n",
320 320 sc,
321 321 atomic_read(&sc->sc_kref.refcount),
322   - NIPQUAD(saddr), inet ? ntohs(sport) : 0,
323   - NIPQUAD(daddr), inet ? ntohs(dport) : 0,
  322 + &saddr, inet ? ntohs(sport) : 0,
  323 + &daddr, inet ? ntohs(dport) : 0,
324 324 sc->sc_node->nd_name,
325 325 sc->sc_page_off,
326 326 sc->sc_handshake_ok,
fs/ocfs2/cluster/nodemanager.c
... ... @@ -250,7 +250,7 @@
250 250  
251 251 static ssize_t o2nm_node_ipv4_address_read(struct o2nm_node *node, char *page)
252 252 {
253   - return sprintf(page, "%u.%u.%u.%u\n", NIPQUAD(node->nd_ipv4_address));
  253 + return sprintf(page, "%pI4\n", &node->nd_ipv4_address);
254 254 }
255 255  
256 256 static ssize_t o2nm_node_ipv4_address_write(struct o2nm_node *node,
fs/ocfs2/cluster/tcp.c
... ... @@ -1597,8 +1597,8 @@
1597 1597 ret = sock->ops->bind(sock, (struct sockaddr *)&myaddr,
1598 1598 sizeof(myaddr));
1599 1599 if (ret) {
1600   - mlog(ML_ERROR, "bind failed with %d at address %u.%u.%u.%u\n",
1601   - ret, NIPQUAD(mynode->nd_ipv4_address));
  1600 + mlog(ML_ERROR, "bind failed with %d at address %pI4\n",
  1601 + ret, &mynode->nd_ipv4_address);
1602 1602 goto out;
1603 1603 }
1604 1604  
1605 1605  
... ... @@ -1790,17 +1790,16 @@
1790 1790  
1791 1791 node = o2nm_get_node_by_ip(sin.sin_addr.s_addr);
1792 1792 if (node == NULL) {
1793   - mlog(ML_NOTICE, "attempt to connect from unknown node at "
1794   - "%u.%u.%u.%u:%d\n", NIPQUAD(sin.sin_addr.s_addr),
1795   - ntohs(sin.sin_port));
  1793 + mlog(ML_NOTICE, "attempt to connect from unknown node at %pI4:%d\n",
  1794 + &sin.sin_addr.s_addr, ntohs(sin.sin_port));
1796 1795 ret = -EINVAL;
1797 1796 goto out;
1798 1797 }
1799 1798  
1800 1799 if (o2nm_this_node() > node->nd_num) {
1801 1800 mlog(ML_NOTICE, "unexpected connect attempted from a lower "
1802   - "numbered node '%s' at " "%u.%u.%u.%u:%d with num %u\n",
1803   - node->nd_name, NIPQUAD(sin.sin_addr.s_addr),
  1801 + "numbered node '%s' at " "%pI4:%d with num %u\n",
  1802 + node->nd_name, &sin.sin_addr.s_addr,
1804 1803 ntohs(sin.sin_port), node->nd_num);
1805 1804 ret = -EINVAL;
1806 1805 goto out;
... ... @@ -1810,8 +1809,8 @@
1810 1809 * and tries to connect before we see their heartbeat */
1811 1810 if (!o2hb_check_node_heartbeating_from_callback(node->nd_num)) {
1812 1811 mlog(ML_CONN, "attempt to connect from node '%s' at "
1813   - "%u.%u.%u.%u:%d but it isn't heartbeating\n",
1814   - node->nd_name, NIPQUAD(sin.sin_addr.s_addr),
  1812 + "%pI4:%d but it isn't heartbeating\n",
  1813 + node->nd_name, &sin.sin_addr.s_addr,
1815 1814 ntohs(sin.sin_port));
1816 1815 ret = -EINVAL;
1817 1816 goto out;
... ... @@ -1827,8 +1826,8 @@
1827 1826 spin_unlock(&nn->nn_lock);
1828 1827 if (ret) {
1829 1828 mlog(ML_NOTICE, "attempt to connect from node '%s' at "
1830   - "%u.%u.%u.%u:%d but it already has an open connection\n",
1831   - node->nd_name, NIPQUAD(sin.sin_addr.s_addr),
  1829 + "%pI4:%d but it already has an open connection\n",
  1830 + node->nd_name, &sin.sin_addr.s_addr,
1832 1831 ntohs(sin.sin_port));
1833 1832 goto out;
1834 1833 }
1835 1834  
... ... @@ -1924,15 +1923,15 @@
1924 1923 sock->sk->sk_reuse = 1;
1925 1924 ret = sock->ops->bind(sock, (struct sockaddr *)&sin, sizeof(sin));
1926 1925 if (ret < 0) {
1927   - mlog(ML_ERROR, "unable to bind socket at %u.%u.%u.%u:%u, "
1928   - "ret=%d\n", NIPQUAD(addr), ntohs(port), ret);
  1926 + mlog(ML_ERROR, "unable to bind socket at %pI4:%u, "
  1927 + "ret=%d\n", &addr, ntohs(port), ret);
1929 1928 goto out;
1930 1929 }
1931 1930  
1932 1931 ret = sock->ops->listen(sock, 64);
1933 1932 if (ret < 0) {
1934   - mlog(ML_ERROR, "unable to listen on %u.%u.%u.%u:%u, ret=%d\n",
1935   - NIPQUAD(addr), ntohs(port), ret);
  1933 + mlog(ML_ERROR, "unable to listen on %pI4:%u, ret=%d\n",
  1934 + &addr, ntohs(port), ret);
1936 1935 }
1937 1936  
1938 1937 out: