diff options
author | Pavel Emelyanov <xemul@parallels.com> | 2010-10-04 08:55:38 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2010-10-19 10:48:15 -0400 |
commit | 573018c07e040b2c3f3cb8251f66fa4a5cb7425d (patch) | |
tree | 179674de7b92fd31b9e83bc64a82092de52cf504 /net | |
parent | 22d44a7d8a03456aa6d0a047c051aa28728e6ecd (diff) |
sunrpc: Call xs_create_sockX directly from setup_socket
Remove now unneeded wrappers that just add type and protocol
to socket creation callback.
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')
-rw-r--r-- | net/sunrpc/xprtsock.c | 40 |
1 files changed, 8 insertions, 32 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 96128d0fd8d2..7fdf2bb956a9 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -1710,7 +1710,7 @@ static void xs_udp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock) | |||
1710 | 1710 | ||
1711 | static void xs_udp_setup_socket(struct sock_xprt *transport, | 1711 | static void xs_udp_setup_socket(struct sock_xprt *transport, |
1712 | struct socket *(*create_sock)(struct rpc_xprt *, | 1712 | struct socket *(*create_sock)(struct rpc_xprt *, |
1713 | struct sock_xprt *)) | 1713 | struct sock_xprt *, int type, int protocol)) |
1714 | { | 1714 | { |
1715 | struct rpc_xprt *xprt = &transport->xprt; | 1715 | struct rpc_xprt *xprt = &transport->xprt; |
1716 | struct socket *sock = transport->sock; | 1716 | struct socket *sock = transport->sock; |
@@ -1721,7 +1721,7 @@ static void xs_udp_setup_socket(struct sock_xprt *transport, | |||
1721 | 1721 | ||
1722 | /* Start by resetting any existing state */ | 1722 | /* Start by resetting any existing state */ |
1723 | xs_reset_transport(transport); | 1723 | xs_reset_transport(transport); |
1724 | sock = create_sock(xprt, transport); | 1724 | sock = create_sock(xprt, transport, SOCK_DGRAM, IPPROTO_UDP); |
1725 | if (IS_ERR(sock)) | 1725 | if (IS_ERR(sock)) |
1726 | goto out; | 1726 | goto out; |
1727 | 1727 | ||
@@ -1745,18 +1745,12 @@ out: | |||
1745 | * Invoked by a work queue tasklet. | 1745 | * Invoked by a work queue tasklet. |
1746 | */ | 1746 | */ |
1747 | 1747 | ||
1748 | static struct socket *xs_create_udp_sock4(struct rpc_xprt *xprt, | ||
1749 | struct sock_xprt *transport) | ||
1750 | { | ||
1751 | return xs_create_sock4(xprt, transport, SOCK_DGRAM, IPPROTO_UDP); | ||
1752 | } | ||
1753 | |||
1754 | static void xs_udp_connect_worker4(struct work_struct *work) | 1748 | static void xs_udp_connect_worker4(struct work_struct *work) |
1755 | { | 1749 | { |
1756 | struct sock_xprt *transport = | 1750 | struct sock_xprt *transport = |
1757 | container_of(work, struct sock_xprt, connect_worker.work); | 1751 | container_of(work, struct sock_xprt, connect_worker.work); |
1758 | 1752 | ||
1759 | xs_udp_setup_socket(transport, xs_create_udp_sock4); | 1753 | xs_udp_setup_socket(transport, xs_create_sock4); |
1760 | } | 1754 | } |
1761 | 1755 | ||
1762 | /** | 1756 | /** |
@@ -1766,18 +1760,12 @@ static void xs_udp_connect_worker4(struct work_struct *work) | |||
1766 | * Invoked by a work queue tasklet. | 1760 | * Invoked by a work queue tasklet. |
1767 | */ | 1761 | */ |
1768 | 1762 | ||
1769 | static struct socket *xs_create_udp_sock6(struct rpc_xprt *xprt, | ||
1770 | struct sock_xprt *transport) | ||
1771 | { | ||
1772 | return xs_create_sock6(xprt, transport, SOCK_DGRAM, IPPROTO_UDP); | ||
1773 | } | ||
1774 | |||
1775 | static void xs_udp_connect_worker6(struct work_struct *work) | 1763 | static void xs_udp_connect_worker6(struct work_struct *work) |
1776 | { | 1764 | { |
1777 | struct sock_xprt *transport = | 1765 | struct sock_xprt *transport = |
1778 | container_of(work, struct sock_xprt, connect_worker.work); | 1766 | container_of(work, struct sock_xprt, connect_worker.work); |
1779 | 1767 | ||
1780 | xs_udp_setup_socket(transport, xs_create_udp_sock6); | 1768 | xs_udp_setup_socket(transport, xs_create_sock6); |
1781 | } | 1769 | } |
1782 | 1770 | ||
1783 | /* | 1771 | /* |
@@ -1883,7 +1871,7 @@ static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock) | |||
1883 | */ | 1871 | */ |
1884 | static void xs_tcp_setup_socket(struct sock_xprt *transport, | 1872 | static void xs_tcp_setup_socket(struct sock_xprt *transport, |
1885 | struct socket *(*create_sock)(struct rpc_xprt *, | 1873 | struct socket *(*create_sock)(struct rpc_xprt *, |
1886 | struct sock_xprt *)) | 1874 | struct sock_xprt *, int type, int protocol)) |
1887 | { | 1875 | { |
1888 | struct socket *sock = transport->sock; | 1876 | struct socket *sock = transport->sock; |
1889 | struct rpc_xprt *xprt = &transport->xprt; | 1877 | struct rpc_xprt *xprt = &transport->xprt; |
@@ -1894,7 +1882,7 @@ static void xs_tcp_setup_socket(struct sock_xprt *transport, | |||
1894 | 1882 | ||
1895 | if (!sock) { | 1883 | if (!sock) { |
1896 | clear_bit(XPRT_CONNECTION_ABORT, &xprt->state); | 1884 | clear_bit(XPRT_CONNECTION_ABORT, &xprt->state); |
1897 | sock = create_sock(xprt, transport); | 1885 | sock = create_sock(xprt, transport, SOCK_STREAM, IPPROTO_TCP); |
1898 | if (IS_ERR(sock)) { | 1886 | if (IS_ERR(sock)) { |
1899 | status = PTR_ERR(sock); | 1887 | status = PTR_ERR(sock); |
1900 | goto out; | 1888 | goto out; |
@@ -1954,12 +1942,6 @@ out: | |||
1954 | xprt_wake_pending_tasks(xprt, status); | 1942 | xprt_wake_pending_tasks(xprt, status); |
1955 | } | 1943 | } |
1956 | 1944 | ||
1957 | static struct socket *xs_create_tcp_sock4(struct rpc_xprt *xprt, | ||
1958 | struct sock_xprt *transport) | ||
1959 | { | ||
1960 | return xs_create_sock4(xprt, transport, SOCK_STREAM, IPPROTO_TCP); | ||
1961 | } | ||
1962 | |||
1963 | /** | 1945 | /** |
1964 | * xs_tcp_connect_worker4 - connect a TCP socket to a remote endpoint | 1946 | * xs_tcp_connect_worker4 - connect a TCP socket to a remote endpoint |
1965 | * @work: RPC transport to connect | 1947 | * @work: RPC transport to connect |
@@ -1971,13 +1953,7 @@ static void xs_tcp_connect_worker4(struct work_struct *work) | |||
1971 | struct sock_xprt *transport = | 1953 | struct sock_xprt *transport = |
1972 | container_of(work, struct sock_xprt, connect_worker.work); | 1954 | container_of(work, struct sock_xprt, connect_worker.work); |
1973 | 1955 | ||
1974 | xs_tcp_setup_socket(transport, xs_create_tcp_sock4); | 1956 | xs_tcp_setup_socket(transport, xs_create_sock4); |
1975 | } | ||
1976 | |||
1977 | static struct socket *xs_create_tcp_sock6(struct rpc_xprt *xprt, | ||
1978 | struct sock_xprt *transport) | ||
1979 | { | ||
1980 | return xs_create_sock6(xprt, transport, SOCK_STREAM, IPPROTO_TCP); | ||
1981 | } | 1957 | } |
1982 | 1958 | ||
1983 | /** | 1959 | /** |
@@ -1991,7 +1967,7 @@ static void xs_tcp_connect_worker6(struct work_struct *work) | |||
1991 | struct sock_xprt *transport = | 1967 | struct sock_xprt *transport = |
1992 | container_of(work, struct sock_xprt, connect_worker.work); | 1968 | container_of(work, struct sock_xprt, connect_worker.work); |
1993 | 1969 | ||
1994 | xs_tcp_setup_socket(transport, xs_create_tcp_sock6); | 1970 | xs_tcp_setup_socket(transport, xs_create_sock6); |
1995 | } | 1971 | } |
1996 | 1972 | ||
1997 | /** | 1973 | /** |