aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprtsock.c
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@parallels.com>2010-10-04 08:57:11 -0400
committerJ. Bruce Fields <bfields@redhat.com>2010-10-19 10:48:15 -0400
commit7dfe1fc36278c3aa0db29356c491db6353678e98 (patch)
tree775b8ea3f91155cbad9601a15d52bbdd67b0a6f3 /net/sunrpc/xprtsock.c
parent6bc9638ab495516f8a34d2ae48f2f43f145e186f (diff)
sunrpc: Pass family to setup_socket calls
Now we have a single socket creation routine and can call it directly from the setup_socket routines. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Reviewed-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-rw-r--r--net/sunrpc/xprtsock.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 324d97ae71ab..3dbc5d631d66 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1638,18 +1638,6 @@ out:
1638 return ERR_PTR(err); 1638 return ERR_PTR(err);
1639} 1639}
1640 1640
1641static struct socket *xs_create_sock4(struct rpc_xprt *xprt,
1642 struct sock_xprt *transport, int type, int protocol)
1643{
1644 return xs_create_sock(xprt, transport, PF_INET, type, protocol);
1645}
1646
1647static struct socket *xs_create_sock6(struct rpc_xprt *xprt,
1648 struct sock_xprt *transport, int type, int protocol)
1649{
1650 return xs_create_sock(xprt, transport, PF_INET6, type, protocol);
1651}
1652
1653static void xs_udp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock) 1641static void xs_udp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
1654{ 1642{
1655 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); 1643 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt);
@@ -1679,9 +1667,7 @@ static void xs_udp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
1679 xs_udp_do_set_buffer_size(xprt); 1667 xs_udp_do_set_buffer_size(xprt);
1680} 1668}
1681 1669
1682static void xs_udp_setup_socket(struct sock_xprt *transport, 1670static void xs_udp_setup_socket(struct sock_xprt *transport, int family)
1683 struct socket *(*create_sock)(struct rpc_xprt *,
1684 struct sock_xprt *, int type, int protocol))
1685{ 1671{
1686 struct rpc_xprt *xprt = &transport->xprt; 1672 struct rpc_xprt *xprt = &transport->xprt;
1687 struct socket *sock = transport->sock; 1673 struct socket *sock = transport->sock;
@@ -1692,7 +1678,7 @@ static void xs_udp_setup_socket(struct sock_xprt *transport,
1692 1678
1693 /* Start by resetting any existing state */ 1679 /* Start by resetting any existing state */
1694 xs_reset_transport(transport); 1680 xs_reset_transport(transport);
1695 sock = create_sock(xprt, transport, SOCK_DGRAM, IPPROTO_UDP); 1681 sock = xs_create_sock(xprt, transport, family, SOCK_DGRAM, IPPROTO_UDP);
1696 if (IS_ERR(sock)) 1682 if (IS_ERR(sock))
1697 goto out; 1683 goto out;
1698 1684
@@ -1721,7 +1707,7 @@ static void xs_udp_connect_worker4(struct work_struct *work)
1721 struct sock_xprt *transport = 1707 struct sock_xprt *transport =
1722 container_of(work, struct sock_xprt, connect_worker.work); 1708 container_of(work, struct sock_xprt, connect_worker.work);
1723 1709
1724 xs_udp_setup_socket(transport, xs_create_sock4); 1710 xs_udp_setup_socket(transport, PF_INET);
1725} 1711}
1726 1712
1727/** 1713/**
@@ -1736,7 +1722,7 @@ static void xs_udp_connect_worker6(struct work_struct *work)
1736 struct sock_xprt *transport = 1722 struct sock_xprt *transport =
1737 container_of(work, struct sock_xprt, connect_worker.work); 1723 container_of(work, struct sock_xprt, connect_worker.work);
1738 1724
1739 xs_udp_setup_socket(transport, xs_create_sock6); 1725 xs_udp_setup_socket(transport, PF_INET6);
1740} 1726}
1741 1727
1742/* 1728/*
@@ -1840,9 +1826,7 @@ static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
1840 * 1826 *
1841 * Invoked by a work queue tasklet. 1827 * Invoked by a work queue tasklet.
1842 */ 1828 */
1843static void xs_tcp_setup_socket(struct sock_xprt *transport, 1829static void xs_tcp_setup_socket(struct sock_xprt *transport, int family)
1844 struct socket *(*create_sock)(struct rpc_xprt *,
1845 struct sock_xprt *, int type, int protocol))
1846{ 1830{
1847 struct socket *sock = transport->sock; 1831 struct socket *sock = transport->sock;
1848 struct rpc_xprt *xprt = &transport->xprt; 1832 struct rpc_xprt *xprt = &transport->xprt;
@@ -1853,7 +1837,7 @@ static void xs_tcp_setup_socket(struct sock_xprt *transport,
1853 1837
1854 if (!sock) { 1838 if (!sock) {
1855 clear_bit(XPRT_CONNECTION_ABORT, &xprt->state); 1839 clear_bit(XPRT_CONNECTION_ABORT, &xprt->state);
1856 sock = create_sock(xprt, transport, SOCK_STREAM, IPPROTO_TCP); 1840 sock = xs_create_sock(xprt, transport, family, SOCK_STREAM, IPPROTO_TCP);
1857 if (IS_ERR(sock)) { 1841 if (IS_ERR(sock)) {
1858 status = PTR_ERR(sock); 1842 status = PTR_ERR(sock);
1859 goto out; 1843 goto out;
@@ -1924,7 +1908,7 @@ static void xs_tcp_connect_worker4(struct work_struct *work)
1924 struct sock_xprt *transport = 1908 struct sock_xprt *transport =
1925 container_of(work, struct sock_xprt, connect_worker.work); 1909 container_of(work, struct sock_xprt, connect_worker.work);
1926 1910
1927 xs_tcp_setup_socket(transport, xs_create_sock4); 1911 xs_tcp_setup_socket(transport, PF_INET);
1928} 1912}
1929 1913
1930/** 1914/**
@@ -1938,7 +1922,7 @@ static void xs_tcp_connect_worker6(struct work_struct *work)
1938 struct sock_xprt *transport = 1922 struct sock_xprt *transport =
1939 container_of(work, struct sock_xprt, connect_worker.work); 1923 container_of(work, struct sock_xprt, connect_worker.work);
1940 1924
1941 xs_tcp_setup_socket(transport, xs_create_sock6); 1925 xs_tcp_setup_socket(transport, PF_INET6);
1942} 1926}
1943 1927
1944/** 1928/**