diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2009-03-18 20:45:58 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-03-28 15:53:57 -0400 |
commit | 156e62094a74cf43f02f56ef96b6cda567501357 (patch) | |
tree | 100fdf25a7f13f8c2ebebd241d02a9ed46e89292 /net/sunrpc/svc_xprt.c | |
parent | adbbe929569e6eec8ff9feca23f1f2b40b42853d (diff) |
SUNRPC: Clean up svc_find_xprt() calling sequence
Clean up: add documentating comment and use appropriate data types for
svc_find_xprt()'s arguments.
This also eliminates a mixed sign comparison: @port was an int, while
the return value of svc_xprt_local_port() is an unsigned short.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/svc_xprt.c')
-rw-r--r-- | net/sunrpc/svc_xprt.c | 16 |
1 files changed, 11 insertions, 5 deletions
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 | */ |
1045 | struct svc_xprt *svc_find_xprt(struct svc_serv *serv, char *xcl_name, | 1051 | struct 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); |