xprt.c (81c098af3da7981902e9f8163aeccc2467c4ba6d) | xprt.c (bc25571e21e8bd053554209f5b1b228ad71e6b99) |
---|---|
1/* 2 * linux/net/sunrpc/xprt.c 3 * 4 * This is a generic RPC call interface supporting congestion avoidance, 5 * and asynchronous calls. 6 * 7 * The interface works like this: 8 * --- 969 unchanged lines hidden (view full) --- 978 * xprt_create_transport - create an RPC transport 979 * @args: rpc transport creation arguments 980 * 981 */ 982struct rpc_xprt *xprt_create_transport(struct rpc_xprtsock_create *args) 983{ 984 struct rpc_xprt *xprt; 985 struct rpc_rqst *req; | 1/* 2 * linux/net/sunrpc/xprt.c 3 * 4 * This is a generic RPC call interface supporting congestion avoidance, 5 * and asynchronous calls. 6 * 7 * The interface works like this: 8 * --- 969 unchanged lines hidden (view full) --- 978 * xprt_create_transport - create an RPC transport 979 * @args: rpc transport creation arguments 980 * 981 */ 982struct rpc_xprt *xprt_create_transport(struct rpc_xprtsock_create *args) 983{ 984 struct rpc_xprt *xprt; 985 struct rpc_rqst *req; |
986 struct xprt_class *t; |
|
986 | 987 |
987 switch (args->proto) { 988 case IPPROTO_UDP: 989 xprt = xs_setup_udp(args); 990 break; 991 case IPPROTO_TCP: 992 xprt = xs_setup_tcp(args); 993 break; 994 default: 995 printk(KERN_ERR "RPC: unrecognized transport protocol: %d\n", 996 args->proto); 997 return ERR_PTR(-EIO); | 988 spin_lock(&xprt_list_lock); 989 list_for_each_entry(t, &xprt_list, list) { 990 if ((t->family == args->dstaddr->sa_family) && 991 (t->protocol == args->proto)) { 992 spin_unlock(&xprt_list_lock); 993 goto found; 994 } |
998 } | 995 } |
996 spin_unlock(&xprt_list_lock); 997 printk(KERN_ERR "RPC: transport (%u/%d) not supported\n", 998 args->dstaddr->sa_family, args->proto); 999 return ERR_PTR(-EIO); 1000 1001found: 1002 xprt = t->setup(args); |
|
999 if (IS_ERR(xprt)) { 1000 dprintk("RPC: xprt_create_transport: failed, %ld\n", 1001 -PTR_ERR(xprt)); 1002 return xprt; 1003 } 1004 1005 kref_init(&xprt->kref); 1006 spin_lock_init(&xprt->transport_lock); --- 69 unchanged lines hidden --- | 1003 if (IS_ERR(xprt)) { 1004 dprintk("RPC: xprt_create_transport: failed, %ld\n", 1005 -PTR_ERR(xprt)); 1006 return xprt; 1007 } 1008 1009 kref_init(&xprt->kref); 1010 spin_lock_init(&xprt->transport_lock); --- 69 unchanged lines hidden --- |