diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-04-20 09:03:51 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-20 19:37:13 -0400 |
commit | aa395145165cb06a0d0885221bbe0ce4a564391d (patch) | |
tree | 118b0403621f10db8dc3dbf12079f9af5b19e05d /net/tipc/socket.c | |
parent | ab9304717f7624c41927f442e6b6d418b2d8b3e4 (diff) |
net: sk_sleep() helper
Define a new function to return the waitqueue of a "struct sock".
static inline wait_queue_head_t *sk_sleep(struct sock *sk)
{
return sk->sk_sleep;
}
Change all read occurrences of sk_sleep by a call to this function.
Needed for a future RCU conversion. sk_sleep wont be a field directly
available.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/socket.c')
-rw-r--r-- | net/tipc/socket.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index cfb20b80b3a1..66e889ba48fd 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
@@ -446,7 +446,7 @@ static unsigned int poll(struct file *file, struct socket *sock, | |||
446 | struct sock *sk = sock->sk; | 446 | struct sock *sk = sock->sk; |
447 | u32 mask; | 447 | u32 mask; |
448 | 448 | ||
449 | poll_wait(file, sk->sk_sleep, wait); | 449 | poll_wait(file, sk_sleep(sk), wait); |
450 | 450 | ||
451 | if (!skb_queue_empty(&sk->sk_receive_queue) || | 451 | if (!skb_queue_empty(&sk->sk_receive_queue) || |
452 | (sock->state == SS_UNCONNECTED) || | 452 | (sock->state == SS_UNCONNECTED) || |
@@ -591,7 +591,7 @@ static int send_msg(struct kiocb *iocb, struct socket *sock, | |||
591 | break; | 591 | break; |
592 | } | 592 | } |
593 | release_sock(sk); | 593 | release_sock(sk); |
594 | res = wait_event_interruptible(*sk->sk_sleep, | 594 | res = wait_event_interruptible(*sk_sleep(sk), |
595 | !tport->congested); | 595 | !tport->congested); |
596 | lock_sock(sk); | 596 | lock_sock(sk); |
597 | if (res) | 597 | if (res) |
@@ -650,7 +650,7 @@ static int send_packet(struct kiocb *iocb, struct socket *sock, | |||
650 | break; | 650 | break; |
651 | } | 651 | } |
652 | release_sock(sk); | 652 | release_sock(sk); |
653 | res = wait_event_interruptible(*sk->sk_sleep, | 653 | res = wait_event_interruptible(*sk_sleep(sk), |
654 | (!tport->congested || !tport->connected)); | 654 | (!tport->congested || !tport->connected)); |
655 | lock_sock(sk); | 655 | lock_sock(sk); |
656 | if (res) | 656 | if (res) |
@@ -931,7 +931,7 @@ restart: | |||
931 | goto exit; | 931 | goto exit; |
932 | } | 932 | } |
933 | release_sock(sk); | 933 | release_sock(sk); |
934 | res = wait_event_interruptible(*sk->sk_sleep, | 934 | res = wait_event_interruptible(*sk_sleep(sk), |
935 | (!skb_queue_empty(&sk->sk_receive_queue) || | 935 | (!skb_queue_empty(&sk->sk_receive_queue) || |
936 | (sock->state == SS_DISCONNECTING))); | 936 | (sock->state == SS_DISCONNECTING))); |
937 | lock_sock(sk); | 937 | lock_sock(sk); |
@@ -1064,7 +1064,7 @@ restart: | |||
1064 | goto exit; | 1064 | goto exit; |
1065 | } | 1065 | } |
1066 | release_sock(sk); | 1066 | release_sock(sk); |
1067 | res = wait_event_interruptible(*sk->sk_sleep, | 1067 | res = wait_event_interruptible(*sk_sleep(sk), |
1068 | (!skb_queue_empty(&sk->sk_receive_queue) || | 1068 | (!skb_queue_empty(&sk->sk_receive_queue) || |
1069 | (sock->state == SS_DISCONNECTING))); | 1069 | (sock->state == SS_DISCONNECTING))); |
1070 | lock_sock(sk); | 1070 | lock_sock(sk); |
@@ -1271,8 +1271,8 @@ static u32 filter_rcv(struct sock *sk, struct sk_buff *buf) | |||
1271 | tipc_disconnect_port(tipc_sk_port(sk)); | 1271 | tipc_disconnect_port(tipc_sk_port(sk)); |
1272 | } | 1272 | } |
1273 | 1273 | ||
1274 | if (waitqueue_active(sk->sk_sleep)) | 1274 | if (waitqueue_active(sk_sleep(sk))) |
1275 | wake_up_interruptible(sk->sk_sleep); | 1275 | wake_up_interruptible(sk_sleep(sk)); |
1276 | return TIPC_OK; | 1276 | return TIPC_OK; |
1277 | } | 1277 | } |
1278 | 1278 | ||
@@ -1343,8 +1343,8 @@ static void wakeupdispatch(struct tipc_port *tport) | |||
1343 | { | 1343 | { |
1344 | struct sock *sk = (struct sock *)tport->usr_handle; | 1344 | struct sock *sk = (struct sock *)tport->usr_handle; |
1345 | 1345 | ||
1346 | if (waitqueue_active(sk->sk_sleep)) | 1346 | if (waitqueue_active(sk_sleep(sk))) |
1347 | wake_up_interruptible(sk->sk_sleep); | 1347 | wake_up_interruptible(sk_sleep(sk)); |
1348 | } | 1348 | } |
1349 | 1349 | ||
1350 | /** | 1350 | /** |
@@ -1426,7 +1426,7 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen, | |||
1426 | /* Wait until an 'ACK' or 'RST' arrives, or a timeout occurs */ | 1426 | /* Wait until an 'ACK' or 'RST' arrives, or a timeout occurs */ |
1427 | 1427 | ||
1428 | release_sock(sk); | 1428 | release_sock(sk); |
1429 | res = wait_event_interruptible_timeout(*sk->sk_sleep, | 1429 | res = wait_event_interruptible_timeout(*sk_sleep(sk), |
1430 | (!skb_queue_empty(&sk->sk_receive_queue) || | 1430 | (!skb_queue_empty(&sk->sk_receive_queue) || |
1431 | (sock->state != SS_CONNECTING)), | 1431 | (sock->state != SS_CONNECTING)), |
1432 | sk->sk_rcvtimeo); | 1432 | sk->sk_rcvtimeo); |
@@ -1521,7 +1521,7 @@ static int accept(struct socket *sock, struct socket *new_sock, int flags) | |||
1521 | goto exit; | 1521 | goto exit; |
1522 | } | 1522 | } |
1523 | release_sock(sk); | 1523 | release_sock(sk); |
1524 | res = wait_event_interruptible(*sk->sk_sleep, | 1524 | res = wait_event_interruptible(*sk_sleep(sk), |
1525 | (!skb_queue_empty(&sk->sk_receive_queue))); | 1525 | (!skb_queue_empty(&sk->sk_receive_queue))); |
1526 | lock_sock(sk); | 1526 | lock_sock(sk); |
1527 | if (res) | 1527 | if (res) |
@@ -1632,8 +1632,8 @@ restart: | |||
1632 | /* Discard any unreceived messages; wake up sleeping tasks */ | 1632 | /* Discard any unreceived messages; wake up sleeping tasks */ |
1633 | 1633 | ||
1634 | discard_rx_queue(sk); | 1634 | discard_rx_queue(sk); |
1635 | if (waitqueue_active(sk->sk_sleep)) | 1635 | if (waitqueue_active(sk_sleep(sk))) |
1636 | wake_up_interruptible(sk->sk_sleep); | 1636 | wake_up_interruptible(sk_sleep(sk)); |
1637 | res = 0; | 1637 | res = 0; |
1638 | break; | 1638 | break; |
1639 | 1639 | ||