mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
14d5e834f6
commit
21454aaad3
26 changed files with 127 additions and 150 deletions
|
|
@ -271,8 +271,8 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args)
|
|||
case AF_INET: {
|
||||
struct sockaddr_in *sin =
|
||||
(struct sockaddr_in *)args->address;
|
||||
snprintf(servername, sizeof(servername), NIPQUAD_FMT,
|
||||
NIPQUAD(sin->sin_addr.s_addr));
|
||||
snprintf(servername, sizeof(servername), "%pI4",
|
||||
&sin->sin_addr.s_addr);
|
||||
break;
|
||||
}
|
||||
case AF_INET6: {
|
||||
|
|
|
|||
|
|
@ -270,10 +270,9 @@ static int rpcb_register_netid4(struct sockaddr_in *address_to_register,
|
|||
char buf[32];
|
||||
|
||||
/* Construct AF_INET universal address */
|
||||
snprintf(buf, sizeof(buf),
|
||||
NIPQUAD_FMT".%u.%u",
|
||||
NIPQUAD(address_to_register->sin_addr.s_addr),
|
||||
port >> 8, port & 0xff);
|
||||
snprintf(buf, sizeof(buf), "%pI4.%u.%u",
|
||||
&address_to_register->sin_addr.s_addr,
|
||||
port >> 8, port & 0xff);
|
||||
map->r_addr = buf;
|
||||
|
||||
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)
|
|||
struct rpc_clnt *rpcb_clnt;
|
||||
int status;
|
||||
|
||||
dprintk("RPC: %s(" NIPQUAD_FMT ", %u, %u, %d)\n",
|
||||
__func__, NIPQUAD(sin->sin_addr.s_addr), prog, vers, prot);
|
||||
dprintk("RPC: %s(%pI4, %u, %u, %d)\n",
|
||||
__func__, &sin->sin_addr.s_addr, prog, vers, prot);
|
||||
|
||||
rpcb_clnt = rpcb_create(NULL, (struct sockaddr *)sin,
|
||||
sizeof(*sin), prot, RPCBVERS_2);
|
||||
|
|
|
|||
|
|
@ -162,11 +162,7 @@ static void ip_map_request(struct cache_detail *cd,
|
|||
struct ip_map *im = container_of(h, struct ip_map, h);
|
||||
|
||||
if (ipv6_addr_v4mapped(&(im->m_addr))) {
|
||||
snprintf(text_addr, 20, NIPQUAD_FMT,
|
||||
ntohl(im->m_addr.s6_addr32[3]) >> 24 & 0xff,
|
||||
ntohl(im->m_addr.s6_addr32[3]) >> 16 & 0xff,
|
||||
ntohl(im->m_addr.s6_addr32[3]) >> 8 & 0xff,
|
||||
ntohl(im->m_addr.s6_addr32[3]) >> 0 & 0xff);
|
||||
snprintf(text_addr, 20, "%pI4", &im->m_addr.s6_addr32[3]);
|
||||
} else {
|
||||
snprintf(text_addr, 40, "%pI6", &im->m_addr);
|
||||
}
|
||||
|
|
@ -208,7 +204,7 @@ static int ip_map_parse(struct cache_detail *cd,
|
|||
len = qword_get(&mesg, buf, mlen);
|
||||
if (len <= 0) return -EINVAL;
|
||||
|
||||
if (sscanf(buf, NIPQUAD_FMT "%c", &b1, &b2, &b3, &b4, &c) == 4) {
|
||||
if (sscanf(buf, "%u.%u.%u.%u%c", &b1, &b2, &b3, &b4, &c) == 4) {
|
||||
addr.s6_addr32[0] = 0;
|
||||
addr.s6_addr32[1] = 0;
|
||||
addr.s6_addr32[2] = htonl(0xffff);
|
||||
|
|
@ -278,13 +274,8 @@ static int ip_map_show(struct seq_file *m,
|
|||
dom = im->m_client->h.name;
|
||||
|
||||
if (ipv6_addr_v4mapped(&addr)) {
|
||||
seq_printf(m, "%s " NIPQUAD_FMT " %s\n",
|
||||
im->m_class,
|
||||
ntohl(addr.s6_addr32[3]) >> 24 & 0xff,
|
||||
ntohl(addr.s6_addr32[3]) >> 16 & 0xff,
|
||||
ntohl(addr.s6_addr32[3]) >> 8 & 0xff,
|
||||
ntohl(addr.s6_addr32[3]) >> 0 & 0xff,
|
||||
dom);
|
||||
seq_printf(m, "%s %pI4 %s\n",
|
||||
im->m_class, &addr.s6_addr32[3], dom);
|
||||
} else {
|
||||
seq_printf(m, "%s %pI6 %s\n", im->m_class, &addr, dom);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -250,10 +250,10 @@ static int one_sock_name(char *buf, struct svc_sock *svsk)
|
|||
|
||||
switch(svsk->sk_sk->sk_family) {
|
||||
case AF_INET:
|
||||
len = sprintf(buf, "ipv4 %s %u.%u.%u.%u %d\n",
|
||||
svsk->sk_sk->sk_protocol==IPPROTO_UDP?
|
||||
len = sprintf(buf, "ipv4 %s %pI4 %d\n",
|
||||
svsk->sk_sk->sk_protocol == IPPROTO_UDP ?
|
||||
"udp" : "tcp",
|
||||
NIPQUAD(inet_sk(svsk->sk_sk)->rcv_saddr),
|
||||
&inet_sk(svsk->sk_sk)->rcv_saddr,
|
||||
inet_sk(svsk->sk_sk)->num);
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -1048,21 +1048,21 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt)
|
|||
|
||||
dprintk("svcrdma: new connection %p accepted with the following "
|
||||
"attributes:\n"
|
||||
" local_ip : %d.%d.%d.%d\n"
|
||||
" local_ip : %pI4\n"
|
||||
" local_port : %d\n"
|
||||
" remote_ip : %d.%d.%d.%d\n"
|
||||
" remote_ip : %pI4\n"
|
||||
" remote_port : %d\n"
|
||||
" max_sge : %d\n"
|
||||
" sq_depth : %d\n"
|
||||
" max_requests : %d\n"
|
||||
" ord : %d\n",
|
||||
newxprt,
|
||||
NIPQUAD(((struct sockaddr_in *)&newxprt->sc_cm_id->
|
||||
route.addr.src_addr)->sin_addr.s_addr),
|
||||
&((struct sockaddr_in *)&newxprt->sc_cm_id->
|
||||
route.addr.src_addr)->sin_addr.s_addr,
|
||||
ntohs(((struct sockaddr_in *)&newxprt->sc_cm_id->
|
||||
route.addr.src_addr)->sin_port),
|
||||
NIPQUAD(((struct sockaddr_in *)&newxprt->sc_cm_id->
|
||||
route.addr.dst_addr)->sin_addr.s_addr),
|
||||
&((struct sockaddr_in *)&newxprt->sc_cm_id->
|
||||
route.addr.dst_addr)->sin_addr.s_addr,
|
||||
ntohs(((struct sockaddr_in *)&newxprt->sc_cm_id->
|
||||
route.addr.dst_addr)->sin_port),
|
||||
newxprt->sc_max_sge,
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ xprt_rdma_format_addresses(struct rpc_xprt *xprt)
|
|||
|
||||
buf = kzalloc(20, GFP_KERNEL);
|
||||
if (buf)
|
||||
snprintf(buf, 20, NIPQUAD_FMT, NIPQUAD(addr->sin_addr.s_addr));
|
||||
snprintf(buf, 20, "%pI4", &addr->sin_addr.s_addr);
|
||||
xprt->address_strings[RPC_DISPLAY_ADDR] = buf;
|
||||
|
||||
buf = kzalloc(8, GFP_KERNEL);
|
||||
|
|
@ -186,8 +186,8 @@ xprt_rdma_format_addresses(struct rpc_xprt *xprt)
|
|||
|
||||
buf = kzalloc(48, GFP_KERNEL);
|
||||
if (buf)
|
||||
snprintf(buf, 48, "addr="NIPQUAD_FMT" port=%u proto=%s",
|
||||
NIPQUAD(addr->sin_addr.s_addr),
|
||||
snprintf(buf, 48, "addr=%pI4 port=%u proto=%s",
|
||||
&addr->sin_addr.s_addr,
|
||||
ntohs(addr->sin_port), "rdma");
|
||||
xprt->address_strings[RPC_DISPLAY_ALL] = buf;
|
||||
|
||||
|
|
@ -204,8 +204,8 @@ xprt_rdma_format_addresses(struct rpc_xprt *xprt)
|
|||
|
||||
buf = kzalloc(30, GFP_KERNEL);
|
||||
if (buf)
|
||||
snprintf(buf, 30, NIPQUAD_FMT".%u.%u",
|
||||
NIPQUAD(addr->sin_addr.s_addr),
|
||||
snprintf(buf, 30, "%pI4.%u.%u",
|
||||
&addr->sin_addr.s_addr,
|
||||
ntohs(addr->sin_port) >> 8,
|
||||
ntohs(addr->sin_port) & 0xff);
|
||||
xprt->address_strings[RPC_DISPLAY_UNIVERSAL_ADDR] = buf;
|
||||
|
|
@ -369,8 +369,8 @@ xprt_setup_rdma(struct xprt_create *args)
|
|||
if (ntohs(sin->sin_port) != 0)
|
||||
xprt_set_bound(xprt);
|
||||
|
||||
dprintk("RPC: %s: %u.%u.%u.%u:%u\n", __func__,
|
||||
NIPQUAD(sin->sin_addr.s_addr), ntohs(sin->sin_port));
|
||||
dprintk("RPC: %s: %pI4:%u\n",
|
||||
__func__, &sin->sin_addr.s_addr, ntohs(sin->sin_port));
|
||||
|
||||
/* Set max requests */
|
||||
cdata.max_requests = xprt->max_reqs;
|
||||
|
|
|
|||
|
|
@ -323,12 +323,11 @@ rpcrdma_conn_upcall(struct rdma_cm_id *id, struct rdma_cm_event *event)
|
|||
case RDMA_CM_EVENT_DEVICE_REMOVAL:
|
||||
connstate = -ENODEV;
|
||||
connected:
|
||||
dprintk("RPC: %s: %s: %u.%u.%u.%u:%u"
|
||||
" (ep 0x%p event 0x%x)\n",
|
||||
dprintk("RPC: %s: %s: %pI4:%u (ep 0x%p event 0x%x)\n",
|
||||
__func__,
|
||||
(event->event <= 11) ? conn[event->event] :
|
||||
"unknown connection error",
|
||||
NIPQUAD(addr->sin_addr.s_addr),
|
||||
&addr->sin_addr.s_addr,
|
||||
ntohs(addr->sin_port),
|
||||
ep, event->event);
|
||||
atomic_set(&rpcx_to_rdmax(ep->rep_xprt)->rx_buf.rb_credits, 1);
|
||||
|
|
@ -348,18 +347,17 @@ connected:
|
|||
if (connstate == 1) {
|
||||
int ird = attr.max_dest_rd_atomic;
|
||||
int tird = ep->rep_remote_cma.responder_resources;
|
||||
printk(KERN_INFO "rpcrdma: connection to %u.%u.%u.%u:%u "
|
||||
printk(KERN_INFO "rpcrdma: connection to %pI4:%u "
|
||||
"on %s, memreg %d slots %d ird %d%s\n",
|
||||
NIPQUAD(addr->sin_addr.s_addr),
|
||||
&addr->sin_addr.s_addr,
|
||||
ntohs(addr->sin_port),
|
||||
ia->ri_id->device->name,
|
||||
ia->ri_memreg_strategy,
|
||||
xprt->rx_buf.rb_max_requests,
|
||||
ird, ird < 4 && ird < tird / 2 ? " (low!)" : "");
|
||||
} else if (connstate < 0) {
|
||||
printk(KERN_INFO "rpcrdma: connection to %u.%u.%u.%u:%u "
|
||||
"closed (%d)\n",
|
||||
NIPQUAD(addr->sin_addr.s_addr),
|
||||
printk(KERN_INFO "rpcrdma: connection to %pI4:%u closed (%d)\n",
|
||||
&addr->sin_addr.s_addr,
|
||||
ntohs(addr->sin_port),
|
||||
connstate);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -284,8 +284,7 @@ static void xs_format_ipv4_peer_addresses(struct rpc_xprt *xprt,
|
|||
|
||||
buf = kzalloc(20, GFP_KERNEL);
|
||||
if (buf) {
|
||||
snprintf(buf, 20, NIPQUAD_FMT,
|
||||
NIPQUAD(addr->sin_addr.s_addr));
|
||||
snprintf(buf, 20, "pI4", &addr->sin_addr.s_addr);
|
||||
}
|
||||
xprt->address_strings[RPC_DISPLAY_ADDR] = buf;
|
||||
|
||||
|
|
@ -300,8 +299,8 @@ static void xs_format_ipv4_peer_addresses(struct rpc_xprt *xprt,
|
|||
|
||||
buf = kzalloc(48, GFP_KERNEL);
|
||||
if (buf) {
|
||||
snprintf(buf, 48, "addr="NIPQUAD_FMT" port=%u proto=%s",
|
||||
NIPQUAD(addr->sin_addr.s_addr),
|
||||
snprintf(buf, 48, "addr=%pI4 port=%u proto=%s",
|
||||
&addr->sin_addr.s_addr,
|
||||
ntohs(addr->sin_port),
|
||||
protocol);
|
||||
}
|
||||
|
|
@ -323,8 +322,8 @@ static void xs_format_ipv4_peer_addresses(struct rpc_xprt *xprt,
|
|||
|
||||
buf = kzalloc(30, GFP_KERNEL);
|
||||
if (buf) {
|
||||
snprintf(buf, 30, NIPQUAD_FMT".%u.%u",
|
||||
NIPQUAD(addr->sin_addr.s_addr),
|
||||
snprintf(buf, 30, "%pI4.%u.%u",
|
||||
&addr->sin_addr.s_addr,
|
||||
ntohs(addr->sin_port) >> 8,
|
||||
ntohs(addr->sin_port) & 0xff);
|
||||
}
|
||||
|
|
@ -1413,8 +1412,8 @@ static int xs_bind4(struct sock_xprt *transport, struct socket *sock)
|
|||
if (port > last)
|
||||
nloop++;
|
||||
} while (err == -EADDRINUSE && nloop != 2);
|
||||
dprintk("RPC: %s "NIPQUAD_FMT":%u: %s (%d)\n",
|
||||
__func__, NIPQUAD(myaddr.sin_addr),
|
||||
dprintk("RPC: %s %pI4:%u: %s (%d)\n",
|
||||
__func__, &myaddr.sin_addr,
|
||||
port, err ? "failed" : "ok", err);
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue