diff options
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-rw-r--r-- | net/sunrpc/xprtsock.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index d9e65765f6c4..fcbfae82cb12 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -263,9 +263,24 @@ struct sock_xprt { | |||
263 | #define TCP_RCV_COPY_XID (1UL << 2) | 263 | #define TCP_RCV_COPY_XID (1UL << 2) |
264 | #define TCP_RCV_COPY_DATA (1UL << 3) | 264 | #define TCP_RCV_COPY_DATA (1UL << 3) |
265 | 265 | ||
266 | static inline struct sockaddr *xs_addr(struct rpc_xprt *xprt) | ||
267 | { | ||
268 | return (struct sockaddr *) &xprt->addr; | ||
269 | } | ||
270 | |||
271 | static inline struct sockaddr_in *xs_addr_in(struct rpc_xprt *xprt) | ||
272 | { | ||
273 | return (struct sockaddr_in *) &xprt->addr; | ||
274 | } | ||
275 | |||
276 | static inline struct sockaddr_in6 *xs_addr_in6(struct rpc_xprt *xprt) | ||
277 | { | ||
278 | return (struct sockaddr_in6 *) &xprt->addr; | ||
279 | } | ||
280 | |||
266 | static void xs_format_ipv4_peer_addresses(struct rpc_xprt *xprt) | 281 | static void xs_format_ipv4_peer_addresses(struct rpc_xprt *xprt) |
267 | { | 282 | { |
268 | struct sockaddr_in *addr = (struct sockaddr_in *) &xprt->addr; | 283 | struct sockaddr_in *addr = xs_addr_in(xprt); |
269 | char *buf; | 284 | char *buf; |
270 | 285 | ||
271 | buf = kzalloc(20, GFP_KERNEL); | 286 | buf = kzalloc(20, GFP_KERNEL); |
@@ -317,7 +332,7 @@ static void xs_format_ipv4_peer_addresses(struct rpc_xprt *xprt) | |||
317 | 332 | ||
318 | static void xs_format_ipv6_peer_addresses(struct rpc_xprt *xprt) | 333 | static void xs_format_ipv6_peer_addresses(struct rpc_xprt *xprt) |
319 | { | 334 | { |
320 | struct sockaddr_in6 *addr = (struct sockaddr_in6 *) &xprt->addr; | 335 | struct sockaddr_in6 *addr = xs_addr_in6(xprt); |
321 | char *buf; | 336 | char *buf; |
322 | 337 | ||
323 | buf = kzalloc(40, GFP_KERNEL); | 338 | buf = kzalloc(40, GFP_KERNEL); |
@@ -537,7 +552,7 @@ static int xs_udp_send_request(struct rpc_task *task) | |||
537 | 552 | ||
538 | req->rq_xtime = jiffies; | 553 | req->rq_xtime = jiffies; |
539 | status = xs_sendpages(transport->sock, | 554 | status = xs_sendpages(transport->sock, |
540 | (struct sockaddr *) &xprt->addr, | 555 | xs_addr(xprt), |
541 | xprt->addrlen, xdr, | 556 | xprt->addrlen, xdr, |
542 | req->rq_bytes_sent); | 557 | req->rq_bytes_sent); |
543 | 558 | ||
@@ -1214,7 +1229,7 @@ static unsigned short xs_get_random_port(void) | |||
1214 | */ | 1229 | */ |
1215 | static void xs_set_port(struct rpc_xprt *xprt, unsigned short port) | 1230 | static void xs_set_port(struct rpc_xprt *xprt, unsigned short port) |
1216 | { | 1231 | { |
1217 | struct sockaddr *addr = (struct sockaddr *) &xprt->addr; | 1232 | struct sockaddr *addr = xs_addr(xprt); |
1218 | 1233 | ||
1219 | dprintk("RPC: setting port for xprt %p to %u\n", xprt, port); | 1234 | dprintk("RPC: setting port for xprt %p to %u\n", xprt, port); |
1220 | 1235 | ||
@@ -1497,8 +1512,7 @@ static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock) | |||
1497 | /* Tell the socket layer to start connecting... */ | 1512 | /* Tell the socket layer to start connecting... */ |
1498 | xprt->stat.connect_count++; | 1513 | xprt->stat.connect_count++; |
1499 | xprt->stat.connect_start = jiffies; | 1514 | xprt->stat.connect_start = jiffies; |
1500 | return kernel_connect(sock, (struct sockaddr *) &xprt->addr, | 1515 | return kernel_connect(sock, xs_addr(xprt), xprt->addrlen, O_NONBLOCK); |
1501 | xprt->addrlen, O_NONBLOCK); | ||
1502 | } | 1516 | } |
1503 | 1517 | ||
1504 | /** | 1518 | /** |