aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/sunrpc/svc_xprt.h3
-rw-r--r--net/sunrpc/svc_xprt.c16
2 files changed, 13 insertions, 6 deletions
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index 959b931b6053..55b68582c5d9 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -80,7 +80,8 @@ void svc_close_xprt(struct svc_xprt *xprt);
80void svc_delete_xprt(struct svc_xprt *xprt); 80void svc_delete_xprt(struct svc_xprt *xprt);
81int svc_port_is_privileged(struct sockaddr *sin); 81int svc_port_is_privileged(struct sockaddr *sin);
82int svc_print_xprts(char *buf, int maxlen); 82int svc_print_xprts(char *buf, int maxlen);
83struct svc_xprt *svc_find_xprt(struct svc_serv *, char *, int, int); 83struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name,
84 const sa_family_t af, const unsigned short port);
84int svc_xprt_names(struct svc_serv *serv, char *buf, int buflen); 85int svc_xprt_names(struct svc_serv *serv, char *buf, int buflen);
85 86
86static inline void svc_xprt_get(struct svc_xprt *xprt) 87static inline void svc_xprt_get(struct svc_xprt *xprt)
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
index e588df5d6b34..c947c93dbc24 100644
--- a/net/sunrpc/svc_xprt.c
+++ b/net/sunrpc/svc_xprt.c
@@ -1033,7 +1033,13 @@ static struct svc_deferred_req *svc_deferred_dequeue(struct svc_xprt *xprt)
1033 return dr; 1033 return dr;
1034} 1034}
1035 1035
1036/* 1036/**
1037 * svc_find_xprt - find an RPC transport instance
1038 * @serv: pointer to svc_serv to search
1039 * @xcl_name: C string containing transport's class name
1040 * @af: Address family of transport's local address
1041 * @port: transport's IP port number
1042 *
1037 * Return the transport instance pointer for the endpoint accepting 1043 * Return the transport instance pointer for the endpoint accepting
1038 * connections/peer traffic from the specified transport class, 1044 * connections/peer traffic from the specified transport class,
1039 * address family and port. 1045 * address family and port.
@@ -1042,14 +1048,14 @@ static struct svc_deferred_req *svc_deferred_dequeue(struct svc_xprt *xprt)
1042 * wild-card, and will result in matching the first transport in the 1048 * wild-card, and will result in matching the first transport in the
1043 * service's list that has a matching class name. 1049 * service's list that has a matching class name.
1044 */ 1050 */
1045struct svc_xprt *svc_find_xprt(struct svc_serv *serv, char *xcl_name, 1051struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name,
1046 int af, int port) 1052 const sa_family_t af, const unsigned short port)
1047{ 1053{
1048 struct svc_xprt *xprt; 1054 struct svc_xprt *xprt;
1049 struct svc_xprt *found = NULL; 1055 struct svc_xprt *found = NULL;
1050 1056
1051 /* Sanity check the args */ 1057 /* Sanity check the args */
1052 if (!serv || !xcl_name) 1058 if (serv == NULL || xcl_name == NULL)
1053 return found; 1059 return found;
1054 1060
1055 spin_lock_bh(&serv->sv_lock); 1061 spin_lock_bh(&serv->sv_lock);
@@ -1058,7 +1064,7 @@ struct svc_xprt *svc_find_xprt(struct svc_serv *serv, char *xcl_name,
1058 continue; 1064 continue;
1059 if (af != AF_UNSPEC && af != xprt->xpt_local.ss_family) 1065 if (af != AF_UNSPEC && af != xprt->xpt_local.ss_family)
1060 continue; 1066 continue;
1061 if (port && port != svc_xprt_local_port(xprt)) 1067 if (port != 0 && port != svc_xprt_local_port(xprt))
1062 continue; 1068 continue;
1063 found = xprt; 1069 found = xprt;
1064 svc_xprt_get(xprt); 1070 svc_xprt_get(xprt);