aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/clnt.c9
-rw-r--r--net/sunrpc/xprt.c15
-rw-r--r--net/sunrpc/xprtsock.c36
3 files changed, 29 insertions, 31 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 0d9b5275fac3..25bbf2d7f603 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -234,10 +234,15 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args)
234{ 234{
235 struct rpc_xprt *xprt; 235 struct rpc_xprt *xprt;
236 struct rpc_clnt *clnt; 236 struct rpc_clnt *clnt;
237 struct rpc_xprtsock_create xprtargs = {
238 .proto = args->protocol,
239 .dstaddr = args->address,
240 .addrlen = args->addrsize,
241 .timeout = args->timeout
242 };
237 char servername[20]; 243 char servername[20];
238 244
239 xprt = xprt_create_transport(args->protocol, args->address, 245 xprt = xprt_create_transport(&xprtargs);
240 args->addrsize, args->timeout);
241 if (IS_ERR(xprt)) 246 if (IS_ERR(xprt))
242 return (struct rpc_clnt *)xprt; 247 return (struct rpc_clnt *)xprt;
243 248
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 518acb74a5bb..c8c2edccad7e 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -886,27 +886,24 @@ void xprt_set_timeout(struct rpc_timeout *to, unsigned int retr, unsigned long i
886 886
887/** 887/**
888 * xprt_create_transport - create an RPC transport 888 * xprt_create_transport - create an RPC transport
889 * @proto: requested transport protocol 889 * @args: rpc transport creation arguments
890 * @ap: remote peer address
891 * @size: length of address
892 * @to: timeout parameters
893 * 890 *
894 */ 891 */
895struct rpc_xprt *xprt_create_transport(int proto, struct sockaddr *ap, size_t size, struct rpc_timeout *to) 892struct rpc_xprt *xprt_create_transport(struct rpc_xprtsock_create *args)
896{ 893{
897 struct rpc_xprt *xprt; 894 struct rpc_xprt *xprt;
898 struct rpc_rqst *req; 895 struct rpc_rqst *req;
899 896
900 switch (proto) { 897 switch (args->proto) {
901 case IPPROTO_UDP: 898 case IPPROTO_UDP:
902 xprt = xs_setup_udp(ap, size, to); 899 xprt = xs_setup_udp(args);
903 break; 900 break;
904 case IPPROTO_TCP: 901 case IPPROTO_TCP:
905 xprt = xs_setup_tcp(ap, size, to); 902 xprt = xs_setup_tcp(args);
906 break; 903 break;
907 default: 904 default:
908 printk(KERN_ERR "RPC: unrecognized transport protocol: %d\n", 905 printk(KERN_ERR "RPC: unrecognized transport protocol: %d\n",
909 proto); 906 args->proto);
910 return ERR_PTR(-EIO); 907 return ERR_PTR(-EIO);
911 } 908 }
912 if (IS_ERR(xprt)) { 909 if (IS_ERR(xprt)) {
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index a8f7c5fd752c..6b7cea57651c 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1502,12 +1502,12 @@ static struct rpc_xprt_ops xs_tcp_ops = {
1502 .print_stats = xs_tcp_print_stats, 1502 .print_stats = xs_tcp_print_stats,
1503}; 1503};
1504 1504
1505static struct rpc_xprt *xs_setup_xprt(struct sockaddr *addr, size_t addrlen, unsigned int slot_table_size) 1505static struct rpc_xprt *xs_setup_xprt(struct rpc_xprtsock_create *args, unsigned int slot_table_size)
1506{ 1506{
1507 struct rpc_xprt *xprt; 1507 struct rpc_xprt *xprt;
1508 struct sock_xprt *new; 1508 struct sock_xprt *new;
1509 1509
1510 if (addrlen > sizeof(xprt->addr)) { 1510 if (args->addrlen > sizeof(xprt->addr)) {
1511 dprintk("RPC: xs_setup_xprt: address too large\n"); 1511 dprintk("RPC: xs_setup_xprt: address too large\n");
1512 return ERR_PTR(-EBADF); 1512 return ERR_PTR(-EBADF);
1513 } 1513 }
@@ -1529,8 +1529,8 @@ static struct rpc_xprt *xs_setup_xprt(struct sockaddr *addr, size_t addrlen, uns
1529 return ERR_PTR(-ENOMEM); 1529 return ERR_PTR(-ENOMEM);
1530 } 1530 }
1531 1531
1532 memcpy(&xprt->addr, addr, addrlen); 1532 memcpy(&xprt->addr, args->dstaddr, args->addrlen);
1533 xprt->addrlen = addrlen; 1533 xprt->addrlen = args->addrlen;
1534 new->port = xs_get_random_port(); 1534 new->port = xs_get_random_port();
1535 1535
1536 return xprt; 1536 return xprt;
@@ -1538,22 +1538,20 @@ static struct rpc_xprt *xs_setup_xprt(struct sockaddr *addr, size_t addrlen, uns
1538 1538
1539/** 1539/**
1540 * xs_setup_udp - Set up transport to use a UDP socket 1540 * xs_setup_udp - Set up transport to use a UDP socket
1541 * @addr: address of remote server 1541 * @args: rpc transport creation arguments
1542 * @addrlen: length of address in bytes
1543 * @to: timeout parameters
1544 * 1542 *
1545 */ 1543 */
1546struct rpc_xprt *xs_setup_udp(struct sockaddr *addr, size_t addrlen, struct rpc_timeout *to) 1544struct rpc_xprt *xs_setup_udp(struct rpc_xprtsock_create *args)
1547{ 1545{
1548 struct rpc_xprt *xprt; 1546 struct rpc_xprt *xprt;
1549 struct sock_xprt *transport; 1547 struct sock_xprt *transport;
1550 1548
1551 xprt = xs_setup_xprt(addr, addrlen, xprt_udp_slot_table_entries); 1549 xprt = xs_setup_xprt(args, xprt_udp_slot_table_entries);
1552 if (IS_ERR(xprt)) 1550 if (IS_ERR(xprt))
1553 return xprt; 1551 return xprt;
1554 transport = container_of(xprt, struct sock_xprt, xprt); 1552 transport = container_of(xprt, struct sock_xprt, xprt);
1555 1553
1556 if (ntohs(((struct sockaddr_in *)addr)->sin_port) != 0) 1554 if (ntohs(((struct sockaddr_in *)args->dstaddr)->sin_port) != 0)
1557 xprt_set_bound(xprt); 1555 xprt_set_bound(xprt);
1558 1556
1559 xprt->prot = IPPROTO_UDP; 1557 xprt->prot = IPPROTO_UDP;
@@ -1569,8 +1567,8 @@ struct rpc_xprt *xs_setup_udp(struct sockaddr *addr, size_t addrlen, struct rpc_
1569 1567
1570 xprt->ops = &xs_udp_ops; 1568 xprt->ops = &xs_udp_ops;
1571 1569
1572 if (to) 1570 if (args->timeout)
1573 xprt->timeout = *to; 1571 xprt->timeout = *args->timeout;
1574 else 1572 else
1575 xprt_set_timeout(&xprt->timeout, 5, 5 * HZ); 1573 xprt_set_timeout(&xprt->timeout, 5, 5 * HZ);
1576 1574
@@ -1583,22 +1581,20 @@ struct rpc_xprt *xs_setup_udp(struct sockaddr *addr, size_t addrlen, struct rpc_
1583 1581
1584/** 1582/**
1585 * xs_setup_tcp - Set up transport to use a TCP socket 1583 * xs_setup_tcp - Set up transport to use a TCP socket
1586 * @addr: address of remote server 1584 * @args: rpc transport creation arguments
1587 * @addrlen: length of address in bytes
1588 * @to: timeout parameters
1589 * 1585 *
1590 */ 1586 */
1591struct rpc_xprt *xs_setup_tcp(struct sockaddr *addr, size_t addrlen, struct rpc_timeout *to) 1587struct rpc_xprt *xs_setup_tcp(struct rpc_xprtsock_create *args)
1592{ 1588{
1593 struct rpc_xprt *xprt; 1589 struct rpc_xprt *xprt;
1594 struct sock_xprt *transport; 1590 struct sock_xprt *transport;
1595 1591
1596 xprt = xs_setup_xprt(addr, addrlen, xprt_tcp_slot_table_entries); 1592 xprt = xs_setup_xprt(args, xprt_tcp_slot_table_entries);
1597 if (IS_ERR(xprt)) 1593 if (IS_ERR(xprt))
1598 return xprt; 1594 return xprt;
1599 transport = container_of(xprt, struct sock_xprt, xprt); 1595 transport = container_of(xprt, struct sock_xprt, xprt);
1600 1596
1601 if (ntohs(((struct sockaddr_in *)addr)->sin_port) != 0) 1597 if (ntohs(((struct sockaddr_in *)args->dstaddr)->sin_port) != 0)
1602 xprt_set_bound(xprt); 1598 xprt_set_bound(xprt);
1603 1599
1604 xprt->prot = IPPROTO_TCP; 1600 xprt->prot = IPPROTO_TCP;
@@ -1613,8 +1609,8 @@ struct rpc_xprt *xs_setup_tcp(struct sockaddr *addr, size_t addrlen, struct rpc_
1613 1609
1614 xprt->ops = &xs_tcp_ops; 1610 xprt->ops = &xs_tcp_ops;
1615 1611
1616 if (to) 1612 if (args->timeout)
1617 xprt->timeout = *to; 1613 xprt->timeout = *args->timeout;
1618 else 1614 else
1619 xprt_set_timeout(&xprt->timeout, 2, 60 * HZ); 1615 xprt_set_timeout(&xprt->timeout, 2, 60 * HZ);
1620 1616