diff options
author | Eric Dumazet <edumazet@google.com> | 2012-05-16 01:57:07 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-16 15:30:26 -0400 |
commit | 1b23a5dfc20469d4a4bb8a552dd224ac693c407c (patch) | |
tree | 304bbd5a49eb33a0fa4e8ca103811c0f936037c7 | |
parent | 865ec5523dadbedefbc5710a68969f686a28d928 (diff) |
net: sock_flag() cleanup
- sock_flag() accepts a const pointer
- sock_flag() returns a boolean
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/sock.h | 2 | ||||
-rw-r--r-- | net/core/sock.c | 14 |
2 files changed, 8 insertions, 8 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index e613704e9d1c..036f5069b6e0 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -650,7 +650,7 @@ static inline void sock_reset_flag(struct sock *sk, enum sock_flags flag) | |||
650 | __clear_bit(flag, &sk->sk_flags); | 650 | __clear_bit(flag, &sk->sk_flags); |
651 | } | 651 | } |
652 | 652 | ||
653 | static inline int sock_flag(struct sock *sk, enum sock_flags flag) | 653 | static inline bool sock_flag(const struct sock *sk, enum sock_flags flag) |
654 | { | 654 | { |
655 | return test_bit(flag, &sk->sk_flags); | 655 | return test_bit(flag, &sk->sk_flags); |
656 | } | 656 | } |
diff --git a/net/core/sock.c b/net/core/sock.c index 26ed27fb2bfb..9d144ee7e379 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -849,7 +849,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname, | |||
849 | break; | 849 | break; |
850 | 850 | ||
851 | case SO_BROADCAST: | 851 | case SO_BROADCAST: |
852 | v.val = !!sock_flag(sk, SOCK_BROADCAST); | 852 | v.val = sock_flag(sk, SOCK_BROADCAST); |
853 | break; | 853 | break; |
854 | 854 | ||
855 | case SO_SNDBUF: | 855 | case SO_SNDBUF: |
@@ -865,7 +865,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname, | |||
865 | break; | 865 | break; |
866 | 866 | ||
867 | case SO_KEEPALIVE: | 867 | case SO_KEEPALIVE: |
868 | v.val = !!sock_flag(sk, SOCK_KEEPOPEN); | 868 | v.val = sock_flag(sk, SOCK_KEEPOPEN); |
869 | break; | 869 | break; |
870 | 870 | ||
871 | case SO_TYPE: | 871 | case SO_TYPE: |
@@ -887,7 +887,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname, | |||
887 | break; | 887 | break; |
888 | 888 | ||
889 | case SO_OOBINLINE: | 889 | case SO_OOBINLINE: |
890 | v.val = !!sock_flag(sk, SOCK_URGINLINE); | 890 | v.val = sock_flag(sk, SOCK_URGINLINE); |
891 | break; | 891 | break; |
892 | 892 | ||
893 | case SO_NO_CHECK: | 893 | case SO_NO_CHECK: |
@@ -900,7 +900,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname, | |||
900 | 900 | ||
901 | case SO_LINGER: | 901 | case SO_LINGER: |
902 | lv = sizeof(v.ling); | 902 | lv = sizeof(v.ling); |
903 | v.ling.l_onoff = !!sock_flag(sk, SOCK_LINGER); | 903 | v.ling.l_onoff = sock_flag(sk, SOCK_LINGER); |
904 | v.ling.l_linger = sk->sk_lingertime / HZ; | 904 | v.ling.l_linger = sk->sk_lingertime / HZ; |
905 | break; | 905 | break; |
906 | 906 | ||
@@ -1012,11 +1012,11 @@ int sock_getsockopt(struct socket *sock, int level, int optname, | |||
1012 | break; | 1012 | break; |
1013 | 1013 | ||
1014 | case SO_RXQ_OVFL: | 1014 | case SO_RXQ_OVFL: |
1015 | v.val = !!sock_flag(sk, SOCK_RXQ_OVFL); | 1015 | v.val = sock_flag(sk, SOCK_RXQ_OVFL); |
1016 | break; | 1016 | break; |
1017 | 1017 | ||
1018 | case SO_WIFI_STATUS: | 1018 | case SO_WIFI_STATUS: |
1019 | v.val = !!sock_flag(sk, SOCK_WIFI_STATUS); | 1019 | v.val = sock_flag(sk, SOCK_WIFI_STATUS); |
1020 | break; | 1020 | break; |
1021 | 1021 | ||
1022 | case SO_PEEK_OFF: | 1022 | case SO_PEEK_OFF: |
@@ -1026,7 +1026,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname, | |||
1026 | v.val = sk->sk_peek_off; | 1026 | v.val = sk->sk_peek_off; |
1027 | break; | 1027 | break; |
1028 | case SO_NOFCS: | 1028 | case SO_NOFCS: |
1029 | v.val = !!sock_flag(sk, SOCK_NOFCS); | 1029 | v.val = sock_flag(sk, SOCK_NOFCS); |
1030 | break; | 1030 | break; |
1031 | default: | 1031 | default: |
1032 | return -ENOPROTOOPT; | 1032 | return -ENOPROTOOPT; |