diff options
author | Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> | 2007-04-21 01:18:02 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:29:34 -0400 |
commit | 9e412ba7632f71259a53085665d4983b78257b7c (patch) | |
tree | b02d6df7e5357a741bf6d52a93e04a52b84f1f90 /net/ipv4/tcp.c | |
parent | 38b4da383705394788aa09208917ba200792de4b (diff) |
[TCP]: Sed magic converts func(sk, tp, ...) -> func(sk, ...)
This is (mostly) automated change using magic:
sed -e '/struct sock \*sk/ N' -e '/struct sock \*sk/ N'
-e '/struct sock \*sk/ N' -e '/struct sock \*sk/ N'
-e 's|struct sock \*sk,[\n\t ]*struct tcp_sock \*tp\([^{]*\n{\n\)|
struct sock \*sk\1\tstruct tcp_sock *tp = tcp_sk(sk);\n|g'
-e 's|struct sock \*sk, struct tcp_sock \*tp|
struct sock \*sk|g' -e 's|sk, tp\([^-]\)|sk\1|g'
Fixed four unused variable (tp) warnings that were introduced.
In addition, manually added newlines after local variables and
tweaked function arguments positioning.
$ gcc --version
gcc (GCC) 4.1.1 20060525 (Red Hat 4.1.1-1)
...
$ codiff -fV built-in.o.old built-in.o.new
net/ipv4/route.c:
rt_cache_flush | +14
1 function changed, 14 bytes added
net/ipv4/tcp.c:
tcp_setsockopt | -5
tcp_sendpage | -25
tcp_sendmsg | -16
3 functions changed, 46 bytes removed
net/ipv4/tcp_input.c:
tcp_try_undo_recovery | +3
tcp_try_undo_dsack | +2
tcp_mark_head_lost | -12
tcp_ack | -15
tcp_event_data_recv | -32
tcp_rcv_state_process | -10
tcp_rcv_established | +1
7 functions changed, 6 bytes added, 69 bytes removed, diff: -63
net/ipv4/tcp_output.c:
update_send_head | -9
tcp_transmit_skb | +19
tcp_cwnd_validate | +1
tcp_write_wakeup | -17
__tcp_push_pending_frames | -25
tcp_push_one | -8
tcp_send_fin | -4
7 functions changed, 20 bytes added, 63 bytes removed, diff: -43
built-in.o.new:
18 functions changed, 40 bytes added, 178 bytes removed, diff: -138
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r-- | net/ipv4/tcp.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 99ad52c00c96..2cf9a898ce50 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -460,9 +460,9 @@ static inline int forced_push(struct tcp_sock *tp) | |||
460 | return after(tp->write_seq, tp->pushed_seq + (tp->max_window >> 1)); | 460 | return after(tp->write_seq, tp->pushed_seq + (tp->max_window >> 1)); |
461 | } | 461 | } |
462 | 462 | ||
463 | static inline void skb_entail(struct sock *sk, struct tcp_sock *tp, | 463 | static inline void skb_entail(struct sock *sk, struct sk_buff *skb) |
464 | struct sk_buff *skb) | ||
465 | { | 464 | { |
465 | struct tcp_sock *tp = tcp_sk(sk); | ||
466 | struct tcp_skb_cb *tcb = TCP_SKB_CB(skb); | 466 | struct tcp_skb_cb *tcb = TCP_SKB_CB(skb); |
467 | 467 | ||
468 | skb->csum = 0; | 468 | skb->csum = 0; |
@@ -486,15 +486,17 @@ static inline void tcp_mark_urg(struct tcp_sock *tp, int flags, | |||
486 | } | 486 | } |
487 | } | 487 | } |
488 | 488 | ||
489 | static inline void tcp_push(struct sock *sk, struct tcp_sock *tp, int flags, | 489 | static inline void tcp_push(struct sock *sk, int flags, int mss_now, |
490 | int mss_now, int nonagle) | 490 | int nonagle) |
491 | { | 491 | { |
492 | struct tcp_sock *tp = tcp_sk(sk); | ||
493 | |||
492 | if (tcp_send_head(sk)) { | 494 | if (tcp_send_head(sk)) { |
493 | struct sk_buff *skb = tcp_write_queue_tail(sk); | 495 | struct sk_buff *skb = tcp_write_queue_tail(sk); |
494 | if (!(flags & MSG_MORE) || forced_push(tp)) | 496 | if (!(flags & MSG_MORE) || forced_push(tp)) |
495 | tcp_mark_push(tp, skb); | 497 | tcp_mark_push(tp, skb); |
496 | tcp_mark_urg(tp, flags, skb); | 498 | tcp_mark_urg(tp, flags, skb); |
497 | __tcp_push_pending_frames(sk, tp, mss_now, | 499 | __tcp_push_pending_frames(sk, mss_now, |
498 | (flags & MSG_MORE) ? TCP_NAGLE_CORK : nonagle); | 500 | (flags & MSG_MORE) ? TCP_NAGLE_CORK : nonagle); |
499 | } | 501 | } |
500 | } | 502 | } |
@@ -540,7 +542,7 @@ new_segment: | |||
540 | if (!skb) | 542 | if (!skb) |
541 | goto wait_for_memory; | 543 | goto wait_for_memory; |
542 | 544 | ||
543 | skb_entail(sk, tp, skb); | 545 | skb_entail(sk, skb); |
544 | copy = size_goal; | 546 | copy = size_goal; |
545 | } | 547 | } |
546 | 548 | ||
@@ -586,7 +588,7 @@ new_segment: | |||
586 | 588 | ||
587 | if (forced_push(tp)) { | 589 | if (forced_push(tp)) { |
588 | tcp_mark_push(tp, skb); | 590 | tcp_mark_push(tp, skb); |
589 | __tcp_push_pending_frames(sk, tp, mss_now, TCP_NAGLE_PUSH); | 591 | __tcp_push_pending_frames(sk, mss_now, TCP_NAGLE_PUSH); |
590 | } else if (skb == tcp_send_head(sk)) | 592 | } else if (skb == tcp_send_head(sk)) |
591 | tcp_push_one(sk, mss_now); | 593 | tcp_push_one(sk, mss_now); |
592 | continue; | 594 | continue; |
@@ -595,7 +597,7 @@ wait_for_sndbuf: | |||
595 | set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); | 597 | set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); |
596 | wait_for_memory: | 598 | wait_for_memory: |
597 | if (copied) | 599 | if (copied) |
598 | tcp_push(sk, tp, flags & ~MSG_MORE, mss_now, TCP_NAGLE_PUSH); | 600 | tcp_push(sk, flags & ~MSG_MORE, mss_now, TCP_NAGLE_PUSH); |
599 | 601 | ||
600 | if ((err = sk_stream_wait_memory(sk, &timeo)) != 0) | 602 | if ((err = sk_stream_wait_memory(sk, &timeo)) != 0) |
601 | goto do_error; | 603 | goto do_error; |
@@ -606,7 +608,7 @@ wait_for_memory: | |||
606 | 608 | ||
607 | out: | 609 | out: |
608 | if (copied) | 610 | if (copied) |
609 | tcp_push(sk, tp, flags, mss_now, tp->nonagle); | 611 | tcp_push(sk, flags, mss_now, tp->nonagle); |
610 | return copied; | 612 | return copied; |
611 | 613 | ||
612 | do_error: | 614 | do_error: |
@@ -637,8 +639,9 @@ ssize_t tcp_sendpage(struct socket *sock, struct page *page, int offset, | |||
637 | #define TCP_PAGE(sk) (sk->sk_sndmsg_page) | 639 | #define TCP_PAGE(sk) (sk->sk_sndmsg_page) |
638 | #define TCP_OFF(sk) (sk->sk_sndmsg_off) | 640 | #define TCP_OFF(sk) (sk->sk_sndmsg_off) |
639 | 641 | ||
640 | static inline int select_size(struct sock *sk, struct tcp_sock *tp) | 642 | static inline int select_size(struct sock *sk) |
641 | { | 643 | { |
644 | struct tcp_sock *tp = tcp_sk(sk); | ||
642 | int tmp = tp->mss_cache; | 645 | int tmp = tp->mss_cache; |
643 | 646 | ||
644 | if (sk->sk_route_caps & NETIF_F_SG) { | 647 | if (sk->sk_route_caps & NETIF_F_SG) { |
@@ -714,7 +717,7 @@ new_segment: | |||
714 | if (!sk_stream_memory_free(sk)) | 717 | if (!sk_stream_memory_free(sk)) |
715 | goto wait_for_sndbuf; | 718 | goto wait_for_sndbuf; |
716 | 719 | ||
717 | skb = sk_stream_alloc_pskb(sk, select_size(sk, tp), | 720 | skb = sk_stream_alloc_pskb(sk, select_size(sk), |
718 | 0, sk->sk_allocation); | 721 | 0, sk->sk_allocation); |
719 | if (!skb) | 722 | if (!skb) |
720 | goto wait_for_memory; | 723 | goto wait_for_memory; |
@@ -725,7 +728,7 @@ new_segment: | |||
725 | if (sk->sk_route_caps & NETIF_F_ALL_CSUM) | 728 | if (sk->sk_route_caps & NETIF_F_ALL_CSUM) |
726 | skb->ip_summed = CHECKSUM_PARTIAL; | 729 | skb->ip_summed = CHECKSUM_PARTIAL; |
727 | 730 | ||
728 | skb_entail(sk, tp, skb); | 731 | skb_entail(sk, skb); |
729 | copy = size_goal; | 732 | copy = size_goal; |
730 | } | 733 | } |
731 | 734 | ||
@@ -830,7 +833,7 @@ new_segment: | |||
830 | 833 | ||
831 | if (forced_push(tp)) { | 834 | if (forced_push(tp)) { |
832 | tcp_mark_push(tp, skb); | 835 | tcp_mark_push(tp, skb); |
833 | __tcp_push_pending_frames(sk, tp, mss_now, TCP_NAGLE_PUSH); | 836 | __tcp_push_pending_frames(sk, mss_now, TCP_NAGLE_PUSH); |
834 | } else if (skb == tcp_send_head(sk)) | 837 | } else if (skb == tcp_send_head(sk)) |
835 | tcp_push_one(sk, mss_now); | 838 | tcp_push_one(sk, mss_now); |
836 | continue; | 839 | continue; |
@@ -839,7 +842,7 @@ wait_for_sndbuf: | |||
839 | set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); | 842 | set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); |
840 | wait_for_memory: | 843 | wait_for_memory: |
841 | if (copied) | 844 | if (copied) |
842 | tcp_push(sk, tp, flags & ~MSG_MORE, mss_now, TCP_NAGLE_PUSH); | 845 | tcp_push(sk, flags & ~MSG_MORE, mss_now, TCP_NAGLE_PUSH); |
843 | 846 | ||
844 | if ((err = sk_stream_wait_memory(sk, &timeo)) != 0) | 847 | if ((err = sk_stream_wait_memory(sk, &timeo)) != 0) |
845 | goto do_error; | 848 | goto do_error; |
@@ -851,7 +854,7 @@ wait_for_memory: | |||
851 | 854 | ||
852 | out: | 855 | out: |
853 | if (copied) | 856 | if (copied) |
854 | tcp_push(sk, tp, flags, mss_now, tp->nonagle); | 857 | tcp_push(sk, flags, mss_now, tp->nonagle); |
855 | TCP_CHECK_TIMER(sk); | 858 | TCP_CHECK_TIMER(sk); |
856 | release_sock(sk); | 859 | release_sock(sk); |
857 | return copied; | 860 | return copied; |
@@ -1389,7 +1392,7 @@ do_prequeue: | |||
1389 | skip_copy: | 1392 | skip_copy: |
1390 | if (tp->urg_data && after(tp->copied_seq, tp->urg_seq)) { | 1393 | if (tp->urg_data && after(tp->copied_seq, tp->urg_seq)) { |
1391 | tp->urg_data = 0; | 1394 | tp->urg_data = 0; |
1392 | tcp_fast_path_check(sk, tp); | 1395 | tcp_fast_path_check(sk); |
1393 | } | 1396 | } |
1394 | if (used + offset < skb->len) | 1397 | if (used + offset < skb->len) |
1395 | continue; | 1398 | continue; |
@@ -1830,7 +1833,7 @@ static int do_tcp_setsockopt(struct sock *sk, int level, | |||
1830 | * for currently queued segments. | 1833 | * for currently queued segments. |
1831 | */ | 1834 | */ |
1832 | tp->nonagle |= TCP_NAGLE_OFF|TCP_NAGLE_PUSH; | 1835 | tp->nonagle |= TCP_NAGLE_OFF|TCP_NAGLE_PUSH; |
1833 | tcp_push_pending_frames(sk, tp); | 1836 | tcp_push_pending_frames(sk); |
1834 | } else { | 1837 | } else { |
1835 | tp->nonagle &= ~TCP_NAGLE_OFF; | 1838 | tp->nonagle &= ~TCP_NAGLE_OFF; |
1836 | } | 1839 | } |
@@ -1854,7 +1857,7 @@ static int do_tcp_setsockopt(struct sock *sk, int level, | |||
1854 | tp->nonagle &= ~TCP_NAGLE_CORK; | 1857 | tp->nonagle &= ~TCP_NAGLE_CORK; |
1855 | if (tp->nonagle&TCP_NAGLE_OFF) | 1858 | if (tp->nonagle&TCP_NAGLE_OFF) |
1856 | tp->nonagle |= TCP_NAGLE_PUSH; | 1859 | tp->nonagle |= TCP_NAGLE_PUSH; |
1857 | tcp_push_pending_frames(sk, tp); | 1860 | tcp_push_pending_frames(sk); |
1858 | } | 1861 | } |
1859 | break; | 1862 | break; |
1860 | 1863 | ||