aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/sunrpc/clnt.h7
-rw-r--r--include/linux/sunrpc/xprt.h1
-rw-r--r--net/sunrpc/clnt.c42
-rw-r--r--net/sunrpc/sunrpc_syms.c3
-rw-r--r--net/sunrpc/xprt.c79
-rw-r--r--net/sunrpc/xprtsock.c2
6 files changed, 1 insertions, 133 deletions
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 7817ba82f1b2..f6d1d646ce05 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -91,13 +91,6 @@ struct rpc_procinfo {
91 91
92#ifdef __KERNEL__ 92#ifdef __KERNEL__
93 93
94struct rpc_clnt *rpc_create_client(struct rpc_xprt *xprt, char *servname,
95 struct rpc_program *info,
96 u32 version, rpc_authflavor_t authflavor);
97struct rpc_clnt *rpc_new_client(struct rpc_xprt *xprt, char *servname,
98 struct rpc_program *info,
99 u32 version, rpc_authflavor_t authflavor);
100
101struct rpc_create_args { 94struct rpc_create_args {
102 int protocol; 95 int protocol;
103 struct sockaddr *address; 96 struct sockaddr *address;
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index bc80fcfdd892..de4efea7c856 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -231,7 +231,6 @@ struct rpc_xprt {
231/* 231/*
232 * Transport operations used by ULPs 232 * Transport operations used by ULPs
233 */ 233 */
234struct rpc_xprt * xprt_create_proto(int proto, struct sockaddr_in *addr, struct rpc_timeout *to);
235void xprt_set_timeout(struct rpc_timeout *to, unsigned int retr, unsigned long incr); 234void xprt_set_timeout(struct rpc_timeout *to, unsigned int retr, unsigned long incr);
236 235
237/* 236/*
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index dbb93bdf6cc9..428704dd5b3e 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -97,17 +97,7 @@ rpc_setup_pipedir(struct rpc_clnt *clnt, char *dir_name)
97 } 97 }
98} 98}
99 99
100/* 100static struct rpc_clnt * rpc_new_client(struct rpc_xprt *xprt, char *servname, struct rpc_program *program, u32 vers, rpc_authflavor_t flavor)
101 * Create an RPC client
102 * FIXME: This should also take a flags argument (as in task->tk_flags).
103 * It's called (among others) from pmap_create_client, which may in
104 * turn be called by an async task. In this case, rpciod should not be
105 * made to sleep too long.
106 */
107struct rpc_clnt *
108rpc_new_client(struct rpc_xprt *xprt, char *servname,
109 struct rpc_program *program, u32 vers,
110 rpc_authflavor_t flavor)
111{ 101{
112 struct rpc_version *version; 102 struct rpc_version *version;
113 struct rpc_clnt *clnt = NULL; 103 struct rpc_clnt *clnt = NULL;
@@ -253,36 +243,6 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args)
253} 243}
254EXPORT_SYMBOL(rpc_create); 244EXPORT_SYMBOL(rpc_create);
255 245
256/**
257 * Create an RPC client
258 * @xprt - pointer to xprt struct
259 * @servname - name of server
260 * @info - rpc_program
261 * @version - rpc_program version
262 * @authflavor - rpc_auth flavour to use
263 *
264 * Creates an RPC client structure, then pings the server in order to
265 * determine if it is up, and if it supports this program and version.
266 *
267 * This function should never be called by asynchronous tasks such as
268 * the portmapper.
269 */
270struct rpc_clnt *rpc_create_client(struct rpc_xprt *xprt, char *servname,
271 struct rpc_program *info, u32 version, rpc_authflavor_t authflavor)
272{
273 struct rpc_clnt *clnt;
274 int err;
275
276 clnt = rpc_new_client(xprt, servname, info, version, authflavor);
277 if (IS_ERR(clnt))
278 return clnt;
279 err = rpc_ping(clnt, RPC_TASK_SOFT|RPC_TASK_NOINTR);
280 if (err == 0)
281 return clnt;
282 rpc_shutdown_client(clnt);
283 return ERR_PTR(err);
284}
285
286/* 246/*
287 * This function clones the RPC client structure. It allows us to share the 247 * This function clones the RPC client structure. It allows us to share the
288 * same transport while varying parameters such as the authentication 248 * same transport while varying parameters such as the authentication
diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c
index f38f939ce95f..26c0531d7e25 100644
--- a/net/sunrpc/sunrpc_syms.c
+++ b/net/sunrpc/sunrpc_syms.c
@@ -36,8 +36,6 @@ EXPORT_SYMBOL(rpc_wake_up_status);
36EXPORT_SYMBOL(rpc_release_task); 36EXPORT_SYMBOL(rpc_release_task);
37 37
38/* RPC client functions */ 38/* RPC client functions */
39EXPORT_SYMBOL(rpc_create_client);
40EXPORT_SYMBOL(rpc_new_client);
41EXPORT_SYMBOL(rpc_clone_client); 39EXPORT_SYMBOL(rpc_clone_client);
42EXPORT_SYMBOL(rpc_bind_new_program); 40EXPORT_SYMBOL(rpc_bind_new_program);
43EXPORT_SYMBOL(rpc_destroy_client); 41EXPORT_SYMBOL(rpc_destroy_client);
@@ -57,7 +55,6 @@ EXPORT_SYMBOL(rpc_queue_upcall);
57EXPORT_SYMBOL(rpc_mkpipe); 55EXPORT_SYMBOL(rpc_mkpipe);
58 56
59/* Client transport */ 57/* Client transport */
60EXPORT_SYMBOL(xprt_create_proto);
61EXPORT_SYMBOL(xprt_set_timeout); 58EXPORT_SYMBOL(xprt_set_timeout);
62 59
63/* Client credential cache */ 60/* Client credential cache */
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 17f56cfe2412..e4f64fb58ff2 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -962,85 +962,6 @@ struct rpc_xprt *xprt_create_transport(int proto, struct sockaddr *ap, size_t si
962 return xprt; 962 return xprt;
963} 963}
964 964
965static struct rpc_xprt *xprt_setup(int proto, struct sockaddr_in *ap, struct rpc_timeout *to)
966{
967 int result;
968 struct rpc_xprt *xprt;
969 struct rpc_rqst *req;
970
971 if ((xprt = kzalloc(sizeof(struct rpc_xprt), GFP_KERNEL)) == NULL)
972 return ERR_PTR(-ENOMEM);
973
974 memcpy(&xprt->addr, ap, sizeof(*ap));
975 xprt->addrlen = sizeof(*ap);
976
977 switch (proto) {
978 case IPPROTO_UDP:
979 result = xs_setup_udp(xprt, to);
980 break;
981 case IPPROTO_TCP:
982 result = xs_setup_tcp(xprt, to);
983 break;
984 default:
985 printk(KERN_ERR "RPC: unrecognized transport protocol: %d\n",
986 proto);
987 result = -EIO;
988 break;
989 }
990 if (result) {
991 kfree(xprt);
992 return ERR_PTR(result);
993 }
994
995 spin_lock_init(&xprt->transport_lock);
996 spin_lock_init(&xprt->reserve_lock);
997
998 INIT_LIST_HEAD(&xprt->free);
999 INIT_LIST_HEAD(&xprt->recv);
1000 INIT_WORK(&xprt->task_cleanup, xprt_autoclose, xprt);
1001 init_timer(&xprt->timer);
1002 xprt->timer.function = xprt_init_autodisconnect;
1003 xprt->timer.data = (unsigned long) xprt;
1004 xprt->last_used = jiffies;
1005 xprt->cwnd = RPC_INITCWND;
1006
1007 rpc_init_wait_queue(&xprt->binding, "xprt_binding");
1008 rpc_init_wait_queue(&xprt->pending, "xprt_pending");
1009 rpc_init_wait_queue(&xprt->sending, "xprt_sending");
1010 rpc_init_wait_queue(&xprt->resend, "xprt_resend");
1011 rpc_init_priority_wait_queue(&xprt->backlog, "xprt_backlog");
1012
1013 /* initialize free list */
1014 for (req = &xprt->slot[xprt->max_reqs-1]; req >= &xprt->slot[0]; req--)
1015 list_add(&req->rq_list, &xprt->free);
1016
1017 xprt_init_xid(xprt);
1018
1019 dprintk("RPC: created transport %p with %u slots\n", xprt,
1020 xprt->max_reqs);
1021
1022 return xprt;
1023}
1024
1025/**
1026 * xprt_create_proto - create an RPC client transport
1027 * @proto: requested transport protocol
1028 * @sap: remote peer's address
1029 * @to: timeout parameters for new transport
1030 *
1031 */
1032struct rpc_xprt *xprt_create_proto(int proto, struct sockaddr_in *sap, struct rpc_timeout *to)
1033{
1034 struct rpc_xprt *xprt;
1035
1036 xprt = xprt_setup(proto, sap, to);
1037 if (IS_ERR(xprt))
1038 dprintk("RPC: xprt_create_proto failed\n");
1039 else
1040 dprintk("RPC: xprt_create_proto created xprt %p\n", xprt);
1041 return xprt;
1042}
1043
1044/** 965/**
1045 * xprt_destroy - destroy an RPC transport, killing off all requests. 966 * xprt_destroy - destroy an RPC transport, killing off all requests.
1046 * @xprt: transport to destroy 967 * @xprt: transport to destroy
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 17179aa4c207..0b84fab68d7e 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1376,7 +1376,6 @@ int xs_setup_udp(struct rpc_xprt *xprt, struct rpc_timeout *to)
1376 1376
1377 xprt->prot = IPPROTO_UDP; 1377 xprt->prot = IPPROTO_UDP;
1378 xprt->tsh_size = 0; 1378 xprt->tsh_size = 0;
1379 xprt->resvport = capable(CAP_NET_BIND_SERVICE) ? 1 : 0;
1380 /* XXX: header size can vary due to auth type, IPv6, etc. */ 1379 /* XXX: header size can vary due to auth type, IPv6, etc. */
1381 xprt->max_payload = (1U << 16) - (MAX_HEADER << 3); 1380 xprt->max_payload = (1U << 16) - (MAX_HEADER << 3);
1382 1381
@@ -1423,7 +1422,6 @@ int xs_setup_tcp(struct rpc_xprt *xprt, struct rpc_timeout *to)
1423 1422
1424 xprt->prot = IPPROTO_TCP; 1423 xprt->prot = IPPROTO_TCP;
1425 xprt->tsh_size = sizeof(rpc_fraghdr) / sizeof(u32); 1424 xprt->tsh_size = sizeof(rpc_fraghdr) / sizeof(u32);
1426 xprt->resvport = capable(CAP_NET_BIND_SERVICE) ? 1 : 0;
1427 xprt->max_payload = RPC_MAX_FRAGMENT_SIZE; 1425 xprt->max_payload = RPC_MAX_FRAGMENT_SIZE;
1428 1426
1429 INIT_WORK(&xprt->connect_worker, xs_tcp_connect_worker, xprt); 1427 INIT_WORK(&xprt->connect_worker, xs_tcp_connect_worker, xprt);