aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/stream.c
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2010-04-20 09:03:51 -0400
committerDavid S. Miller <davem@davemloft.net>2010-04-20 19:37:13 -0400
commitaa395145165cb06a0d0885221bbe0ce4a564391d (patch)
tree118b0403621f10db8dc3dbf12079f9af5b19e05d /net/core/stream.c
parentab9304717f7624c41927f442e6b6d418b2d8b3e4 (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/core/stream.c')
-rw-r--r--net/core/stream.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/net/core/stream.c b/net/core/stream.c
index a37debfeb1b2..7b3c3f30b107 100644
--- a/net/core/stream.c
+++ b/net/core/stream.c
@@ -32,8 +32,8 @@ void sk_stream_write_space(struct sock *sk)
32 if (sk_stream_wspace(sk) >= sk_stream_min_wspace(sk) && sock) { 32 if (sk_stream_wspace(sk) >= sk_stream_min_wspace(sk) && sock) {
33 clear_bit(SOCK_NOSPACE, &sock->flags); 33 clear_bit(SOCK_NOSPACE, &sock->flags);
34 34
35 if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) 35 if (sk_sleep(sk) && waitqueue_active(sk_sleep(sk)))
36 wake_up_interruptible_poll(sk->sk_sleep, POLLOUT | 36 wake_up_interruptible_poll(sk_sleep(sk), POLLOUT |
37 POLLWRNORM | POLLWRBAND); 37 POLLWRNORM | POLLWRBAND);
38 if (sock->fasync_list && !(sk->sk_shutdown & SEND_SHUTDOWN)) 38 if (sock->fasync_list && !(sk->sk_shutdown & SEND_SHUTDOWN))
39 sock_wake_async(sock, SOCK_WAKE_SPACE, POLL_OUT); 39 sock_wake_async(sock, SOCK_WAKE_SPACE, POLL_OUT);
@@ -66,13 +66,13 @@ int sk_stream_wait_connect(struct sock *sk, long *timeo_p)
66 if (signal_pending(tsk)) 66 if (signal_pending(tsk))
67 return sock_intr_errno(*timeo_p); 67 return sock_intr_errno(*timeo_p);
68 68
69 prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); 69 prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
70 sk->sk_write_pending++; 70 sk->sk_write_pending++;
71 done = sk_wait_event(sk, timeo_p, 71 done = sk_wait_event(sk, timeo_p,
72 !sk->sk_err && 72 !sk->sk_err &&
73 !((1 << sk->sk_state) & 73 !((1 << sk->sk_state) &
74 ~(TCPF_ESTABLISHED | TCPF_CLOSE_WAIT))); 74 ~(TCPF_ESTABLISHED | TCPF_CLOSE_WAIT)));
75 finish_wait(sk->sk_sleep, &wait); 75 finish_wait(sk_sleep(sk), &wait);
76 sk->sk_write_pending--; 76 sk->sk_write_pending--;
77 } while (!done); 77 } while (!done);
78 return 0; 78 return 0;
@@ -96,13 +96,13 @@ void sk_stream_wait_close(struct sock *sk, long timeout)
96 DEFINE_WAIT(wait); 96 DEFINE_WAIT(wait);
97 97
98 do { 98 do {
99 prepare_to_wait(sk->sk_sleep, &wait, 99 prepare_to_wait(sk_sleep(sk), &wait,
100 TASK_INTERRUPTIBLE); 100 TASK_INTERRUPTIBLE);
101 if (sk_wait_event(sk, &timeout, !sk_stream_closing(sk))) 101 if (sk_wait_event(sk, &timeout, !sk_stream_closing(sk)))
102 break; 102 break;
103 } while (!signal_pending(current) && timeout); 103 } while (!signal_pending(current) && timeout);
104 104
105 finish_wait(sk->sk_sleep, &wait); 105 finish_wait(sk_sleep(sk), &wait);
106 } 106 }
107} 107}
108 108
@@ -126,7 +126,7 @@ int sk_stream_wait_memory(struct sock *sk, long *timeo_p)
126 while (1) { 126 while (1) {
127 set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags); 127 set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);
128 128
129 prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); 129 prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
130 130
131 if (sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN)) 131 if (sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN))
132 goto do_error; 132 goto do_error;
@@ -157,7 +157,7 @@ int sk_stream_wait_memory(struct sock *sk, long *timeo_p)
157 *timeo_p = current_timeo; 157 *timeo_p = current_timeo;
158 } 158 }
159out: 159out:
160 finish_wait(sk->sk_sleep, &wait); 160 finish_wait(sk_sleep(sk), &wait);
161 return err; 161 return err;
162 162
163do_error: 163do_error: