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/atm | |
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/atm')
-rw-r--r-- | net/atm/common.c | 12 | ||||
-rw-r--r-- | net/atm/signaling.c | 2 | ||||
-rw-r--r-- | net/atm/svc.c | 62 |
3 files changed, 38 insertions, 38 deletions
diff --git a/net/atm/common.c b/net/atm/common.c index 97ed94aa0cbc..e3e10e6f8628 100644 --- a/net/atm/common.c +++ b/net/atm/common.c | |||
@@ -92,7 +92,7 @@ static void vcc_def_wakeup(struct sock *sk) | |||
92 | { | 92 | { |
93 | read_lock(&sk->sk_callback_lock); | 93 | read_lock(&sk->sk_callback_lock); |
94 | if (sk_has_sleeper(sk)) | 94 | if (sk_has_sleeper(sk)) |
95 | wake_up(sk->sk_sleep); | 95 | wake_up(sk_sleep(sk)); |
96 | read_unlock(&sk->sk_callback_lock); | 96 | read_unlock(&sk->sk_callback_lock); |
97 | } | 97 | } |
98 | 98 | ||
@@ -110,7 +110,7 @@ static void vcc_write_space(struct sock *sk) | |||
110 | 110 | ||
111 | if (vcc_writable(sk)) { | 111 | if (vcc_writable(sk)) { |
112 | if (sk_has_sleeper(sk)) | 112 | if (sk_has_sleeper(sk)) |
113 | wake_up_interruptible(sk->sk_sleep); | 113 | wake_up_interruptible(sk_sleep(sk)); |
114 | 114 | ||
115 | sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT); | 115 | sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT); |
116 | } | 116 | } |
@@ -549,7 +549,7 @@ int vcc_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m, | |||
549 | } | 549 | } |
550 | 550 | ||
551 | eff = (size+3) & ~3; /* align to word boundary */ | 551 | eff = (size+3) & ~3; /* align to word boundary */ |
552 | prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); | 552 | prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); |
553 | error = 0; | 553 | error = 0; |
554 | while (!(skb = alloc_tx(vcc, eff))) { | 554 | while (!(skb = alloc_tx(vcc, eff))) { |
555 | if (m->msg_flags & MSG_DONTWAIT) { | 555 | if (m->msg_flags & MSG_DONTWAIT) { |
@@ -568,9 +568,9 @@ int vcc_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m, | |||
568 | send_sig(SIGPIPE, current, 0); | 568 | send_sig(SIGPIPE, current, 0); |
569 | break; | 569 | break; |
570 | } | 570 | } |
571 | prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); | 571 | prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); |
572 | } | 572 | } |
573 | finish_wait(sk->sk_sleep, &wait); | 573 | finish_wait(sk_sleep(sk), &wait); |
574 | if (error) | 574 | if (error) |
575 | goto out; | 575 | goto out; |
576 | skb->dev = NULL; /* for paths shared with net_device interfaces */ | 576 | skb->dev = NULL; /* for paths shared with net_device interfaces */ |
@@ -595,7 +595,7 @@ unsigned int vcc_poll(struct file *file, struct socket *sock, poll_table *wait) | |||
595 | struct atm_vcc *vcc; | 595 | struct atm_vcc *vcc; |
596 | unsigned int mask; | 596 | unsigned int mask; |
597 | 597 | ||
598 | sock_poll_wait(file, sk->sk_sleep, wait); | 598 | sock_poll_wait(file, sk_sleep(sk), wait); |
599 | mask = 0; | 599 | mask = 0; |
600 | 600 | ||
601 | vcc = ATM_SD(sock); | 601 | vcc = ATM_SD(sock); |
diff --git a/net/atm/signaling.c b/net/atm/signaling.c index 6ba6e466ee54..509c8ac02b63 100644 --- a/net/atm/signaling.c +++ b/net/atm/signaling.c | |||
@@ -131,7 +131,7 @@ static int sigd_send(struct atm_vcc *vcc, struct sk_buff *skb) | |||
131 | } | 131 | } |
132 | sk->sk_ack_backlog++; | 132 | sk->sk_ack_backlog++; |
133 | skb_queue_tail(&sk->sk_receive_queue, skb); | 133 | skb_queue_tail(&sk->sk_receive_queue, skb); |
134 | pr_debug("waking sk->sk_sleep 0x%p\n", sk->sk_sleep); | 134 | pr_debug("waking sk_sleep(sk) 0x%p\n", sk_sleep(sk)); |
135 | sk->sk_state_change(sk); | 135 | sk->sk_state_change(sk); |
136 | as_indicate_complete: | 136 | as_indicate_complete: |
137 | release_sock(sk); | 137 | release_sock(sk); |
diff --git a/net/atm/svc.c b/net/atm/svc.c index 3ba9a45a51ac..754ee4791d96 100644 --- a/net/atm/svc.c +++ b/net/atm/svc.c | |||
@@ -49,14 +49,14 @@ static void svc_disconnect(struct atm_vcc *vcc) | |||
49 | 49 | ||
50 | pr_debug("%p\n", vcc); | 50 | pr_debug("%p\n", vcc); |
51 | if (test_bit(ATM_VF_REGIS, &vcc->flags)) { | 51 | if (test_bit(ATM_VF_REGIS, &vcc->flags)) { |
52 | prepare_to_wait(sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE); | 52 | prepare_to_wait(sk_sleep(sk), &wait, TASK_UNINTERRUPTIBLE); |
53 | sigd_enq(vcc, as_close, NULL, NULL, NULL); | 53 | sigd_enq(vcc, as_close, NULL, NULL, NULL); |
54 | while (!test_bit(ATM_VF_RELEASED, &vcc->flags) && sigd) { | 54 | while (!test_bit(ATM_VF_RELEASED, &vcc->flags) && sigd) { |
55 | schedule(); | 55 | schedule(); |
56 | prepare_to_wait(sk->sk_sleep, &wait, | 56 | prepare_to_wait(sk_sleep(sk), &wait, |
57 | TASK_UNINTERRUPTIBLE); | 57 | TASK_UNINTERRUPTIBLE); |
58 | } | 58 | } |
59 | finish_wait(sk->sk_sleep, &wait); | 59 | finish_wait(sk_sleep(sk), &wait); |
60 | } | 60 | } |
61 | /* beware - socket is still in use by atmsigd until the last | 61 | /* beware - socket is still in use by atmsigd until the last |
62 | as_indicate has been answered */ | 62 | as_indicate has been answered */ |
@@ -125,13 +125,13 @@ static int svc_bind(struct socket *sock, struct sockaddr *sockaddr, | |||
125 | } | 125 | } |
126 | vcc->local = *addr; | 126 | vcc->local = *addr; |
127 | set_bit(ATM_VF_WAITING, &vcc->flags); | 127 | set_bit(ATM_VF_WAITING, &vcc->flags); |
128 | prepare_to_wait(sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE); | 128 | prepare_to_wait(sk_sleep(sk), &wait, TASK_UNINTERRUPTIBLE); |
129 | sigd_enq(vcc, as_bind, NULL, NULL, &vcc->local); | 129 | sigd_enq(vcc, as_bind, NULL, NULL, &vcc->local); |
130 | while (test_bit(ATM_VF_WAITING, &vcc->flags) && sigd) { | 130 | while (test_bit(ATM_VF_WAITING, &vcc->flags) && sigd) { |
131 | schedule(); | 131 | schedule(); |
132 | prepare_to_wait(sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE); | 132 | prepare_to_wait(sk_sleep(sk), &wait, TASK_UNINTERRUPTIBLE); |
133 | } | 133 | } |
134 | finish_wait(sk->sk_sleep, &wait); | 134 | finish_wait(sk_sleep(sk), &wait); |
135 | clear_bit(ATM_VF_REGIS, &vcc->flags); /* doesn't count */ | 135 | clear_bit(ATM_VF_REGIS, &vcc->flags); /* doesn't count */ |
136 | if (!sigd) { | 136 | if (!sigd) { |
137 | error = -EUNATCH; | 137 | error = -EUNATCH; |
@@ -201,10 +201,10 @@ static int svc_connect(struct socket *sock, struct sockaddr *sockaddr, | |||
201 | } | 201 | } |
202 | vcc->remote = *addr; | 202 | vcc->remote = *addr; |
203 | set_bit(ATM_VF_WAITING, &vcc->flags); | 203 | set_bit(ATM_VF_WAITING, &vcc->flags); |
204 | prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); | 204 | prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); |
205 | sigd_enq(vcc, as_connect, NULL, NULL, &vcc->remote); | 205 | sigd_enq(vcc, as_connect, NULL, NULL, &vcc->remote); |
206 | if (flags & O_NONBLOCK) { | 206 | if (flags & O_NONBLOCK) { |
207 | finish_wait(sk->sk_sleep, &wait); | 207 | finish_wait(sk_sleep(sk), &wait); |
208 | sock->state = SS_CONNECTING; | 208 | sock->state = SS_CONNECTING; |
209 | error = -EINPROGRESS; | 209 | error = -EINPROGRESS; |
210 | goto out; | 210 | goto out; |
@@ -213,7 +213,7 @@ static int svc_connect(struct socket *sock, struct sockaddr *sockaddr, | |||
213 | while (test_bit(ATM_VF_WAITING, &vcc->flags) && sigd) { | 213 | while (test_bit(ATM_VF_WAITING, &vcc->flags) && sigd) { |
214 | schedule(); | 214 | schedule(); |
215 | if (!signal_pending(current)) { | 215 | if (!signal_pending(current)) { |
216 | prepare_to_wait(sk->sk_sleep, &wait, | 216 | prepare_to_wait(sk_sleep(sk), &wait, |
217 | TASK_INTERRUPTIBLE); | 217 | TASK_INTERRUPTIBLE); |
218 | continue; | 218 | continue; |
219 | } | 219 | } |
@@ -232,14 +232,14 @@ static int svc_connect(struct socket *sock, struct sockaddr *sockaddr, | |||
232 | */ | 232 | */ |
233 | sigd_enq(vcc, as_close, NULL, NULL, NULL); | 233 | sigd_enq(vcc, as_close, NULL, NULL, NULL); |
234 | while (test_bit(ATM_VF_WAITING, &vcc->flags) && sigd) { | 234 | while (test_bit(ATM_VF_WAITING, &vcc->flags) && sigd) { |
235 | prepare_to_wait(sk->sk_sleep, &wait, | 235 | prepare_to_wait(sk_sleep(sk), &wait, |
236 | TASK_INTERRUPTIBLE); | 236 | TASK_INTERRUPTIBLE); |
237 | schedule(); | 237 | schedule(); |
238 | } | 238 | } |
239 | if (!sk->sk_err) | 239 | if (!sk->sk_err) |
240 | while (!test_bit(ATM_VF_RELEASED, &vcc->flags) && | 240 | while (!test_bit(ATM_VF_RELEASED, &vcc->flags) && |
241 | sigd) { | 241 | sigd) { |
242 | prepare_to_wait(sk->sk_sleep, &wait, | 242 | prepare_to_wait(sk_sleep(sk), &wait, |
243 | TASK_INTERRUPTIBLE); | 243 | TASK_INTERRUPTIBLE); |
244 | schedule(); | 244 | schedule(); |
245 | } | 245 | } |
@@ -250,7 +250,7 @@ static int svc_connect(struct socket *sock, struct sockaddr *sockaddr, | |||
250 | error = -EINTR; | 250 | error = -EINTR; |
251 | break; | 251 | break; |
252 | } | 252 | } |
253 | finish_wait(sk->sk_sleep, &wait); | 253 | finish_wait(sk_sleep(sk), &wait); |
254 | if (error) | 254 | if (error) |
255 | goto out; | 255 | goto out; |
256 | if (!sigd) { | 256 | if (!sigd) { |
@@ -302,13 +302,13 @@ static int svc_listen(struct socket *sock, int backlog) | |||
302 | goto out; | 302 | goto out; |
303 | } | 303 | } |
304 | set_bit(ATM_VF_WAITING, &vcc->flags); | 304 | set_bit(ATM_VF_WAITING, &vcc->flags); |
305 | prepare_to_wait(sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE); | 305 | prepare_to_wait(sk_sleep(sk), &wait, TASK_UNINTERRUPTIBLE); |
306 | sigd_enq(vcc, as_listen, NULL, NULL, &vcc->local); | 306 | sigd_enq(vcc, as_listen, NULL, NULL, &vcc->local); |
307 | while (test_bit(ATM_VF_WAITING, &vcc->flags) && sigd) { | 307 | while (test_bit(ATM_VF_WAITING, &vcc->flags) && sigd) { |
308 | schedule(); | 308 | schedule(); |
309 | prepare_to_wait(sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE); | 309 | prepare_to_wait(sk_sleep(sk), &wait, TASK_UNINTERRUPTIBLE); |
310 | } | 310 | } |
311 | finish_wait(sk->sk_sleep, &wait); | 311 | finish_wait(sk_sleep(sk), &wait); |
312 | if (!sigd) { | 312 | if (!sigd) { |
313 | error = -EUNATCH; | 313 | error = -EUNATCH; |
314 | goto out; | 314 | goto out; |
@@ -343,7 +343,7 @@ static int svc_accept(struct socket *sock, struct socket *newsock, int flags) | |||
343 | while (1) { | 343 | while (1) { |
344 | DEFINE_WAIT(wait); | 344 | DEFINE_WAIT(wait); |
345 | 345 | ||
346 | prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); | 346 | prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); |
347 | while (!(skb = skb_dequeue(&sk->sk_receive_queue)) && | 347 | while (!(skb = skb_dequeue(&sk->sk_receive_queue)) && |
348 | sigd) { | 348 | sigd) { |
349 | if (test_bit(ATM_VF_RELEASED, &old_vcc->flags)) | 349 | if (test_bit(ATM_VF_RELEASED, &old_vcc->flags)) |
@@ -363,10 +363,10 @@ static int svc_accept(struct socket *sock, struct socket *newsock, int flags) | |||
363 | error = -ERESTARTSYS; | 363 | error = -ERESTARTSYS; |
364 | break; | 364 | break; |
365 | } | 365 | } |
366 | prepare_to_wait(sk->sk_sleep, &wait, | 366 | prepare_to_wait(sk_sleep(sk), &wait, |
367 | TASK_INTERRUPTIBLE); | 367 | TASK_INTERRUPTIBLE); |
368 | } | 368 | } |
369 | finish_wait(sk->sk_sleep, &wait); | 369 | finish_wait(sk_sleep(sk), &wait); |
370 | if (error) | 370 | if (error) |
371 | goto out; | 371 | goto out; |
372 | if (!skb) { | 372 | if (!skb) { |
@@ -392,17 +392,17 @@ static int svc_accept(struct socket *sock, struct socket *newsock, int flags) | |||
392 | } | 392 | } |
393 | /* wait should be short, so we ignore the non-blocking flag */ | 393 | /* wait should be short, so we ignore the non-blocking flag */ |
394 | set_bit(ATM_VF_WAITING, &new_vcc->flags); | 394 | set_bit(ATM_VF_WAITING, &new_vcc->flags); |
395 | prepare_to_wait(sk_atm(new_vcc)->sk_sleep, &wait, | 395 | prepare_to_wait(sk_sleep(sk_atm(new_vcc)), &wait, |
396 | TASK_UNINTERRUPTIBLE); | 396 | TASK_UNINTERRUPTIBLE); |
397 | sigd_enq(new_vcc, as_accept, old_vcc, NULL, NULL); | 397 | sigd_enq(new_vcc, as_accept, old_vcc, NULL, NULL); |
398 | while (test_bit(ATM_VF_WAITING, &new_vcc->flags) && sigd) { | 398 | while (test_bit(ATM_VF_WAITING, &new_vcc->flags) && sigd) { |
399 | release_sock(sk); | 399 | release_sock(sk); |
400 | schedule(); | 400 | schedule(); |
401 | lock_sock(sk); | 401 | lock_sock(sk); |
402 | prepare_to_wait(sk_atm(new_vcc)->sk_sleep, &wait, | 402 | prepare_to_wait(sk_sleep(sk_atm(new_vcc)), &wait, |
403 | TASK_UNINTERRUPTIBLE); | 403 | TASK_UNINTERRUPTIBLE); |
404 | } | 404 | } |
405 | finish_wait(sk_atm(new_vcc)->sk_sleep, &wait); | 405 | finish_wait(sk_sleep(sk_atm(new_vcc)), &wait); |
406 | if (!sigd) { | 406 | if (!sigd) { |
407 | error = -EUNATCH; | 407 | error = -EUNATCH; |
408 | goto out; | 408 | goto out; |
@@ -438,14 +438,14 @@ int svc_change_qos(struct atm_vcc *vcc, struct atm_qos *qos) | |||
438 | DEFINE_WAIT(wait); | 438 | DEFINE_WAIT(wait); |
439 | 439 | ||
440 | set_bit(ATM_VF_WAITING, &vcc->flags); | 440 | set_bit(ATM_VF_WAITING, &vcc->flags); |
441 | prepare_to_wait(sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE); | 441 | prepare_to_wait(sk_sleep(sk), &wait, TASK_UNINTERRUPTIBLE); |
442 | sigd_enq2(vcc, as_modify, NULL, NULL, &vcc->local, qos, 0); | 442 | sigd_enq2(vcc, as_modify, NULL, NULL, &vcc->local, qos, 0); |
443 | while (test_bit(ATM_VF_WAITING, &vcc->flags) && | 443 | while (test_bit(ATM_VF_WAITING, &vcc->flags) && |
444 | !test_bit(ATM_VF_RELEASED, &vcc->flags) && sigd) { | 444 | !test_bit(ATM_VF_RELEASED, &vcc->flags) && sigd) { |
445 | schedule(); | 445 | schedule(); |
446 | prepare_to_wait(sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE); | 446 | prepare_to_wait(sk_sleep(sk), &wait, TASK_UNINTERRUPTIBLE); |
447 | } | 447 | } |
448 | finish_wait(sk->sk_sleep, &wait); | 448 | finish_wait(sk_sleep(sk), &wait); |
449 | if (!sigd) | 449 | if (!sigd) |
450 | return -EUNATCH; | 450 | return -EUNATCH; |
451 | return -sk->sk_err; | 451 | return -sk->sk_err; |
@@ -534,20 +534,20 @@ static int svc_addparty(struct socket *sock, struct sockaddr *sockaddr, | |||
534 | 534 | ||
535 | lock_sock(sk); | 535 | lock_sock(sk); |
536 | set_bit(ATM_VF_WAITING, &vcc->flags); | 536 | set_bit(ATM_VF_WAITING, &vcc->flags); |
537 | prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); | 537 | prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); |
538 | sigd_enq(vcc, as_addparty, NULL, NULL, | 538 | sigd_enq(vcc, as_addparty, NULL, NULL, |
539 | (struct sockaddr_atmsvc *) sockaddr); | 539 | (struct sockaddr_atmsvc *) sockaddr); |
540 | if (flags & O_NONBLOCK) { | 540 | if (flags & O_NONBLOCK) { |
541 | finish_wait(sk->sk_sleep, &wait); | 541 | finish_wait(sk_sleep(sk), &wait); |
542 | error = -EINPROGRESS; | 542 | error = -EINPROGRESS; |
543 | goto out; | 543 | goto out; |
544 | } | 544 | } |
545 | pr_debug("added wait queue\n"); | 545 | pr_debug("added wait queue\n"); |
546 | while (test_bit(ATM_VF_WAITING, &vcc->flags) && sigd) { | 546 | while (test_bit(ATM_VF_WAITING, &vcc->flags) && sigd) { |
547 | schedule(); | 547 | schedule(); |
548 | prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); | 548 | prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); |
549 | } | 549 | } |
550 | finish_wait(sk->sk_sleep, &wait); | 550 | finish_wait(sk_sleep(sk), &wait); |
551 | error = xchg(&sk->sk_err_soft, 0); | 551 | error = xchg(&sk->sk_err_soft, 0); |
552 | out: | 552 | out: |
553 | release_sock(sk); | 553 | release_sock(sk); |
@@ -563,13 +563,13 @@ static int svc_dropparty(struct socket *sock, int ep_ref) | |||
563 | 563 | ||
564 | lock_sock(sk); | 564 | lock_sock(sk); |
565 | set_bit(ATM_VF_WAITING, &vcc->flags); | 565 | set_bit(ATM_VF_WAITING, &vcc->flags); |
566 | prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); | 566 | prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); |
567 | sigd_enq2(vcc, as_dropparty, NULL, NULL, NULL, NULL, ep_ref); | 567 | sigd_enq2(vcc, as_dropparty, NULL, NULL, NULL, NULL, ep_ref); |
568 | while (test_bit(ATM_VF_WAITING, &vcc->flags) && sigd) { | 568 | while (test_bit(ATM_VF_WAITING, &vcc->flags) && sigd) { |
569 | schedule(); | 569 | schedule(); |
570 | prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); | 570 | prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); |
571 | } | 571 | } |
572 | finish_wait(sk->sk_sleep, &wait); | 572 | finish_wait(sk_sleep(sk), &wait); |
573 | if (!sigd) { | 573 | if (!sigd) { |
574 | error = -EUNATCH; | 574 | error = -EUNATCH; |
575 | goto out; | 575 | goto out; |