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/ipv4 | |
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/ipv4')
-rw-r--r-- | net/ipv4/af_inet.c | 6 | ||||
-rw-r--r-- | net/ipv4/inet_connection_sock.c | 4 | ||||
-rw-r--r-- | net/ipv4/tcp.c | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index c5376c725503..5ca7290c2e61 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -548,7 +548,7 @@ static long inet_wait_for_connect(struct sock *sk, long timeo) | |||
548 | { | 548 | { |
549 | DEFINE_WAIT(wait); | 549 | DEFINE_WAIT(wait); |
550 | 550 | ||
551 | prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); | 551 | prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); |
552 | 552 | ||
553 | /* Basic assumption: if someone sets sk->sk_err, he _must_ | 553 | /* Basic assumption: if someone sets sk->sk_err, he _must_ |
554 | * change state of the socket from TCP_SYN_*. | 554 | * change state of the socket from TCP_SYN_*. |
@@ -561,9 +561,9 @@ static long inet_wait_for_connect(struct sock *sk, long timeo) | |||
561 | lock_sock(sk); | 561 | lock_sock(sk); |
562 | if (signal_pending(current) || !timeo) | 562 | if (signal_pending(current) || !timeo) |
563 | break; | 563 | break; |
564 | prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); | 564 | prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); |
565 | } | 565 | } |
566 | finish_wait(sk->sk_sleep, &wait); | 566 | finish_wait(sk_sleep(sk), &wait); |
567 | return timeo; | 567 | return timeo; |
568 | } | 568 | } |
569 | 569 | ||
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 8da6429269dd..e0a3e3537b14 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
@@ -234,7 +234,7 @@ static int inet_csk_wait_for_connect(struct sock *sk, long timeo) | |||
234 | * having to remove and re-insert us on the wait queue. | 234 | * having to remove and re-insert us on the wait queue. |
235 | */ | 235 | */ |
236 | for (;;) { | 236 | for (;;) { |
237 | prepare_to_wait_exclusive(sk->sk_sleep, &wait, | 237 | prepare_to_wait_exclusive(sk_sleep(sk), &wait, |
238 | TASK_INTERRUPTIBLE); | 238 | TASK_INTERRUPTIBLE); |
239 | release_sock(sk); | 239 | release_sock(sk); |
240 | if (reqsk_queue_empty(&icsk->icsk_accept_queue)) | 240 | if (reqsk_queue_empty(&icsk->icsk_accept_queue)) |
@@ -253,7 +253,7 @@ static int inet_csk_wait_for_connect(struct sock *sk, long timeo) | |||
253 | if (!timeo) | 253 | if (!timeo) |
254 | break; | 254 | break; |
255 | } | 255 | } |
256 | finish_wait(sk->sk_sleep, &wait); | 256 | finish_wait(sk_sleep(sk), &wait); |
257 | return err; | 257 | return err; |
258 | } | 258 | } |
259 | 259 | ||
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 0f8caf64caa3..77208334a613 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -378,7 +378,7 @@ unsigned int tcp_poll(struct file *file, struct socket *sock, poll_table *wait) | |||
378 | struct sock *sk = sock->sk; | 378 | struct sock *sk = sock->sk; |
379 | struct tcp_sock *tp = tcp_sk(sk); | 379 | struct tcp_sock *tp = tcp_sk(sk); |
380 | 380 | ||
381 | sock_poll_wait(file, sk->sk_sleep, wait); | 381 | sock_poll_wait(file, sk_sleep(sk), wait); |
382 | if (sk->sk_state == TCP_LISTEN) | 382 | if (sk->sk_state == TCP_LISTEN) |
383 | return inet_csk_listen_poll(sk); | 383 | return inet_csk_listen_poll(sk); |
384 | 384 | ||