diff options
author | Cong Wang <cong.wang@bytedance.com> | 2021-10-08 22:33:03 +0200 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2021-10-26 21:29:33 +0200 |
commit | 7b50ecfcc6cdfe87488576bc3ed443dc8d083b90 (patch) | |
tree | 0851392dcfe34a0f7812e4e1a39c8a972d89fa80 /include/net/sock.h | |
parent | tcp_bpf: Fix one concurrency problem in the tcp_bpf_send_verdict function (diff) | |
download | linux-7b50ecfcc6cdfe87488576bc3ed443dc8d083b90.tar.xz linux-7b50ecfcc6cdfe87488576bc3ed443dc8d083b90.zip |
net: Rename ->stream_memory_read to ->sock_is_readable
The proto ops ->stream_memory_read() is currently only used
by TCP to check whether psock queue is empty or not. We need
to rename it before reusing it for non-TCP protocols, and
adjust the exsiting users accordingly.
Signed-off-by: Cong Wang <cong.wang@bytedance.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20211008203306.37525-2-xiyou.wangcong@gmail.com
Diffstat (limited to 'include/net/sock.h')
-rw-r--r-- | include/net/sock.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index ea6fbc88c8f9..463f390d90b3 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1208,7 +1208,7 @@ struct proto { #endif bool (*stream_memory_free)(const struct sock *sk, int wake); - bool (*stream_memory_read)(const struct sock *sk); + bool (*sock_is_readable)(struct sock *sk); /* Memory pressure */ void (*enter_memory_pressure)(struct sock *sk); void (*leave_memory_pressure)(struct sock *sk); @@ -2820,4 +2820,10 @@ void sock_set_sndtimeo(struct sock *sk, s64 secs); int sock_bind_add(struct sock *sk, struct sockaddr *addr, int addr_len); +static inline bool sk_is_readable(struct sock *sk) +{ + if (sk->sk_prot->sock_is_readable) + return sk->sk_prot->sock_is_readable(sk); + return false; +} #endif /* _SOCK_H */ |