Commit be859405 authored by Harvey Harrison's avatar Harvey Harrison Committed by David S. Miller

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: default avatarHarvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 63779436
...@@ -646,7 +646,7 @@ static int afs_proc_cell_vlservers_show(struct seq_file *m, void *v) ...@@ -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 */ /* 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; return 0;
} }
...@@ -737,7 +737,7 @@ static int afs_proc_cell_servers_show(struct seq_file *m, void *v) ...@@ -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 */ /* 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", seq_printf(m, "%3d %-15.15s %5d\n",
atomic_read(&server->usage), ipaddr, server->fs_state); atomic_read(&server->usage), ipaddr, server->fs_state);
......
...@@ -105,7 +105,7 @@ struct afs_server *afs_lookup_server(struct afs_cell *cell, ...@@ -105,7 +105,7 @@ struct afs_server *afs_lookup_server(struct afs_cell *cell,
{ {
struct afs_server *server, *candidate; 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 */ /* quick scan of the list to see if we already have the server */
read_lock(&cell->servers_lock); read_lock(&cell->servers_lock);
...@@ -168,9 +168,8 @@ struct afs_server *afs_lookup_server(struct afs_cell *cell, ...@@ -168,9 +168,8 @@ struct afs_server *afs_lookup_server(struct afs_cell *cell,
server_in_two_cells: server_in_two_cells:
write_unlock(&cell->servers_lock); write_unlock(&cell->servers_lock);
kfree(candidate); kfree(candidate);
printk(KERN_NOTICE "kAFS:" printk(KERN_NOTICE "kAFS: Server %pI4 appears to be in two cells\n",
" Server "NIPQUAD_FMT" appears to be in two cells\n", addr);
NIPQUAD(*addr));
_leave(" = -EEXIST"); _leave(" = -EEXIST");
return ERR_PTR(-EEXIST); return ERR_PTR(-EEXIST);
} }
...@@ -184,7 +183,7 @@ struct afs_server *afs_find_server(const struct in_addr *_addr) ...@@ -184,7 +183,7 @@ struct afs_server *afs_find_server(const struct in_addr *_addr)
struct rb_node *p; struct rb_node *p;
struct in_addr addr = *_addr; struct in_addr addr = *_addr;
_enter(NIPQUAD_FMT, NIPQUAD(addr.s_addr)); _enter("%pI4", &addr.s_addr);
read_lock(&afs_servers_lock); read_lock(&afs_servers_lock);
......
...@@ -121,8 +121,7 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo) ...@@ -121,8 +121,7 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo)
/* add the server address */ /* add the server address */
if (server->addr.sockAddr.sin_family == AF_INET) if (server->addr.sockAddr.sin_family == AF_INET)
sprintf(dp, "ip4=" NIPQUAD_FMT, sprintf(dp, "ip4=%pI4", &server->addr.sockAddr.sin_addr);
NIPQUAD(server->addr.sockAddr.sin_addr));
else if (server->addr.sockAddr.sin_family == AF_INET6) else if (server->addr.sockAddr.sin_family == AF_INET6)
sprintf(dp, "ip6=%pi6", &server->addr.sockAddr6.sin6_addr); sprintf(dp, "ip6=%pi6", &server->addr.sockAddr6.sin6_addr);
else else
......
...@@ -2058,8 +2058,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, ...@@ -2058,8 +2058,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
rc = -ENOMEM; rc = -ENOMEM;
else { else {
pSesInfo->server = srvTcp; pSesInfo->server = srvTcp;
sprintf(pSesInfo->serverName, "%u.%u.%u.%u", sprintf(pSesInfo->serverName, "%pI4",
NIPQUAD(sin_server.sin_addr.s_addr)); &sin_server.sin_addr.s_addr);
} }
if (!rc) { if (!rc) {
......
...@@ -115,12 +115,12 @@ static void nlm_display_address(const struct sockaddr *sap, ...@@ -115,12 +115,12 @@ static void nlm_display_address(const struct sockaddr *sap,
snprintf(buf, len, "unspecified"); snprintf(buf, len, "unspecified");
break; break;
case AF_INET: case AF_INET:
snprintf(buf, len, NIPQUAD_FMT, NIPQUAD(sin->sin_addr.s_addr)); snprintf(buf, len, "%pI4", &sin->sin_addr.s_addr);
break; break;
case AF_INET6: case AF_INET6:
if (ipv6_addr_v4mapped(&sin6->sin6_addr)) if (ipv6_addr_v4mapped(&sin6->sin6_addr))
snprintf(buf, len, NIPQUAD_FMT, snprintf(buf, len, "%pI4",
NIPQUAD(sin6->sin6_addr.s6_addr32[3])); &sin6->sin6_addr.s6_addr32[3]);
else else
snprintf(buf, len, "%pI6", &sin6->sin6_addr); snprintf(buf, len, "%pI6", &sin6->sin6_addr);
break; break;
......
...@@ -179,7 +179,7 @@ static __be32 *xdr_encode_mon_name(__be32 *p, struct nsm_args *argp) ...@@ -179,7 +179,7 @@ static __be32 *xdr_encode_mon_name(__be32 *p, struct nsm_args *argp)
if (!nsm_use_hostnames) { if (!nsm_use_hostnames) {
snprintf(buffer, XDR_ADDRBUF_LEN, snprintf(buffer, XDR_ADDRBUF_LEN,
NIPQUAD_FMT, NIPQUAD(argp->addr)); "%pI4", &argp->addr);
name = buffer; name = buffer;
} }
......
...@@ -329,7 +329,7 @@ static int __init root_nfs_addr(void) ...@@ -329,7 +329,7 @@ static int __init root_nfs_addr(void)
} }
snprintf(nfs_data.hostname, sizeof(nfs_data.hostname), snprintf(nfs_data.hostname, sizeof(nfs_data.hostname),
"%u.%u.%u.%u", NIPQUAD(servaddr)); "%pI4", &servaddr);
return 0; return 0;
} }
...@@ -421,8 +421,8 @@ static int __init root_nfs_getport(int program, int version, int proto) ...@@ -421,8 +421,8 @@ static int __init root_nfs_getport(int program, int version, int proto)
{ {
struct sockaddr_in sin; struct sockaddr_in sin;
printk(KERN_NOTICE "Looking up port of RPC %d/%d on %u.%u.%u.%u\n", printk(KERN_NOTICE "Looking up port of RPC %d/%d on %pI4\n",
program, version, NIPQUAD(servaddr)); program, version, &servaddr);
set_sockaddr(&sin, servaddr, 0); set_sockaddr(&sin, servaddr, 0);
return rpcb_getport_sync(&sin, program, version, proto); return rpcb_getport_sync(&sin, program, version, proto);
} }
......
...@@ -462,8 +462,7 @@ static void nfs_show_mountd_options(struct seq_file *m, struct nfs_server *nfss, ...@@ -462,8 +462,7 @@ static void nfs_show_mountd_options(struct seq_file *m, struct nfs_server *nfss,
switch (sap->sa_family) { switch (sap->sa_family) {
case AF_INET: { case AF_INET: {
struct sockaddr_in *sin = (struct sockaddr_in *)sap; struct sockaddr_in *sin = (struct sockaddr_in *)sap;
seq_printf(m, ",mountaddr=" NIPQUAD_FMT, seq_printf(m, ",mountaddr=%pI4", &sin->sin_addr.s_addr);
NIPQUAD(sin->sin_addr.s_addr));
break; break;
} }
case AF_INET6: { case AF_INET6: {
......
...@@ -719,8 +719,8 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, ...@@ -719,8 +719,8 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
status = nfserr_clid_inuse; status = nfserr_clid_inuse;
if (!same_creds(&conf->cl_cred, &rqstp->rq_cred) if (!same_creds(&conf->cl_cred, &rqstp->rq_cred)
|| conf->cl_addr != sin->sin_addr.s_addr) { || conf->cl_addr != sin->sin_addr.s_addr) {
dprintk("NFSD: setclientid: string in use by client" dprintk("NFSD: setclientid: string in use by clientat %pI4\n",
"at %u.%u.%u.%u\n", NIPQUAD(conf->cl_addr)); &conf->cl_addr);
goto out; goto out;
} }
} }
......
...@@ -330,7 +330,7 @@ static ssize_t failover_unlock_ip(struct file *file, char *buf, size_t size) ...@@ -330,7 +330,7 @@ static ssize_t failover_unlock_ip(struct file *file, char *buf, size_t size)
return -EINVAL; return -EINVAL;
/* get ipv4 address */ /* 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; return -EINVAL;
if (b1 > 255 || b2 > 255 || b3 > 255 || b4 > 255) if (b1 > 255 || b2 > 255 || b3 > 255 || b4 > 255)
return -EINVAL; return -EINVAL;
......
...@@ -304,8 +304,8 @@ static int sc_seq_show(struct seq_file *seq, void *v) ...@@ -304,8 +304,8 @@ static int sc_seq_show(struct seq_file *seq, void *v)
* use of it here generates a warning with -Wbitwise */ * use of it here generates a warning with -Wbitwise */
seq_printf(seq, "%p:\n" seq_printf(seq, "%p:\n"
" krefs: %d\n" " krefs: %d\n"
" sock: %u.%u.%u.%u:%u -> " " sock: %pI4:%u -> "
"%u.%u.%u.%u:%u\n" "%pI4:%u\n"
" remote node: %s\n" " remote node: %s\n"
" page off: %zu\n" " page off: %zu\n"
" handshake ok: %u\n" " handshake ok: %u\n"
...@@ -319,8 +319,8 @@ static int sc_seq_show(struct seq_file *seq, void *v) ...@@ -319,8 +319,8 @@ static int sc_seq_show(struct seq_file *seq, void *v)
" func type: %u\n", " func type: %u\n",
sc, sc,
atomic_read(&sc->sc_kref.refcount), atomic_read(&sc->sc_kref.refcount),
NIPQUAD(saddr), inet ? ntohs(sport) : 0, &saddr, inet ? ntohs(sport) : 0,
NIPQUAD(daddr), inet ? ntohs(dport) : 0, &daddr, inet ? ntohs(dport) : 0,
sc->sc_node->nd_name, sc->sc_node->nd_name,
sc->sc_page_off, sc->sc_page_off,
sc->sc_handshake_ok, sc->sc_handshake_ok,
......
...@@ -250,7 +250,7 @@ static ssize_t o2nm_node_ipv4_port_write(struct o2nm_node *node, ...@@ -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) 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, static ssize_t o2nm_node_ipv4_address_write(struct o2nm_node *node,
......
...@@ -1597,8 +1597,8 @@ static void o2net_start_connect(struct work_struct *work) ...@@ -1597,8 +1597,8 @@ static void o2net_start_connect(struct work_struct *work)
ret = sock->ops->bind(sock, (struct sockaddr *)&myaddr, ret = sock->ops->bind(sock, (struct sockaddr *)&myaddr,
sizeof(myaddr)); sizeof(myaddr));
if (ret) { if (ret) {
mlog(ML_ERROR, "bind failed with %d at address %u.%u.%u.%u\n", mlog(ML_ERROR, "bind failed with %d at address %pI4\n",
ret, NIPQUAD(mynode->nd_ipv4_address)); ret, &mynode->nd_ipv4_address);
goto out; goto out;
} }
...@@ -1790,17 +1790,16 @@ static int o2net_accept_one(struct socket *sock) ...@@ -1790,17 +1790,16 @@ static int o2net_accept_one(struct socket *sock)
node = o2nm_get_node_by_ip(sin.sin_addr.s_addr); node = o2nm_get_node_by_ip(sin.sin_addr.s_addr);
if (node == NULL) { if (node == NULL) {
mlog(ML_NOTICE, "attempt to connect from unknown node at " mlog(ML_NOTICE, "attempt to connect from unknown node at %pI4:%d\n",
"%u.%u.%u.%u:%d\n", NIPQUAD(sin.sin_addr.s_addr), &sin.sin_addr.s_addr, ntohs(sin.sin_port));
ntohs(sin.sin_port));
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
if (o2nm_this_node() > node->nd_num) { if (o2nm_this_node() > node->nd_num) {
mlog(ML_NOTICE, "unexpected connect attempted from a lower " mlog(ML_NOTICE, "unexpected connect attempted from a lower "
"numbered node '%s' at " "%u.%u.%u.%u:%d with num %u\n", "numbered node '%s' at " "%pI4:%d with num %u\n",
node->nd_name, NIPQUAD(sin.sin_addr.s_addr), node->nd_name, &sin.sin_addr.s_addr,
ntohs(sin.sin_port), node->nd_num); ntohs(sin.sin_port), node->nd_num);
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
...@@ -1810,8 +1809,8 @@ static int o2net_accept_one(struct socket *sock) ...@@ -1810,8 +1809,8 @@ static int o2net_accept_one(struct socket *sock)
* and tries to connect before we see their heartbeat */ * and tries to connect before we see their heartbeat */
if (!o2hb_check_node_heartbeating_from_callback(node->nd_num)) { if (!o2hb_check_node_heartbeating_from_callback(node->nd_num)) {
mlog(ML_CONN, "attempt to connect from node '%s' at " mlog(ML_CONN, "attempt to connect from node '%s' at "
"%u.%u.%u.%u:%d but it isn't heartbeating\n", "%pI4:%d but it isn't heartbeating\n",
node->nd_name, NIPQUAD(sin.sin_addr.s_addr), node->nd_name, &sin.sin_addr.s_addr,
ntohs(sin.sin_port)); ntohs(sin.sin_port));
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
...@@ -1827,8 +1826,8 @@ static int o2net_accept_one(struct socket *sock) ...@@ -1827,8 +1826,8 @@ static int o2net_accept_one(struct socket *sock)
spin_unlock(&nn->nn_lock); spin_unlock(&nn->nn_lock);
if (ret) { if (ret) {
mlog(ML_NOTICE, "attempt to connect from node '%s' at " mlog(ML_NOTICE, "attempt to connect from node '%s' at "
"%u.%u.%u.%u:%d but it already has an open connection\n", "%pI4:%d but it already has an open connection\n",
node->nd_name, NIPQUAD(sin.sin_addr.s_addr), node->nd_name, &sin.sin_addr.s_addr,
ntohs(sin.sin_port)); ntohs(sin.sin_port));
goto out; goto out;
} }
...@@ -1924,15 +1923,15 @@ static int o2net_open_listening_sock(__be32 addr, __be16 port) ...@@ -1924,15 +1923,15 @@ static int o2net_open_listening_sock(__be32 addr, __be16 port)
sock->sk->sk_reuse = 1; sock->sk->sk_reuse = 1;
ret = sock->ops->bind(sock, (struct sockaddr *)&sin, sizeof(sin)); ret = sock->ops->bind(sock, (struct sockaddr *)&sin, sizeof(sin));
if (ret < 0) { if (ret < 0) {
mlog(ML_ERROR, "unable to bind socket at %u.%u.%u.%u:%u, " mlog(ML_ERROR, "unable to bind socket at %pI4:%u, "
"ret=%d\n", NIPQUAD(addr), ntohs(port), ret); "ret=%d\n", &addr, ntohs(port), ret);
goto out; goto out;
} }
ret = sock->ops->listen(sock, 64); ret = sock->ops->listen(sock, 64);
if (ret < 0) { if (ret < 0) {
mlog(ML_ERROR, "unable to listen on %u.%u.%u.%u:%u, ret=%d\n", mlog(ML_ERROR, "unable to listen on %pI4:%u, ret=%d\n",
NIPQUAD(addr), ntohs(port), ret); &addr, ntohs(port), ret);
} }
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment