diff options
author | Dmitry Yakunin <zeil@yandex-team.ru> | 2020-06-20 18:30:50 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-06-24 21:21:03 +0300 |
commit | dfde1d7dee9bfd095a4f16c9e0579a10f4092e81 (patch) | |
tree | b327543898b5b070e8631a810eb6b65aff1cc967 /include/net/sock.h | |
parent | fea549b030152d5336dbd960b357a4d4b841a851 (diff) | |
download | linux-dfde1d7dee9bfd095a4f16c9e0579a10f4092e81.tar.xz |
sock: Move sock_valbool_flag to header
This is preparation for usage in bpf_setsockopt.
Signed-off-by: Dmitry Yakunin <zeil@yandex-team.ru>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20200620153052.9439-1-zeil@yandex-team.ru
Diffstat (limited to 'include/net/sock.h')
-rw-r--r-- | include/net/sock.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index c53cc42b5ab9..8ba438b671d7 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -879,6 +879,15 @@ static inline void sock_reset_flag(struct sock *sk, enum sock_flags flag) __clear_bit(flag, &sk->sk_flags); } +static inline void sock_valbool_flag(struct sock *sk, enum sock_flags bit, + int valbool) +{ + if (valbool) + sock_set_flag(sk, bit); + else + sock_reset_flag(sk, bit); +} + static inline bool sock_flag(const struct sock *sk, enum sock_flags flag) { return test_bit(flag, &sk->sk_flags); |