aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2007-11-26 07:10:50 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:55:03 -0500
commit8d8ad9d7c4bfe79bc91b7fc419ecfb9dcdfe6a51 (patch)
tree4b655c4b898e634f39fd170eeb8d06f45b240660 /net
parentce865a61c810c971b47f57c729ec6e9b2d522d94 (diff)
[NET]: Name magic constants in sock_wake_async()
The sock_wake_async() performs a bit different actions depending on "how" argument. Unfortunately this argument ony has numerical magic values. I propose to give names to their constants to help people reading this function callers understand what's going on without looking into this function all the time. I suppose this is 2.6.25 material, but if it's not (or the naming seems poor/bad/awful), I can rework it against the current net-2.6 tree. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/atm/common.c2
-rw-r--r--net/core/sock.c8
-rw-r--r--net/core/stream.c2
-rw-r--r--net/dccp/input.c8
-rw-r--r--net/dccp/output.c2
-rw-r--r--net/ipv4/tcp_input.c12
-rw-r--r--net/rxrpc/af_rxrpc.c2
-rw-r--r--net/sctp/socket.c3
-rw-r--r--net/socket.c9
-rw-r--r--net/unix/af_unix.c8
10 files changed, 28 insertions, 28 deletions
diff --git a/net/atm/common.c b/net/atm/common.c
index eba09a04f6bf..c865517ba449 100644
--- a/net/atm/common.c
+++ b/net/atm/common.c
@@ -113,7 +113,7 @@ static void vcc_write_space(struct sock *sk)
113 if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) 113 if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
114 wake_up_interruptible(sk->sk_sleep); 114 wake_up_interruptible(sk->sk_sleep);
115 115
116 sk_wake_async(sk, 2, POLL_OUT); 116 sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT);
117 } 117 }
118 118
119 read_unlock(&sk->sk_callback_lock); 119 read_unlock(&sk->sk_callback_lock);
diff --git a/net/core/sock.c b/net/core/sock.c
index eac7aa0721da..118214047ed2 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1498,7 +1498,7 @@ static void sock_def_error_report(struct sock *sk)
1498 read_lock(&sk->sk_callback_lock); 1498 read_lock(&sk->sk_callback_lock);
1499 if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) 1499 if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
1500 wake_up_interruptible(sk->sk_sleep); 1500 wake_up_interruptible(sk->sk_sleep);
1501 sk_wake_async(sk,0,POLL_ERR); 1501 sk_wake_async(sk, SOCK_WAKE_IO, POLL_ERR);
1502 read_unlock(&sk->sk_callback_lock); 1502 read_unlock(&sk->sk_callback_lock);
1503} 1503}
1504 1504
@@ -1507,7 +1507,7 @@ static void sock_def_readable(struct sock *sk, int len)
1507 read_lock(&sk->sk_callback_lock); 1507 read_lock(&sk->sk_callback_lock);
1508 if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) 1508 if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
1509 wake_up_interruptible(sk->sk_sleep); 1509 wake_up_interruptible(sk->sk_sleep);
1510 sk_wake_async(sk,1,POLL_IN); 1510 sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_IN);
1511 read_unlock(&sk->sk_callback_lock); 1511 read_unlock(&sk->sk_callback_lock);
1512} 1512}
1513 1513
@@ -1524,7 +1524,7 @@ static void sock_def_write_space(struct sock *sk)
1524 1524
1525 /* Should agree with poll, otherwise some programs break */ 1525 /* Should agree with poll, otherwise some programs break */
1526 if (sock_writeable(sk)) 1526 if (sock_writeable(sk))
1527 sk_wake_async(sk, 2, POLL_OUT); 1527 sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT);
1528 } 1528 }
1529 1529
1530 read_unlock(&sk->sk_callback_lock); 1530 read_unlock(&sk->sk_callback_lock);
@@ -1539,7 +1539,7 @@ void sk_send_sigurg(struct sock *sk)
1539{ 1539{
1540 if (sk->sk_socket && sk->sk_socket->file) 1540 if (sk->sk_socket && sk->sk_socket->file)
1541 if (send_sigurg(&sk->sk_socket->file->f_owner)) 1541 if (send_sigurg(&sk->sk_socket->file->f_owner))
1542 sk_wake_async(sk, 3, POLL_PRI); 1542 sk_wake_async(sk, SOCK_WAKE_URG, POLL_PRI);
1543} 1543}
1544 1544
1545void sk_reset_timer(struct sock *sk, struct timer_list* timer, 1545void sk_reset_timer(struct sock *sk, struct timer_list* timer,
diff --git a/net/core/stream.c b/net/core/stream.c
index b2fb846f42a4..5586879bb9b3 100644
--- a/net/core/stream.c
+++ b/net/core/stream.c
@@ -35,7 +35,7 @@ void sk_stream_write_space(struct sock *sk)
35 if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) 35 if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
36 wake_up_interruptible(sk->sk_sleep); 36 wake_up_interruptible(sk->sk_sleep);
37 if (sock->fasync_list && !(sk->sk_shutdown & SEND_SHUTDOWN)) 37 if (sock->fasync_list && !(sk->sk_shutdown & SEND_SHUTDOWN))
38 sock_wake_async(sock, 2, POLL_OUT); 38 sock_wake_async(sock, SOCK_WAKE_SPACE, POLL_OUT);
39 } 39 }
40} 40}
41 41
diff --git a/net/dccp/input.c b/net/dccp/input.c
index df0fb2c149a6..ef299fbd7c26 100644
--- a/net/dccp/input.c
+++ b/net/dccp/input.c
@@ -37,7 +37,7 @@ static void dccp_rcv_close(struct sock *sk, struct sk_buff *skb)
37 dccp_send_reset(sk, DCCP_RESET_CODE_CLOSED); 37 dccp_send_reset(sk, DCCP_RESET_CODE_CLOSED);
38 dccp_fin(sk, skb); 38 dccp_fin(sk, skb);
39 dccp_set_state(sk, DCCP_CLOSED); 39 dccp_set_state(sk, DCCP_CLOSED);
40 sk_wake_async(sk, 1, POLL_HUP); 40 sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_HUP);
41} 41}
42 42
43static void dccp_rcv_closereq(struct sock *sk, struct sk_buff *skb) 43static void dccp_rcv_closereq(struct sock *sk, struct sk_buff *skb)
@@ -90,7 +90,7 @@ static void dccp_rcv_reset(struct sock *sk, struct sk_buff *skb)
90 dccp_fin(sk, skb); 90 dccp_fin(sk, skb);
91 91
92 if (err && !sock_flag(sk, SOCK_DEAD)) 92 if (err && !sock_flag(sk, SOCK_DEAD))
93 sk_wake_async(sk, 0, POLL_ERR); 93 sk_wake_async(sk, SOCK_WAKE_IO, POLL_ERR);
94 dccp_time_wait(sk, DCCP_TIME_WAIT, 0); 94 dccp_time_wait(sk, DCCP_TIME_WAIT, 0);
95} 95}
96 96
@@ -416,7 +416,7 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk,
416 416
417 if (!sock_flag(sk, SOCK_DEAD)) { 417 if (!sock_flag(sk, SOCK_DEAD)) {
418 sk->sk_state_change(sk); 418 sk->sk_state_change(sk);
419 sk_wake_async(sk, 0, POLL_OUT); 419 sk_wake_async(sk, SOCK_WAKE_IO, POLL_OUT);
420 } 420 }
421 421
422 if (sk->sk_write_pending || icsk->icsk_ack.pingpong || 422 if (sk->sk_write_pending || icsk->icsk_ack.pingpong ||
@@ -624,7 +624,7 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
624 switch (old_state) { 624 switch (old_state) {
625 case DCCP_PARTOPEN: 625 case DCCP_PARTOPEN:
626 sk->sk_state_change(sk); 626 sk->sk_state_change(sk);
627 sk_wake_async(sk, 0, POLL_OUT); 627 sk_wake_async(sk, SOCK_WAKE_IO, POLL_OUT);
628 break; 628 break;
629 } 629 }
630 } else if (unlikely(dh->dccph_type == DCCP_PKT_SYNC)) { 630 } else if (unlikely(dh->dccph_type == DCCP_PKT_SYNC)) {
diff --git a/net/dccp/output.c b/net/dccp/output.c
index f49544618f20..33ce737ef3a8 100644
--- a/net/dccp/output.c
+++ b/net/dccp/output.c
@@ -170,7 +170,7 @@ void dccp_write_space(struct sock *sk)
170 wake_up_interruptible(sk->sk_sleep); 170 wake_up_interruptible(sk->sk_sleep);
171 /* Should agree with poll, otherwise some programs break */ 171 /* Should agree with poll, otherwise some programs break */
172 if (sock_writeable(sk)) 172 if (sock_writeable(sk))
173 sk_wake_async(sk, 2, POLL_OUT); 173 sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT);
174 174
175 read_unlock(&sk->sk_callback_lock); 175 read_unlock(&sk->sk_callback_lock);
176} 176}
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 79996b16b942..97ea3eda206d 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -3595,9 +3595,9 @@ static void tcp_fin(struct sk_buff *skb, struct sock *sk, struct tcphdr *th)
3595 /* Do not send POLL_HUP for half duplex close. */ 3595 /* Do not send POLL_HUP for half duplex close. */
3596 if (sk->sk_shutdown == SHUTDOWN_MASK || 3596 if (sk->sk_shutdown == SHUTDOWN_MASK ||
3597 sk->sk_state == TCP_CLOSE) 3597 sk->sk_state == TCP_CLOSE)
3598 sk_wake_async(sk, 1, POLL_HUP); 3598 sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_HUP);
3599 else 3599 else
3600 sk_wake_async(sk, 1, POLL_IN); 3600 sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_IN);
3601 } 3601 }
3602} 3602}
3603 3603
@@ -4956,7 +4956,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
4956 4956
4957 if (!sock_flag(sk, SOCK_DEAD)) { 4957 if (!sock_flag(sk, SOCK_DEAD)) {
4958 sk->sk_state_change(sk); 4958 sk->sk_state_change(sk);
4959 sk_wake_async(sk, 0, POLL_OUT); 4959 sk_wake_async(sk, SOCK_WAKE_IO, POLL_OUT);
4960 } 4960 }
4961 4961
4962 if (sk->sk_write_pending || 4962 if (sk->sk_write_pending ||
@@ -5186,9 +5186,9 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
5186 * are not waked up, because sk->sk_sleep == 5186 * are not waked up, because sk->sk_sleep ==
5187 * NULL and sk->sk_socket == NULL. 5187 * NULL and sk->sk_socket == NULL.
5188 */ 5188 */
5189 if (sk->sk_socket) { 5189 if (sk->sk_socket)
5190 sk_wake_async(sk,0,POLL_OUT); 5190 sk_wake_async(sk,
5191 } 5191 SOCK_WAKE_IO, POLL_OUT);
5192 5192
5193 tp->snd_una = TCP_SKB_CB(skb)->ack_seq; 5193 tp->snd_una = TCP_SKB_CB(skb)->ack_seq;
5194 tp->snd_wnd = ntohs(th->window) << 5194 tp->snd_wnd = ntohs(th->window) <<
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c
index d6389450c4bf..5e82f1c0afbb 100644
--- a/net/rxrpc/af_rxrpc.c
+++ b/net/rxrpc/af_rxrpc.c
@@ -65,7 +65,7 @@ static void rxrpc_write_space(struct sock *sk)
65 if (rxrpc_writable(sk)) { 65 if (rxrpc_writable(sk)) {
66 if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) 66 if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
67 wake_up_interruptible(sk->sk_sleep); 67 wake_up_interruptible(sk->sk_sleep);
68 sk_wake_async(sk, 2, POLL_OUT); 68 sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT);
69 } 69 }
70 read_unlock(&sk->sk_callback_lock); 70 read_unlock(&sk->sk_callback_lock);
71} 71}
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index ea9649ca0b2a..dc2f9221f092 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -6008,7 +6008,8 @@ static void __sctp_write_space(struct sctp_association *asoc)
6008 */ 6008 */
6009 if (sock->fasync_list && 6009 if (sock->fasync_list &&
6010 !(sk->sk_shutdown & SEND_SHUTDOWN)) 6010 !(sk->sk_shutdown & SEND_SHUTDOWN))
6011 sock_wake_async(sock, 2, POLL_OUT); 6011 sock_wake_async(sock,
6012 SOCK_WAKE_SPACE, POLL_OUT);
6012 } 6013 }
6013 } 6014 }
6014} 6015}
diff --git a/net/socket.c b/net/socket.c
index aeeab388cc38..9ebca5c695d6 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1070,20 +1070,19 @@ int sock_wake_async(struct socket *sock, int how, int band)
1070 if (!sock || !sock->fasync_list) 1070 if (!sock || !sock->fasync_list)
1071 return -1; 1071 return -1;
1072 switch (how) { 1072 switch (how) {
1073 case 1: 1073 case SOCK_WAKE_WAITD:
1074
1075 if (test_bit(SOCK_ASYNC_WAITDATA, &sock->flags)) 1074 if (test_bit(SOCK_ASYNC_WAITDATA, &sock->flags))
1076 break; 1075 break;
1077 goto call_kill; 1076 goto call_kill;
1078 case 2: 1077 case SOCK_WAKE_SPACE:
1079 if (!test_and_clear_bit(SOCK_ASYNC_NOSPACE, &sock->flags)) 1078 if (!test_and_clear_bit(SOCK_ASYNC_NOSPACE, &sock->flags))
1080 break; 1079 break;
1081 /* fall through */ 1080 /* fall through */
1082 case 0: 1081 case SOCK_WAKE_IO:
1083call_kill: 1082call_kill:
1084 __kill_fasync(sock->fasync_list, SIGIO, band); 1083 __kill_fasync(sock->fasync_list, SIGIO, band);
1085 break; 1084 break;
1086 case 3: 1085 case SOCK_WAKE_URG:
1087 __kill_fasync(sock->fasync_list, SIGURG, band); 1086 __kill_fasync(sock->fasync_list, SIGURG, band);
1088 } 1087 }
1089 return 0; 1088 return 0;
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 0f1ecbf86d0f..393197afb190 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -317,7 +317,7 @@ static void unix_write_space(struct sock *sk)
317 if (unix_writable(sk)) { 317 if (unix_writable(sk)) {
318 if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) 318 if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
319 wake_up_interruptible_sync(sk->sk_sleep); 319 wake_up_interruptible_sync(sk->sk_sleep);
320 sk_wake_async(sk, 2, POLL_OUT); 320 sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT);
321 } 321 }
322 read_unlock(&sk->sk_callback_lock); 322 read_unlock(&sk->sk_callback_lock);
323} 323}
@@ -403,7 +403,7 @@ static int unix_release_sock (struct sock *sk, int embrion)
403 unix_state_unlock(skpair); 403 unix_state_unlock(skpair);
404 skpair->sk_state_change(skpair); 404 skpair->sk_state_change(skpair);
405 read_lock(&skpair->sk_callback_lock); 405 read_lock(&skpair->sk_callback_lock);
406 sk_wake_async(skpair,1,POLL_HUP); 406 sk_wake_async(skpair, SOCK_WAKE_WAITD, POLL_HUP);
407 read_unlock(&skpair->sk_callback_lock); 407 read_unlock(&skpair->sk_callback_lock);
408 } 408 }
409 sock_put(skpair); /* It may now die */ 409 sock_put(skpair); /* It may now die */
@@ -1900,9 +1900,9 @@ static int unix_shutdown(struct socket *sock, int mode)
1900 other->sk_state_change(other); 1900 other->sk_state_change(other);
1901 read_lock(&other->sk_callback_lock); 1901 read_lock(&other->sk_callback_lock);
1902 if (peer_mode == SHUTDOWN_MASK) 1902 if (peer_mode == SHUTDOWN_MASK)
1903 sk_wake_async(other,1,POLL_HUP); 1903 sk_wake_async(other, SOCK_WAKE_WAITD, POLL_HUP);
1904 else if (peer_mode & RCV_SHUTDOWN) 1904 else if (peer_mode & RCV_SHUTDOWN)
1905 sk_wake_async(other,1,POLL_IN); 1905 sk_wake_async(other, SOCK_WAKE_WAITD, POLL_IN);
1906 read_unlock(&other->sk_callback_lock); 1906 read_unlock(&other->sk_callback_lock);
1907 } 1907 }
1908 if (other) 1908 if (other)