netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: Convert SEQ_START_TOKEN/seq_printf to seq_puts
@ 2014-11-04 23:37 Joe Perches
  2014-11-06  3:05 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Joe Perches @ 2014-11-04 23:37 UTC (permalink / raw)
  To: netdev

Using a single fixed string is smaller code size than using
a format and many string arguments.

Reduces overall code size a little.

$ size net/ipv4/igmp.o* net/ipv6/mcast.o* net/ipv6/ip6_flowlabel.o*
   text	   data	    bss	    dec	    hex	filename
  34269	   7012	  14824	  56105	   db29	net/ipv4/igmp.o.new
  34315	   7012	  14824	  56151	   db57	net/ipv4/igmp.o.old
  30078	   7869	  13200	  51147	   c7cb	net/ipv6/mcast.o.new
  30105	   7869	  13200	  51174	   c7e6	net/ipv6/mcast.o.old
  11434	   3748	   8580	  23762	   5cd2	net/ipv6/ip6_flowlabel.o.new
  11491	   3748	   8580	  23819	   5d0b	net/ipv6/ip6_flowlabel.o.old

Signed-off-by: Joe Perches <joe@perches.com>
---

Done by using printf with these formats and args

 net/ipv4/igmp.c          | 6 +-----
 net/ipv6/ip6_flowlabel.c | 3 +--
 net/ipv6/mcast.c         | 6 +-----
 3 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 3f80513..1e4adae 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -2687,11 +2687,7 @@ static int igmp_mcf_seq_show(struct seq_file *seq, void *v)
 	struct igmp_mcf_iter_state *state = igmp_mcf_seq_private(seq);
 
 	if (v == SEQ_START_TOKEN) {
-		seq_printf(seq,
-			   "%3s %6s "
-			   "%10s %10s %6s %6s\n", "Idx",
-			   "Device", "MCA",
-			   "SRC", "INC", "EXC");
+		seq_puts(seq, "Idx Device        MCA        SRC    INC    EXC\n");
 	} else {
 		seq_printf(seq,
 			   "%3d %6.6s 0x%08x "
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index c143437..7221021 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -770,8 +770,7 @@ static int ip6fl_seq_show(struct seq_file *seq, void *v)
 {
 	struct ip6fl_iter_state *state = ip6fl_seq_private(seq);
 	if (v == SEQ_START_TOKEN) {
-		seq_printf(seq, "%-5s %-1s %-6s %-6s %-6s %-8s %-32s %s\n",
-			   "Label", "S", "Owner", "Users", "Linger", "Expires", "Dst", "Opt");
+		seq_puts(seq, "Label S Owner  Users  Linger Expires  Dst                              Opt\n");
 	} else {
 		struct ip6_flowlabel *fl = v;
 		seq_printf(seq,
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 9648de2..e04f184 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -2823,11 +2823,7 @@ static int igmp6_mcf_seq_show(struct seq_file *seq, void *v)
 	struct igmp6_mcf_iter_state *state = igmp6_mcf_seq_private(seq);
 
 	if (v == SEQ_START_TOKEN) {
-		seq_printf(seq,
-			   "%3s %6s "
-			   "%32s %32s %6s %6s\n", "Idx",
-			   "Device", "Multicast Address",
-			   "Source Address", "INC", "EXC");
+		seq_puts(seq, "Idx Device                Multicast Address                   Source Address    INC    EXC\n");
 	} else {
 		seq_printf(seq,
 			   "%3d %6.6s %pi6 %pi6 %6lu %6lu\n",

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] net: Convert SEQ_START_TOKEN/seq_printf to seq_puts
  2014-11-04 23:37 [PATCH net-next] net: Convert SEQ_START_TOKEN/seq_printf to seq_puts Joe Perches
@ 2014-11-06  3:05 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-11-06  3:05 UTC (permalink / raw)
  To: joe; +Cc: netdev

From: Joe Perches <joe@perches.com>
Date: Tue, 04 Nov 2014 15:37:03 -0800

> Using a single fixed string is smaller code size than using
> a format and many string arguments.
> 
> Reduces overall code size a little.
> 
> $ size net/ipv4/igmp.o* net/ipv6/mcast.o* net/ipv6/ip6_flowlabel.o*
>    text	   data	    bss	    dec	    hex	filename
>   34269	   7012	  14824	  56105	   db29	net/ipv4/igmp.o.new
>   34315	   7012	  14824	  56151	   db57	net/ipv4/igmp.o.old
>   30078	   7869	  13200	  51147	   c7cb	net/ipv6/mcast.o.new
>   30105	   7869	  13200	  51174	   c7e6	net/ipv6/mcast.o.old
>   11434	   3748	   8580	  23762	   5cd2	net/ipv6/ip6_flowlabel.o.new
>   11491	   3748	   8580	  23819	   5d0b	net/ipv6/ip6_flowlabel.o.old
> 
> Signed-off-by: Joe Perches <joe@perches.com>

Ok, I'm fine with this, applied.

Thanks Joe.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-11-06  3:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-04 23:37 [PATCH net-next] net: Convert SEQ_START_TOKEN/seq_printf to seq_puts Joe Perches
2014-11-06  3:05 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).