fs: replace NIPQUAD()
authorHarvey Harrison <harvey.harrison@gmail.com>
Fri, 31 Oct 2008 07:56:28 +0000 (00:56 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 31 Oct 2008 07:56:28 +0000 (00:56 -0700)
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>
13 files changed:
fs/afs/proc.c
fs/afs/server.c
fs/cifs/cifs_spnego.c
fs/cifs/connect.c
fs/lockd/host.c
fs/lockd/mon.c
fs/nfs/nfsroot.c
fs/nfs/super.c
fs/nfsd/nfs4state.c
fs/nfsd/nfsctl.c
fs/ocfs2/cluster/netdebug.c
fs/ocfs2/cluster/nodemanager.c
fs/ocfs2/cluster/tcp.c

index 9f7d1ae70269ac9de86404e5b6eb36b6a4d34f29..7578c1ab9e0be9ec3260c4cce41b78287f213bce 100644 (file)
@@ -646,7 +646,7 @@ static int afs_proc_cell_vlservers_show(struct seq_file *m, void *v)
        }
 
        /* display one cell per line on subsequent lines */
-       seq_printf(m, "%u.%u.%u.%u\n", NIPQUAD(addr->s_addr));
+       seq_printf(m, "%pI4\n", &addr->s_addr);
        return 0;
 }
 
@@ -737,7 +737,7 @@ static int afs_proc_cell_servers_show(struct seq_file *m, void *v)
        }
 
        /* display one cell per line on subsequent lines */
-       sprintf(ipaddr, "%u.%u.%u.%u", NIPQUAD(server->addr));
+       sprintf(ipaddr, "%pI4", &server->addr);
        seq_printf(m, "%3d %-15.15s %5d\n",
                   atomic_read(&server->usage), ipaddr, server->fs_state);
 
index 28f2451419e1406b3be0aa0a0258fe14f73a0834..f4909951667554b6e4263ebebedc6d2513599d48 100644 (file)
@@ -105,7 +105,7 @@ struct afs_server *afs_lookup_server(struct afs_cell *cell,
 {
        struct afs_server *server, *candidate;
 
-       _enter("%p,"NIPQUAD_FMT, cell, NIPQUAD(addr->s_addr));
+       _enter("%p,%pI4", cell, &addr->s_addr);
 
        /* quick scan of the list to see if we already have the server */
        read_lock(&cell->servers_lock);
@@ -168,9 +168,8 @@ found_server:
 server_in_two_cells:
        write_unlock(&cell->servers_lock);
        kfree(candidate);
-       printk(KERN_NOTICE "kAFS:"
-              " Server "NIPQUAD_FMT" appears to be in two cells\n",
-              NIPQUAD(*addr));
+       printk(KERN_NOTICE "kAFS: Server %pI4 appears to be in two cells\n",
+              addr);
        _leave(" = -EEXIST");
        return ERR_PTR(-EEXIST);
 }
@@ -184,7 +183,7 @@ struct afs_server *afs_find_server(const struct in_addr *_addr)
        struct rb_node *p;
        struct in_addr addr = *_addr;
 
-       _enter(NIPQUAD_FMT, NIPQUAD(addr.s_addr));
+       _enter("%pI4", &addr.s_addr);
 
        read_lock(&afs_servers_lock);
 
index 0e186cd20ad949e2b647e30f664ff517e741ab02..359144c510b9f0d18e80ec006a47ab21ac4852ab 100644 (file)
@@ -121,8 +121,7 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo)
 
        /* add the server address */
        if (server->addr.sockAddr.sin_family == AF_INET)
-               sprintf(dp, "ip4=" NIPQUAD_FMT,
-                       NIPQUAD(server->addr.sockAddr.sin_addr));
+               sprintf(dp, "ip4=%pI4", &server->addr.sockAddr.sin_addr);
        else if (server->addr.sockAddr.sin_family == AF_INET6)
                sprintf(dp, "ip6=%pi6", &server->addr.sockAddr6.sin6_addr);
        else
index 71b7661e2260229efc1fa8eadd7ebf187a5ec8a7..cd54fee3f05c68912b130caa524ea40381f3255c 100644 (file)
@@ -2058,8 +2058,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
                        rc = -ENOMEM;
                else {
                        pSesInfo->server = srvTcp;
-                       sprintf(pSesInfo->serverName, "%u.%u.%u.%u",
-                               NIPQUAD(sin_server.sin_addr.s_addr));
+                       sprintf(pSesInfo->serverName, "%pI4",
+                               &sin_server.sin_addr.s_addr);
                }
 
                if (!rc) {
index c8ab7d70390dcc48da2858c441d59998a7fbc5ce..c48c26380771f731655038ac7bb4ef53af0a84dd 100644 (file)
@@ -115,12 +115,12 @@ static void nlm_display_address(const struct sockaddr *sap,
                snprintf(buf, len, "unspecified");
                break;
        case AF_INET:
-               snprintf(buf, len, NIPQUAD_FMT, NIPQUAD(sin->sin_addr.s_addr));
+               snprintf(buf, len, "%pI4", &sin->sin_addr.s_addr);
                break;
        case AF_INET6:
                if (ipv6_addr_v4mapped(&sin6->sin6_addr))
-                       snprintf(buf, len, NIPQUAD_FMT,
-                                NIPQUAD(sin6->sin6_addr.s6_addr32[3]));
+                       snprintf(buf, len, "%pI4",
+                                &sin6->sin6_addr.s6_addr32[3]);
                else
                        snprintf(buf, len, "%pI6", &sin6->sin6_addr);
                break;
index 4e7e958e8f6753236832ed9ebd82f6bae0746899..ffd3461f75efb332f44d8ce5b7e87a179eb6c2ce 100644 (file)
@@ -179,7 +179,7 @@ static __be32 *xdr_encode_mon_name(__be32 *p, struct nsm_args *argp)
 
        if (!nsm_use_hostnames) {
                snprintf(buffer, XDR_ADDRBUF_LEN,
-                        NIPQUAD_FMT, NIPQUAD(argp->addr));
+                        "%pI4", &argp->addr);
                name = buffer;
        }
 
index 8478fc25daee196383f3e40a34999795be41585e..d74d16ce0d49920ed710d0602c4797213aa79d38 100644 (file)
@@ -329,7 +329,7 @@ static int __init root_nfs_addr(void)
        }
 
        snprintf(nfs_data.hostname, sizeof(nfs_data.hostname),
-                "%u.%u.%u.%u", NIPQUAD(servaddr));
+                "%pI4", &servaddr);
        return 0;
 }
 
@@ -421,8 +421,8 @@ static int __init root_nfs_getport(int program, int version, int proto)
 {
        struct sockaddr_in sin;
 
-       printk(KERN_NOTICE "Looking up port of RPC %d/%d on %u.%u.%u.%u\n",
-               program, version, NIPQUAD(servaddr));
+       printk(KERN_NOTICE "Looking up port of RPC %d/%d on %pI4\n",
+               program, version, &servaddr);
        set_sockaddr(&sin, servaddr, 0);
        return rpcb_getport_sync(&sin, program, version, proto);
 }
index eb391d8d70ba023f94d9212d585f64f19abd27ab..bb0313ac9e1fa1a6b94ddb51229298e88b955bfd 100644 (file)
@@ -462,8 +462,7 @@ static void nfs_show_mountd_options(struct seq_file *m, struct nfs_server *nfss,
        switch (sap->sa_family) {
        case AF_INET: {
                struct sockaddr_in *sin = (struct sockaddr_in *)sap;
-               seq_printf(m, ",mountaddr=" NIPQUAD_FMT,
-                               NIPQUAD(sin->sin_addr.s_addr));
+               seq_printf(m, ",mountaddr=%pI4", &sin->sin_addr.s_addr);
                break;
        }
        case AF_INET6: {
index b0bebc552a11f3cec582b83c80c45c97a7734cdd..16efb8f8e062b28728eb57ccbe9e54f5f26cf514 100644 (file)
@@ -719,8 +719,8 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
                status = nfserr_clid_inuse;
                if (!same_creds(&conf->cl_cred, &rqstp->rq_cred)
                                || conf->cl_addr != sin->sin_addr.s_addr) {
-                       dprintk("NFSD: setclientid: string in use by client"
-                               "at %u.%u.%u.%u\n", NIPQUAD(conf->cl_addr));
+                       dprintk("NFSD: setclientid: string in use by clientat %pI4\n",
+                               &conf->cl_addr);
                        goto out;
                }
        }
index e3f9783fdcf7eba3872331b0c48f5aee7207fd62..77d7b8c531a6b14f351b280f84d98f0bf9e66401 100644 (file)
@@ -330,7 +330,7 @@ static ssize_t failover_unlock_ip(struct file *file, char *buf, size_t size)
                return -EINVAL;
 
        /* get ipv4 address */
-       if (sscanf(fo_path, NIPQUAD_FMT "%c", &b1, &b2, &b3, &b4, &c) != 4)
+       if (sscanf(fo_path, "%u.%u.%u.%u%c", &b1, &b2, &b3, &b4, &c) != 4)
                return -EINVAL;
        if (b1 > 255 || b2 > 255 || b3 > 255 || b4 > 255)
                return -EINVAL;
index 52276c02f71041665ba3389b9d690e46e8c075dd..f8424874fa0725b95065d5ce7031f63d0cdde586 100644 (file)
@@ -304,8 +304,8 @@ static int sc_seq_show(struct seq_file *seq, void *v)
                 * use of it here generates a warning with -Wbitwise */
                seq_printf(seq, "%p:\n"
                           "  krefs:           %d\n"
-                          "  sock:            %u.%u.%u.%u:%u -> "
-                                             "%u.%u.%u.%u:%u\n"
+                          "  sock:            %pI4:%u -> "
+                                             "%pI4:%u\n"
                           "  remote node:     %s\n"
                           "  page off:        %zu\n"
                           "  handshake ok:    %u\n"
@@ -319,8 +319,8 @@ static int sc_seq_show(struct seq_file *seq, void *v)
                           "  func type:       %u\n",
                           sc,
                           atomic_read(&sc->sc_kref.refcount),
-                          NIPQUAD(saddr), inet ? ntohs(sport) : 0,
-                          NIPQUAD(daddr), inet ? ntohs(dport) : 0,
+                          &saddr, inet ? ntohs(sport) : 0,
+                          &daddr, inet ? ntohs(dport) : 0,
                           sc->sc_node->nd_name,
                           sc->sc_page_off,
                           sc->sc_handshake_ok,
index 816a3f61330c6173ec04a360f4b7b40bb53ad0bf..70e8fa9e2539cdf210676778770e0de4405713e2 100644 (file)
@@ -250,7 +250,7 @@ static ssize_t o2nm_node_ipv4_port_write(struct o2nm_node *node,
 
 static ssize_t o2nm_node_ipv4_address_read(struct o2nm_node *node, char *page)
 {
-       return sprintf(page, "%u.%u.%u.%u\n", NIPQUAD(node->nd_ipv4_address));
+       return sprintf(page, "%pI4\n", &node->nd_ipv4_address);
 }
 
 static ssize_t o2nm_node_ipv4_address_write(struct o2nm_node *node,
index 2bcf706d9dd3c460d9bab05f963c74e08d21b188..9fbe849f634419d9f5418d6097e789906ba460b1 100644 (file)
@@ -1597,8 +1597,8 @@ static void o2net_start_connect(struct work_struct *work)
        ret = sock->ops->bind(sock, (struct sockaddr *)&myaddr,
                              sizeof(myaddr));
        if (ret) {
-               mlog(ML_ERROR, "bind failed with %d at address %u.%u.%u.%u\n",
-                    ret, NIPQUAD(mynode->nd_ipv4_address));
+               mlog(ML_ERROR, "bind failed with %d at address %pI4\n",
+                    ret, &mynode->nd_ipv4_address);
                goto out;
        }
 
@@ -1790,17 +1790,16 @@ static int o2net_accept_one(struct socket *sock)
 
        node = o2nm_get_node_by_ip(sin.sin_addr.s_addr);
        if (node == NULL) {
-               mlog(ML_NOTICE, "attempt to connect from unknown node at "
-                    "%u.%u.%u.%u:%d\n", NIPQUAD(sin.sin_addr.s_addr),
-                    ntohs(sin.sin_port));
+               mlog(ML_NOTICE, "attempt to connect from unknown node at %pI4:%d\n",
+                    &sin.sin_addr.s_addr, ntohs(sin.sin_port));
                ret = -EINVAL;
                goto out;
        }
 
        if (o2nm_this_node() > node->nd_num) {
                mlog(ML_NOTICE, "unexpected connect attempted from a lower "
-                    "numbered node '%s' at " "%u.%u.%u.%u:%d with num %u\n",
-                    node->nd_name, NIPQUAD(sin.sin_addr.s_addr),
+                    "numbered node '%s' at " "%pI4:%d with num %u\n",
+                    node->nd_name, &sin.sin_addr.s_addr,
                     ntohs(sin.sin_port), node->nd_num);
                ret = -EINVAL;
                goto out;
@@ -1810,8 +1809,8 @@ static int o2net_accept_one(struct socket *sock)
         * and tries to connect before we see their heartbeat */
        if (!o2hb_check_node_heartbeating_from_callback(node->nd_num)) {
                mlog(ML_CONN, "attempt to connect from node '%s' at "
-                    "%u.%u.%u.%u:%d but it isn't heartbeating\n",
-                    node->nd_name, NIPQUAD(sin.sin_addr.s_addr),
+                    "%pI4:%d but it isn't heartbeating\n",
+                    node->nd_name, &sin.sin_addr.s_addr,
                     ntohs(sin.sin_port));
                ret = -EINVAL;
                goto out;
@@ -1827,8 +1826,8 @@ static int o2net_accept_one(struct socket *sock)
        spin_unlock(&nn->nn_lock);
        if (ret) {
                mlog(ML_NOTICE, "attempt to connect from node '%s' at "
-                    "%u.%u.%u.%u:%d but it already has an open connection\n",
-                    node->nd_name, NIPQUAD(sin.sin_addr.s_addr),
+                    "%pI4:%d but it already has an open connection\n",
+                    node->nd_name, &sin.sin_addr.s_addr,
                     ntohs(sin.sin_port));
                goto out;
        }
@@ -1924,15 +1923,15 @@ static int o2net_open_listening_sock(__be32 addr, __be16 port)
        sock->sk->sk_reuse = 1;
        ret = sock->ops->bind(sock, (struct sockaddr *)&sin, sizeof(sin));
        if (ret < 0) {
-               mlog(ML_ERROR, "unable to bind socket at %u.%u.%u.%u:%u, "
-                    "ret=%d\n", NIPQUAD(addr), ntohs(port), ret);
+               mlog(ML_ERROR, "unable to bind socket at %pI4:%u, "
+                    "ret=%d\n", &addr, ntohs(port), ret);
                goto out;
        }
 
        ret = sock->ops->listen(sock, 64);
        if (ret < 0) {
-               mlog(ML_ERROR, "unable to listen on %u.%u.%u.%u:%u, ret=%d\n",
-                    NIPQUAD(addr), ntohs(port), ret);
+               mlog(ML_ERROR, "unable to listen on %pI4:%u, ret=%d\n",
+                    &addr, ntohs(port), ret);
        }
 
 out: