summaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprt.c
diff options
context:
space:
mode:
author\"Talpey, Thomas\ <Thomas.Talpey@netapp.com>2007-09-10 13:46:39 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-10-09 17:17:42 -0400
commitbc25571e21e8bd053554209f5b1b228ad71e6b99 (patch)
tree4c008cc445f24c6b5501b2867b8ba7a752b5d710 /net/sunrpc/xprt.c
parent81c098af3da7981902e9f8163aeccc2467c4ba6d (diff)
downloadop-kernel-dev-bc25571e21e8bd053554209f5b1b228ad71e6b99.zip
op-kernel-dev-bc25571e21e8bd053554209f5b1b228ad71e6b99.tar.gz
SUNRPC: Finish API to load RPC transport implementations dynamically
Allow RPC client transport implementations to be loaded as needed, or as they become available from distributors or third-party vendors. Note that we leave the IP sockets implementation in sunrpc.o permanently, as IP functionality is always available in any kernel that runs NFS. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Tom Talpey <tmt@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/xprt.c')
-rw-r--r--net/sunrpc/xprt.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 5208596..7f8c60b 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -983,19 +983,23 @@ struct rpc_xprt *xprt_create_transport(struct rpc_xprtsock_create *args)
{
struct rpc_xprt *xprt;
struct rpc_rqst *req;
+ struct xprt_class *t;
- switch (args->proto) {
- case IPPROTO_UDP:
- xprt = xs_setup_udp(args);
- break;
- case IPPROTO_TCP:
- xprt = xs_setup_tcp(args);
- break;
- default:
- printk(KERN_ERR "RPC: unrecognized transport protocol: %d\n",
- args->proto);
- return ERR_PTR(-EIO);
+ spin_lock(&xprt_list_lock);
+ list_for_each_entry(t, &xprt_list, list) {
+ if ((t->family == args->dstaddr->sa_family) &&
+ (t->protocol == args->proto)) {
+ spin_unlock(&xprt_list_lock);
+ goto found;
+ }
}
+ spin_unlock(&xprt_list_lock);
+ printk(KERN_ERR "RPC: transport (%u/%d) not supported\n",
+ args->dstaddr->sa_family, args->proto);
+ return ERR_PTR(-EIO);
+
+found:
+ xprt = t->setup(args);
if (IS_ERR(xprt)) {
dprintk("RPC: xprt_create_transport: failed, %ld\n",
-PTR_ERR(xprt));
OpenPOWER on IntegriCloud