aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprtsock.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2006-12-05 16:35:37 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-12-06 10:46:51 -0500
commit7559c7a28fbcaa0bca028eeebd5f251b09befe6b (patch)
tree5cbf7df3f966243261e1923641618fd813126734 /net/sunrpc/xprtsock.c
parent314dfd7987c71d7ba0c43ac3bf3d243c102ce025 (diff)
SUNRPC: Make address format buffers more generic
For now we will assume that all transports will use the address format buffers in the rpc_xprt struct to store their addresses. Change rpc_peer2str() to be a generic routine to handle this, and get rid of the print_address() op in the rpc_xprt_ops vector. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-rw-r--r--net/sunrpc/xprtsock.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index faa6bfebf258..a94aff42d08c 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1061,19 +1061,6 @@ static unsigned short xs_get_random_port(void)
1061} 1061}
1062 1062
1063/** 1063/**
1064 * xs_print_peer_address - format an IPv4 address for printing
1065 * @xprt: generic transport
1066 * @format: flags field indicating which parts of the address to render
1067 */
1068static char *xs_print_peer_address(struct rpc_xprt *xprt, enum rpc_display_format_t format)
1069{
1070 if (xprt->address_strings[format] != NULL)
1071 return xprt->address_strings[format];
1072 else
1073 return "unprintable";
1074}
1075
1076/**
1077 * xs_set_port - reset the port number in the remote endpoint address 1064 * xs_set_port - reset the port number in the remote endpoint address
1078 * @xprt: generic transport 1065 * @xprt: generic transport
1079 * @port: new port number 1066 * @port: new port number
@@ -1146,7 +1133,7 @@ static void xs_udp_connect_worker(void *args)
1146 } 1133 }
1147 1134
1148 dprintk("RPC: worker connecting xprt %p to address: %s\n", 1135 dprintk("RPC: worker connecting xprt %p to address: %s\n",
1149 xprt, xs_print_peer_address(xprt, RPC_DISPLAY_ALL)); 1136 xprt, xprt->address_strings[RPC_DISPLAY_ALL]);
1150 1137
1151 if (!transport->inet) { 1138 if (!transport->inet) {
1152 struct sock *sk = sock->sk; 1139 struct sock *sk = sock->sk;
@@ -1233,7 +1220,7 @@ static void xs_tcp_connect_worker(void *args)
1233 xs_tcp_reuse_connection(xprt); 1220 xs_tcp_reuse_connection(xprt);
1234 1221
1235 dprintk("RPC: worker connecting xprt %p to address: %s\n", 1222 dprintk("RPC: worker connecting xprt %p to address: %s\n",
1236 xprt, xs_print_peer_address(xprt, RPC_DISPLAY_ALL)); 1223 xprt, xprt->address_strings[RPC_DISPLAY_ALL]);
1237 1224
1238 if (!transport->inet) { 1225 if (!transport->inet) {
1239 struct sock *sk = sock->sk; 1226 struct sock *sk = sock->sk;
@@ -1380,7 +1367,6 @@ static void xs_tcp_print_stats(struct rpc_xprt *xprt, struct seq_file *seq)
1380 1367
1381static struct rpc_xprt_ops xs_udp_ops = { 1368static struct rpc_xprt_ops xs_udp_ops = {
1382 .set_buffer_size = xs_udp_set_buffer_size, 1369 .set_buffer_size = xs_udp_set_buffer_size,
1383 .print_addr = xs_print_peer_address,
1384 .reserve_xprt = xprt_reserve_xprt_cong, 1370 .reserve_xprt = xprt_reserve_xprt_cong,
1385 .release_xprt = xprt_release_xprt_cong, 1371 .release_xprt = xprt_release_xprt_cong,
1386 .rpcbind = rpc_getport, 1372 .rpcbind = rpc_getport,
@@ -1398,7 +1384,6 @@ static struct rpc_xprt_ops xs_udp_ops = {
1398}; 1384};
1399 1385
1400static struct rpc_xprt_ops xs_tcp_ops = { 1386static struct rpc_xprt_ops xs_tcp_ops = {
1401 .print_addr = xs_print_peer_address,
1402 .reserve_xprt = xprt_reserve_xprt, 1387 .reserve_xprt = xprt_reserve_xprt,
1403 .release_xprt = xs_tcp_release_xprt, 1388 .release_xprt = xs_tcp_release_xprt,
1404 .rpcbind = rpc_getport, 1389 .rpcbind = rpc_getport,
@@ -1485,7 +1470,7 @@ struct rpc_xprt *xs_setup_udp(struct sockaddr *addr, size_t addrlen, struct rpc_
1485 1470
1486 xs_format_peer_addresses(xprt); 1471 xs_format_peer_addresses(xprt);
1487 dprintk("RPC: set up transport to address %s\n", 1472 dprintk("RPC: set up transport to address %s\n",
1488 xs_print_peer_address(xprt, RPC_DISPLAY_ALL)); 1473 xprt->address_strings[RPC_DISPLAY_ALL]);
1489 1474
1490 return xprt; 1475 return xprt;
1491} 1476}
@@ -1529,7 +1514,7 @@ struct rpc_xprt *xs_setup_tcp(struct sockaddr *addr, size_t addrlen, struct rpc_
1529 1514
1530 xs_format_peer_addresses(xprt); 1515 xs_format_peer_addresses(xprt);
1531 dprintk("RPC: set up transport to address %s\n", 1516 dprintk("RPC: set up transport to address %s\n",
1532 xs_print_peer_address(xprt, RPC_DISPLAY_ALL)); 1517 xprt->address_strings[RPC_DISPLAY_ALL]);
1533 1518
1534 return xprt; 1519 return xprt;
1535} 1520}