aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_ipv4.c
diff options
context:
space:
mode:
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>2013-11-14 17:31:57 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-14 19:32:20 -0500
commit652586df95e5d76b37d07a11839126dcfede1621 (patch)
treee3a668265cade256302830ea3ff8b3699ab2977e /net/ipv4/tcp_ipv4.c
parent839cc2a94cc3665bafe32203c2f095f4dd470a80 (diff)
seq_file: remove "%n" usage from seq_file users
All seq_printf() users are using "%n" for calculating padding size, convert them to use seq_setwidth() / seq_pad() pair. Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Signed-off-by: Kees Cook <keescook@chromium.org> Cc: Joe Perches <joe@perches.com> Cc: David Miller <davem@davemloft.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'net/ipv4/tcp_ipv4.c')
-rw-r--r--net/ipv4/tcp_ipv4.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 14bba8a1c5a7..59a6f8b90cd9 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2541,13 +2541,13 @@ void tcp_proc_unregister(struct net *net, struct tcp_seq_afinfo *afinfo)
2541EXPORT_SYMBOL(tcp_proc_unregister); 2541EXPORT_SYMBOL(tcp_proc_unregister);
2542 2542
2543static void get_openreq4(const struct sock *sk, const struct request_sock *req, 2543static void get_openreq4(const struct sock *sk, const struct request_sock *req,
2544 struct seq_file *f, int i, kuid_t uid, int *len) 2544 struct seq_file *f, int i, kuid_t uid)
2545{ 2545{
2546 const struct inet_request_sock *ireq = inet_rsk(req); 2546 const struct inet_request_sock *ireq = inet_rsk(req);
2547 long delta = req->expires - jiffies; 2547 long delta = req->expires - jiffies;
2548 2548
2549 seq_printf(f, "%4d: %08X:%04X %08X:%04X" 2549 seq_printf(f, "%4d: %08X:%04X %08X:%04X"
2550 " %02X %08X:%08X %02X:%08lX %08X %5u %8d %u %d %pK%n", 2550 " %02X %08X:%08X %02X:%08lX %08X %5u %8d %u %d %pK",
2551 i, 2551 i,
2552 ireq->ir_loc_addr, 2552 ireq->ir_loc_addr,
2553 ntohs(inet_sk(sk)->inet_sport), 2553 ntohs(inet_sk(sk)->inet_sport),
@@ -2562,11 +2562,10 @@ static void get_openreq4(const struct sock *sk, const struct request_sock *req,
2562 0, /* non standard timer */ 2562 0, /* non standard timer */
2563 0, /* open_requests have no inode */ 2563 0, /* open_requests have no inode */
2564 atomic_read(&sk->sk_refcnt), 2564 atomic_read(&sk->sk_refcnt),
2565 req, 2565 req);
2566 len);
2567} 2566}
2568 2567
2569static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i, int *len) 2568static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i)
2570{ 2569{
2571 int timer_active; 2570 int timer_active;
2572 unsigned long timer_expires; 2571 unsigned long timer_expires;
@@ -2605,7 +2604,7 @@ static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i, int *len)
2605 rx_queue = max_t(int, tp->rcv_nxt - tp->copied_seq, 0); 2604 rx_queue = max_t(int, tp->rcv_nxt - tp->copied_seq, 0);
2606 2605
2607 seq_printf(f, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX " 2606 seq_printf(f, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX "
2608 "%08X %5u %8d %lu %d %pK %lu %lu %u %u %d%n", 2607 "%08X %5u %8d %lu %d %pK %lu %lu %u %u %d",
2609 i, src, srcp, dest, destp, sk->sk_state, 2608 i, src, srcp, dest, destp, sk->sk_state,
2610 tp->write_seq - tp->snd_una, 2609 tp->write_seq - tp->snd_una,
2611 rx_queue, 2610 rx_queue,
@@ -2622,12 +2621,11 @@ static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i, int *len)
2622 tp->snd_cwnd, 2621 tp->snd_cwnd,
2623 sk->sk_state == TCP_LISTEN ? 2622 sk->sk_state == TCP_LISTEN ?
2624 (fastopenq ? fastopenq->max_qlen : 0) : 2623 (fastopenq ? fastopenq->max_qlen : 0) :
2625 (tcp_in_initial_slowstart(tp) ? -1 : tp->snd_ssthresh), 2624 (tcp_in_initial_slowstart(tp) ? -1 : tp->snd_ssthresh));
2626 len);
2627} 2625}
2628 2626
2629static void get_timewait4_sock(const struct inet_timewait_sock *tw, 2627static void get_timewait4_sock(const struct inet_timewait_sock *tw,
2630 struct seq_file *f, int i, int *len) 2628 struct seq_file *f, int i)
2631{ 2629{
2632 __be32 dest, src; 2630 __be32 dest, src;
2633 __u16 destp, srcp; 2631 __u16 destp, srcp;
@@ -2639,10 +2637,10 @@ static void get_timewait4_sock(const struct inet_timewait_sock *tw,
2639 srcp = ntohs(tw->tw_sport); 2637 srcp = ntohs(tw->tw_sport);
2640 2638
2641 seq_printf(f, "%4d: %08X:%04X %08X:%04X" 2639 seq_printf(f, "%4d: %08X:%04X %08X:%04X"
2642 " %02X %08X:%08X %02X:%08lX %08X %5d %8d %d %d %pK%n", 2640 " %02X %08X:%08X %02X:%08lX %08X %5d %8d %d %d %pK",
2643 i, src, srcp, dest, destp, tw->tw_substate, 0, 0, 2641 i, src, srcp, dest, destp, tw->tw_substate, 0, 0,
2644 3, jiffies_delta_to_clock_t(delta), 0, 0, 0, 0, 2642 3, jiffies_delta_to_clock_t(delta), 0, 0, 0, 0,
2645 atomic_read(&tw->tw_refcnt), tw, len); 2643 atomic_read(&tw->tw_refcnt), tw);
2646} 2644}
2647 2645
2648#define TMPSZ 150 2646#define TMPSZ 150
@@ -2651,11 +2649,10 @@ static int tcp4_seq_show(struct seq_file *seq, void *v)
2651{ 2649{
2652 struct tcp_iter_state *st; 2650 struct tcp_iter_state *st;
2653 struct sock *sk = v; 2651 struct sock *sk = v;
2654 int len;
2655 2652
2653 seq_setwidth(seq, TMPSZ - 1);
2656 if (v == SEQ_START_TOKEN) { 2654 if (v == SEQ_START_TOKEN) {
2657 seq_printf(seq, "%-*s\n", TMPSZ - 1, 2655 seq_puts(seq, " sl local_address rem_address st tx_queue "
2658 " sl local_address rem_address st tx_queue "
2659 "rx_queue tr tm->when retrnsmt uid timeout " 2656 "rx_queue tr tm->when retrnsmt uid timeout "
2660 "inode"); 2657 "inode");
2661 goto out; 2658 goto out;
@@ -2666,16 +2663,16 @@ static int tcp4_seq_show(struct seq_file *seq, void *v)
2666 case TCP_SEQ_STATE_LISTENING: 2663 case TCP_SEQ_STATE_LISTENING:
2667 case TCP_SEQ_STATE_ESTABLISHED: 2664 case TCP_SEQ_STATE_ESTABLISHED:
2668 if (sk->sk_state == TCP_TIME_WAIT) 2665 if (sk->sk_state == TCP_TIME_WAIT)
2669 get_timewait4_sock(v, seq, st->num, &len); 2666 get_timewait4_sock(v, seq, st->num);
2670 else 2667 else
2671 get_tcp4_sock(v, seq, st->num, &len); 2668 get_tcp4_sock(v, seq, st->num);
2672 break; 2669 break;
2673 case TCP_SEQ_STATE_OPENREQ: 2670 case TCP_SEQ_STATE_OPENREQ:
2674 get_openreq4(st->syn_wait_sk, v, seq, st->num, st->uid, &len); 2671 get_openreq4(st->syn_wait_sk, v, seq, st->num, st->uid);
2675 break; 2672 break;
2676 } 2673 }
2677 seq_printf(seq, "%*s\n", TMPSZ - 1 - len, "");
2678out: 2674out:
2675 seq_pad(seq, '\n');
2679 return 0; 2676 return 0;
2680} 2677}
2681 2678