summaryrefslogtreecommitdiffstats
path: root/net/sunrpc/svcsock.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2009-04-23 19:33:03 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2009-04-28 13:54:29 -0400
commit017cb47f46722f29d101a709a2094d151111ed6d (patch)
tree374085d064c4d74477cb3433bf045ab561a5be7e /net/sunrpc/svcsock.c
parent58de2f86585dd8fc785aca6625adee32af84b8d7 (diff)
downloadblackbird-op-linux-017cb47f46722f29d101a709a2094d151111ed6d.tar.gz
blackbird-op-linux-017cb47f46722f29d101a709a2094d151111ed6d.zip
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/sunrpc/svcsock.c')
-rw-r--r--net/sunrpc/svcsock.c21
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:
*/
static int svc_one_sock_name(struct svc_sock *svsk, char *buf, int remaining)
{
+ const struct sock *sk = svsk->sk_sk;
+ const char *proto_name = sk->sk_protocol == IPPROTO_UDP ?
+ "udp" : "tcp";
int len;
- switch(svsk->sk_sk->sk_family) {
+ switch (sk->sk_family) {
case PF_INET:
len = snprintf(buf, remaining, "ipv4 %s %pI4 %d\n",
- svsk->sk_sk->sk_protocol == IPPROTO_UDP ?
- "udp" : "tcp",
- &inet_sk(svsk->sk_sk)->rcv_saddr,
- inet_sk(svsk->sk_sk)->num);
+ proto_name,
+ &inet_sk(sk)->rcv_saddr,
+ inet_sk(sk)->num);
break;
case PF_INET6:
len = snprintf(buf, remaining, "ipv6 %s %pI6 %d\n",
- svsk->sk_sk->sk_protocol == IPPROTO_UDP ?
- "udp" : "tcp",
- &inet6_sk(svsk->sk_sk)->rcv_saddr,
- inet_sk(svsk->sk_sk)->num);
+ proto_name,
+ &inet6_sk(sk)->rcv_saddr,
+ inet_sk(sk)->num);
break;
default:
len = snprintf(buf, remaining, "*unknown-%d*\n",
- svsk->sk_sk->sk_family);
+ sk->sk_family);
}
if (len >= remaining) {
OpenPOWER on IntegriCloud