diff options
Diffstat (limited to 'net/sunrpc/svcsock.c')
-rw-r--r-- | net/sunrpc/svcsock.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index c75bffeb89eb..54f1b3d993a6 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c | |||
@@ -75,7 +75,7 @@ | |||
75 | * | 75 | * |
76 | */ | 76 | */ |
77 | 77 | ||
78 | #define RPCDBG_FACILITY RPCDBG_SVCSOCK | 78 | #define RPCDBG_FACILITY RPCDBG_SVCXPRT |
79 | 79 | ||
80 | 80 | ||
81 | static struct svc_sock *svc_setup_socket(struct svc_serv *, struct socket *, | 81 | static struct svc_sock *svc_setup_socket(struct svc_serv *, struct socket *, |
@@ -900,12 +900,21 @@ svc_udp_sendto(struct svc_rqst *rqstp) | |||
900 | return error; | 900 | return error; |
901 | } | 901 | } |
902 | 902 | ||
903 | static struct svc_xprt_ops svc_udp_ops = { | ||
904 | }; | ||
905 | |||
906 | static struct svc_xprt_class svc_udp_class = { | ||
907 | .xcl_name = "udp", | ||
908 | .xcl_ops = &svc_udp_ops, | ||
909 | }; | ||
910 | |||
903 | static void | 911 | static void |
904 | svc_udp_init(struct svc_sock *svsk) | 912 | svc_udp_init(struct svc_sock *svsk) |
905 | { | 913 | { |
906 | int one = 1; | 914 | int one = 1; |
907 | mm_segment_t oldfs; | 915 | mm_segment_t oldfs; |
908 | 916 | ||
917 | svc_xprt_init(&svc_udp_class, &svsk->sk_xprt); | ||
909 | svsk->sk_sk->sk_data_ready = svc_udp_data_ready; | 918 | svsk->sk_sk->sk_data_ready = svc_udp_data_ready; |
910 | svsk->sk_sk->sk_write_space = svc_write_space; | 919 | svsk->sk_sk->sk_write_space = svc_write_space; |
911 | svsk->sk_recvfrom = svc_udp_recvfrom; | 920 | svsk->sk_recvfrom = svc_udp_recvfrom; |
@@ -1344,12 +1353,33 @@ svc_tcp_sendto(struct svc_rqst *rqstp) | |||
1344 | return sent; | 1353 | return sent; |
1345 | } | 1354 | } |
1346 | 1355 | ||
1356 | static struct svc_xprt_ops svc_tcp_ops = { | ||
1357 | }; | ||
1358 | |||
1359 | static struct svc_xprt_class svc_tcp_class = { | ||
1360 | .xcl_name = "tcp", | ||
1361 | .xcl_ops = &svc_tcp_ops, | ||
1362 | }; | ||
1363 | |||
1364 | void svc_init_xprt_sock(void) | ||
1365 | { | ||
1366 | svc_reg_xprt_class(&svc_tcp_class); | ||
1367 | svc_reg_xprt_class(&svc_udp_class); | ||
1368 | } | ||
1369 | |||
1370 | void svc_cleanup_xprt_sock(void) | ||
1371 | { | ||
1372 | svc_unreg_xprt_class(&svc_tcp_class); | ||
1373 | svc_unreg_xprt_class(&svc_udp_class); | ||
1374 | } | ||
1375 | |||
1347 | static void | 1376 | static void |
1348 | svc_tcp_init(struct svc_sock *svsk) | 1377 | svc_tcp_init(struct svc_sock *svsk) |
1349 | { | 1378 | { |
1350 | struct sock *sk = svsk->sk_sk; | 1379 | struct sock *sk = svsk->sk_sk; |
1351 | struct tcp_sock *tp = tcp_sk(sk); | 1380 | struct tcp_sock *tp = tcp_sk(sk); |
1352 | 1381 | ||
1382 | svc_xprt_init(&svc_tcp_class, &svsk->sk_xprt); | ||
1353 | svsk->sk_recvfrom = svc_tcp_recvfrom; | 1383 | svsk->sk_recvfrom = svc_tcp_recvfrom; |
1354 | svsk->sk_sendto = svc_tcp_sendto; | 1384 | svsk->sk_sendto = svc_tcp_sendto; |
1355 | 1385 | ||