Commit dfde1d7d authored by Dmitry Yakunin's avatar Dmitry Yakunin Committed by Alexei Starovoitov

sock: Move sock_valbool_flag to header

This is preparation for usage in bpf_setsockopt.
Signed-off-by: default avatarDmitry Yakunin <zeil@yandex-team.ru>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20200620153052.9439-1-zeil@yandex-team.ru
parent fea549b0
...@@ -879,6 +879,15 @@ static inline void sock_reset_flag(struct sock *sk, enum sock_flags flag) ...@@ -879,6 +879,15 @@ static inline void sock_reset_flag(struct sock *sk, enum sock_flags flag)
__clear_bit(flag, &sk->sk_flags); __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) static inline bool sock_flag(const struct sock *sk, enum sock_flags flag)
{ {
return test_bit(flag, &sk->sk_flags); return test_bit(flag, &sk->sk_flags);
......
...@@ -695,15 +695,6 @@ static int sock_getbindtodevice(struct sock *sk, char __user *optval, ...@@ -695,15 +695,6 @@ static int sock_getbindtodevice(struct sock *sk, char __user *optval,
return ret; return ret;
} }
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);
}
bool sk_mc_loop(struct sock *sk) bool sk_mc_loop(struct sock *sk)
{ {
if (dev_recursion_level()) if (dev_recursion_level())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment