diff options
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/svc_xprt.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index 2e5b92ae24ed..512c10fc1a9f 100644 --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c | |||
@@ -977,3 +977,38 @@ static struct svc_deferred_req *svc_deferred_dequeue(struct svc_xprt *xprt) | |||
977 | spin_unlock(&xprt->xpt_lock); | 977 | spin_unlock(&xprt->xpt_lock); |
978 | return dr; | 978 | return dr; |
979 | } | 979 | } |
980 | |||
981 | /* | ||
982 | * Return the transport instance pointer for the endpoint accepting | ||
983 | * connections/peer traffic from the specified transport class, | ||
984 | * address family and port. | ||
985 | * | ||
986 | * Specifying 0 for the address family or port is effectively a | ||
987 | * wild-card, and will result in matching the first transport in the | ||
988 | * service's list that has a matching class name. | ||
989 | */ | ||
990 | struct svc_xprt *svc_find_xprt(struct svc_serv *serv, char *xcl_name, | ||
991 | int af, int port) | ||
992 | { | ||
993 | struct svc_xprt *xprt; | ||
994 | struct svc_xprt *found = NULL; | ||
995 | |||
996 | /* Sanity check the args */ | ||
997 | if (!serv || !xcl_name) | ||
998 | return found; | ||
999 | |||
1000 | spin_lock_bh(&serv->sv_lock); | ||
1001 | list_for_each_entry(xprt, &serv->sv_permsocks, xpt_list) { | ||
1002 | if (strcmp(xprt->xpt_class->xcl_name, xcl_name)) | ||
1003 | continue; | ||
1004 | if (af != AF_UNSPEC && af != xprt->xpt_local.ss_family) | ||
1005 | continue; | ||
1006 | if (port && port != svc_xprt_local_port(xprt)) | ||
1007 | continue; | ||
1008 | found = xprt; | ||
1009 | break; | ||
1010 | } | ||
1011 | spin_unlock_bh(&serv->sv_lock); | ||
1012 | return found; | ||
1013 | } | ||
1014 | EXPORT_SYMBOL_GPL(svc_find_xprt); | ||