aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/svcsock.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 9d504234af4a..a2a03e500533 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -1327,3 +1327,42 @@ static void svc_sock_free(struct svc_xprt *xprt)
1327 sock_release(svsk->sk_sock); 1327 sock_release(svsk->sk_sock);
1328 kfree(svsk); 1328 kfree(svsk);
1329} 1329}
1330
1331/*
1332 * Create a svc_xprt.
1333 *
1334 * For internal use only (e.g. nfsv4.1 backchannel).
1335 * Callers should typically use the xpo_create() method.
1336 */
1337struct svc_xprt *svc_sock_create(struct svc_serv *serv, int prot)
1338{
1339 struct svc_sock *svsk;
1340 struct svc_xprt *xprt = NULL;
1341
1342 dprintk("svc: %s\n", __func__);
1343 svsk = kzalloc(sizeof(*svsk), GFP_KERNEL);
1344 if (!svsk)
1345 goto out;
1346
1347 xprt = &svsk->sk_xprt;
1348 if (prot == IPPROTO_TCP)
1349 svc_xprt_init(&svc_tcp_class, xprt, serv);
1350 else if (prot == IPPROTO_UDP)
1351 svc_xprt_init(&svc_udp_class, xprt, serv);
1352 else
1353 BUG();
1354out:
1355 dprintk("svc: %s return %p\n", __func__, xprt);
1356 return xprt;
1357}
1358EXPORT_SYMBOL_GPL(svc_sock_create);
1359
1360/*
1361 * Destroy a svc_sock.
1362 */
1363void svc_sock_destroy(struct svc_xprt *xprt)
1364{
1365 if (xprt)
1366 kfree(container_of(xprt, struct svc_sock, sk_xprt));
1367}
1368EXPORT_SYMBOL_GPL(svc_sock_destroy);