Skip to content

Commit 2c7d3da

Browse files
author
Christoph Hellwig
committed
net/tcp: convert to ->poll_mask
Signed-off-by: Christoph Hellwig <[email protected]>
1 parent 984652d commit 2c7d3da

File tree

4 files changed

+9
-21
lines changed

4 files changed

+9
-21
lines changed

include/net/tcp.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,7 @@ bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst);
388388
void tcp_close(struct sock *sk, long timeout);
389389
void tcp_init_sock(struct sock *sk);
390390
void tcp_init_transfer(struct sock *sk, int bpf_op);
391-
__poll_t tcp_poll(struct file *file, struct socket *sock,
392-
struct poll_table_struct *wait);
391+
__poll_t tcp_poll_mask(struct socket *sock, __poll_t events);
393392
int tcp_getsockopt(struct sock *sk, int level, int optname,
394393
char __user *optval, int __user *optlen);
395394
int tcp_setsockopt(struct sock *sk, int level, int optname,

net/ipv4/af_inet.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ const struct proto_ops inet_stream_ops = {
986986
.socketpair = sock_no_socketpair,
987987
.accept = inet_accept,
988988
.getname = inet_getname,
989-
.poll = tcp_poll,
989+
.poll_mask = tcp_poll_mask,
990990
.ioctl = inet_ioctl,
991991
.listen = inet_listen,
992992
.shutdown = inet_shutdown,

net/ipv4/tcp.c

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -494,32 +494,21 @@ static inline bool tcp_stream_is_readable(const struct tcp_sock *tp,
494494
}
495495

496496
/*
497-
* Wait for a TCP event.
498-
*
499-
* Note that we don't need to lock the socket, as the upper poll layers
500-
* take care of normal races (between the test and the event) and we don't
501-
* go look at any of the socket buffers directly.
497+
* Socket is not locked. We are protected from async events by poll logic and
498+
* correct handling of state changes made by other threads is impossible in
499+
* any case.
502500
*/
503-
__poll_t tcp_poll(struct file *file, struct socket *sock, poll_table *wait)
501+
__poll_t tcp_poll_mask(struct socket *sock, __poll_t events)
504502
{
505-
__poll_t mask;
506503
struct sock *sk = sock->sk;
507504
const struct tcp_sock *tp = tcp_sk(sk);
505+
__poll_t mask = 0;
508506
int state;
509507

510-
sock_poll_wait(file, sk_sleep(sk), wait);
511-
512508
state = inet_sk_state_load(sk);
513509
if (state == TCP_LISTEN)
514510
return inet_csk_listen_poll(sk);
515511

516-
/* Socket is not locked. We are protected from async events
517-
* by poll logic and correct handling of state changes
518-
* made by other threads is impossible in any case.
519-
*/
520-
521-
mask = 0;
522-
523512
/*
524513
* EPOLLHUP is certainly not done right. But poll() doesn't
525514
* have a notion of HUP in just one direction, and for a
@@ -600,7 +589,7 @@ __poll_t tcp_poll(struct file *file, struct socket *sock, poll_table *wait)
600589

601590
return mask;
602591
}
603-
EXPORT_SYMBOL(tcp_poll);
592+
EXPORT_SYMBOL(tcp_poll_mask);
604593

605594
int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg)
606595
{

net/ipv6/af_inet6.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ const struct proto_ops inet6_stream_ops = {
571571
.socketpair = sock_no_socketpair, /* a do nothing */
572572
.accept = inet_accept, /* ok */
573573
.getname = inet6_getname,
574-
.poll = tcp_poll, /* ok */
574+
.poll_mask = tcp_poll_mask, /* ok */
575575
.ioctl = inet6_ioctl, /* must change */
576576
.listen = inet_listen, /* ok */
577577
.shutdown = inet_shutdown, /* ok */

0 commit comments

Comments
 (0)