diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-04-24 04:02:16 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-04-24 04:02:16 -0400 |
commit | 5e659e4cb0eedacdc1f621a61e400a4611ddef8a (patch) | |
tree | fa3c8743010dd640c48584a6fa8a910d27350c01 /net/ipv4/route.c | |
parent | 3d36696024499aef19dbf24a781e91a24fbbe4af (diff) |
[NET]: Fix heavy stack usage in seq_file output routines.
Plan C: we can follow the Al Viro's proposal about %n like in this patch.
The same applies to udp, fib (the /proc/net/route file), rt_cache and
sctp debug. This is minus ~150-200 bytes for each.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r-- | net/ipv4/route.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 780e9484c825..ce25a13f3430 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -367,10 +367,10 @@ static int rt_cache_seq_show(struct seq_file *seq, void *v) | |||
367 | "HHUptod\tSpecDst"); | 367 | "HHUptod\tSpecDst"); |
368 | else { | 368 | else { |
369 | struct rtable *r = v; | 369 | struct rtable *r = v; |
370 | char temp[256]; | 370 | int len; |
371 | 371 | ||
372 | sprintf(temp, "%s\t%08lX\t%08lX\t%8X\t%d\t%u\t%d\t" | 372 | seq_printf(seq, "%s\t%08lX\t%08lX\t%8X\t%d\t%u\t%d\t" |
373 | "%08lX\t%d\t%u\t%u\t%02X\t%d\t%1d\t%08X", | 373 | "%08lX\t%d\t%u\t%u\t%02X\t%d\t%1d\t%08X%n", |
374 | r->u.dst.dev ? r->u.dst.dev->name : "*", | 374 | r->u.dst.dev ? r->u.dst.dev->name : "*", |
375 | (unsigned long)r->rt_dst, (unsigned long)r->rt_gateway, | 375 | (unsigned long)r->rt_dst, (unsigned long)r->rt_gateway, |
376 | r->rt_flags, atomic_read(&r->u.dst.__refcnt), | 376 | r->rt_flags, atomic_read(&r->u.dst.__refcnt), |
@@ -384,8 +384,9 @@ static int rt_cache_seq_show(struct seq_file *seq, void *v) | |||
384 | r->u.dst.hh ? atomic_read(&r->u.dst.hh->hh_refcnt) : -1, | 384 | r->u.dst.hh ? atomic_read(&r->u.dst.hh->hh_refcnt) : -1, |
385 | r->u.dst.hh ? (r->u.dst.hh->hh_output == | 385 | r->u.dst.hh ? (r->u.dst.hh->hh_output == |
386 | dev_queue_xmit) : 0, | 386 | dev_queue_xmit) : 0, |
387 | r->rt_spec_dst); | 387 | r->rt_spec_dst, &len); |
388 | seq_printf(seq, "%-127s\n", temp); | 388 | |
389 | seq_printf(seq, "%*s\n", 127 - len, ""); | ||
389 | } | 390 | } |
390 | return 0; | 391 | return 0; |
391 | } | 392 | } |