aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/sock.h
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 /include/net/sock.h
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 'include/net/sock.h')
-rw-r--r--include/net/sock.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index 56df440a950b..8ab05146a447 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1160,6 +1160,10 @@ static inline void sk_set_socket(struct sock *sk, struct socket *sock)
1160 sk->sk_socket = sock; 1160 sk->sk_socket = sock;
1161} 1161}
1162 1162
1163static inline wait_queue_head_t *sk_sleep(struct sock *sk)
1164{
1165 return sk->sk_sleep;
1166}
1163/* Detach socket from process context. 1167/* Detach socket from process context.
1164 * Announce socket dead, detach it from wait queue and inode. 1168 * Announce socket dead, detach it from wait queue and inode.
1165 * Note that parent inode held reference count on this struct sock, 1169 * Note that parent inode held reference count on this struct sock,
@@ -1346,8 +1350,8 @@ static inline int sk_has_allocations(const struct sock *sk)
1346 * tp->rcv_nxt check sock_def_readable 1350 * tp->rcv_nxt check sock_def_readable
1347 * ... { 1351 * ... {
1348 * schedule ... 1352 * schedule ...
1349 * if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) 1353 * if (sk_sleep(sk) && waitqueue_active(sk_sleep(sk)))
1350 * wake_up_interruptible(sk->sk_sleep) 1354 * wake_up_interruptible(sk_sleep(sk))
1351 * ... 1355 * ...
1352 * } 1356 * }
1353 * 1357 *
@@ -1368,7 +1372,7 @@ static inline int sk_has_sleeper(struct sock *sk)
1368 * This memory barrier is paired in the sock_poll_wait. 1372 * This memory barrier is paired in the sock_poll_wait.
1369 */ 1373 */
1370 smp_mb__after_lock(); 1374 smp_mb__after_lock();
1371 return sk->sk_sleep && waitqueue_active(sk->sk_sleep); 1375 return sk_sleep(sk) && waitqueue_active(sk_sleep(sk));
1372} 1376}
1373 1377
1374/** 1378/**