diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2009-04-23 19:33:03 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2009-04-28 13:54:29 -0400 |
commit | 017cb47f46722f29d101a709a2094d151111ed6d (patch) | |
tree | 374085d064c4d74477cb3433bf045ab561a5be7e /net | |
parent | 58de2f86585dd8fc785aca6625adee32af84b8d7 (diff) |
SUNRPC: Clean up one_sock_name()
Clean up svc_one_sock_name() by setting up automatic variables for
frequently used expressions.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/svcsock.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 983bfa9f3102..4e6d406264a0 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c | |||
@@ -242,26 +242,27 @@ out: | |||
242 | */ | 242 | */ |
243 | static int svc_one_sock_name(struct svc_sock *svsk, char *buf, int remaining) | 243 | static int svc_one_sock_name(struct svc_sock *svsk, char *buf, int remaining) |
244 | { | 244 | { |
245 | const struct sock *sk = svsk->sk_sk; | ||
246 | const char *proto_name = sk->sk_protocol == IPPROTO_UDP ? | ||
247 | "udp" : "tcp"; | ||
245 | int len; | 248 | int len; |
246 | 249 | ||
247 | switch(svsk->sk_sk->sk_family) { | 250 | switch (sk->sk_family) { |
248 | case PF_INET: | 251 | case PF_INET: |
249 | len = snprintf(buf, remaining, "ipv4 %s %pI4 %d\n", | 252 | len = snprintf(buf, remaining, "ipv4 %s %pI4 %d\n", |
250 | svsk->sk_sk->sk_protocol == IPPROTO_UDP ? | 253 | proto_name, |
251 | "udp" : "tcp", | 254 | &inet_sk(sk)->rcv_saddr, |
252 | &inet_sk(svsk->sk_sk)->rcv_saddr, | 255 | inet_sk(sk)->num); |
253 | inet_sk(svsk->sk_sk)->num); | ||
254 | break; | 256 | break; |
255 | case PF_INET6: | 257 | case PF_INET6: |
256 | len = snprintf(buf, remaining, "ipv6 %s %pI6 %d\n", | 258 | len = snprintf(buf, remaining, "ipv6 %s %pI6 %d\n", |
257 | svsk->sk_sk->sk_protocol == IPPROTO_UDP ? | 259 | proto_name, |
258 | "udp" : "tcp", | 260 | &inet6_sk(sk)->rcv_saddr, |
259 | &inet6_sk(svsk->sk_sk)->rcv_saddr, | 261 | inet_sk(sk)->num); |
260 | inet_sk(svsk->sk_sk)->num); | ||
261 | break; | 262 | break; |
262 | default: | 263 | default: |
263 | len = snprintf(buf, remaining, "*unknown-%d*\n", | 264 | len = snprintf(buf, remaining, "*unknown-%d*\n", |
264 | svsk->sk_sk->sk_family); | 265 | sk->sk_family); |
265 | } | 266 | } |
266 | 267 | ||
267 | if (len >= remaining) { | 268 | if (len >= remaining) { |