proc: use seq_puts()/seq_putc() where possible
authorAlexey Dobriyan <adobriyan@gmail.com>
Thu, 13 Jan 2011 01:00:32 +0000 (17:00 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 13 Jan 2011 16:03:16 +0000 (08:03 -0800)
For string without format specifiers, use seq_puts().
For seq_printf("\n"), use seq_putc('\n').

   text    data     bss     dec     hex filename
  61866     488     112   62466    f402 fs/proc/proc.o
  61729     488     112   62329    f379 fs/proc/proc.o
  ----------------------------------------------------
      -139

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/proc/array.c
fs/proc/base.c
fs/proc/devices.c
fs/proc/proc_tty.c
fs/proc/softirqs.c
fs/proc/stat.c

index 842a6564f2ce6c6927a6e1668fcaeda56dc68be6..df2b703b9d0f23de5c39856efef6faec89c0c584 100644 (file)
@@ -95,7 +95,7 @@ static inline void task_name(struct seq_file *m, struct task_struct *p)
 
        get_task_comm(tcomm, p);
 
-       seq_printf(m, "Name:\t");
+       seq_puts(m, "Name:\t");
        end = m->buf + m->size;
        buf = m->buf + m->count;
        name = tcomm;
@@ -122,7 +122,7 @@ static inline void task_name(struct seq_file *m, struct task_struct *p)
                buf++;
        }
        m->count = buf - m->buf;
-       seq_printf(m, "\n");
+       seq_putc(m, '\n');
 }
 
 /*
@@ -208,7 +208,7 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
                seq_printf(m, "%d ", GROUP_AT(group_info, g));
        put_cred(cred);
 
-       seq_printf(m, "\n");
+       seq_putc(m, '\n');
 }
 
 static void render_sigset_t(struct seq_file *m, const char *header,
@@ -216,7 +216,7 @@ static void render_sigset_t(struct seq_file *m, const char *header,
 {
        int i;
 
-       seq_printf(m, "%s", header);
+       seq_puts(m, header);
 
        i = _NSIG;
        do {
@@ -230,7 +230,7 @@ static void render_sigset_t(struct seq_file *m, const char *header,
                seq_printf(m, "%x", x);
        } while (i >= 4);
 
-       seq_printf(m, "\n");
+       seq_putc(m, '\n');
 }
 
 static void collect_sigign_sigcatch(struct task_struct *p, sigset_t *ign,
@@ -291,12 +291,12 @@ static void render_cap_t(struct seq_file *m, const char *header,
 {
        unsigned __capi;
 
-       seq_printf(m, "%s", header);
+       seq_puts(m, header);
        CAP_FOR_EACH_U32(__capi) {
                seq_printf(m, "%08x",
                           a->cap[(_KERNEL_CAPABILITY_U32S-1) - __capi]);
        }
-       seq_printf(m, "\n");
+       seq_putc(m, '\n');
 }
 
 static inline void task_cap(struct seq_file *m, struct task_struct *p)
@@ -329,12 +329,12 @@ static inline void task_context_switch_counts(struct seq_file *m,
 
 static void task_cpus_allowed(struct seq_file *m, struct task_struct *task)
 {
-       seq_printf(m, "Cpus_allowed:\t");
+       seq_puts(m, "Cpus_allowed:\t");
        seq_cpumask(m, &task->cpus_allowed);
-       seq_printf(m, "\n");
-       seq_printf(m, "Cpus_allowed_list:\t");
+       seq_putc(m, '\n');
+       seq_puts(m, "Cpus_allowed_list:\t");
        seq_cpumask_list(m, &task->cpus_allowed);
-       seq_printf(m, "\n");
+       seq_putc(m, '\n');
 }
 
 int proc_pid_status(struct seq_file *m, struct pid_namespace *ns,
index 336b79803e82a105c012da8d16be28212cd0c4ed..bf6ba967cffb21d94454b97e907e543e1453b057 100644 (file)
@@ -386,7 +386,7 @@ static int lstats_show_proc(struct seq_file *m, void *v)
                                        break;
                                seq_printf(m, " %ps", (void *)bt);
                        }
-                       seq_printf(m, "\n");
+                       seq_putc(m, '\n');
                }
 
        }
index 59ee7da959c93707062fc700fd1e82d7d703ec23..b14347167c35a49ea2e55a219bc4f298ea156458 100644 (file)
@@ -9,14 +9,14 @@ static int devinfo_show(struct seq_file *f, void *v)
 
        if (i < CHRDEV_MAJOR_HASH_SIZE) {
                if (i == 0)
-                       seq_printf(f, "Character devices:\n");
+                       seq_puts(f, "Character devices:\n");
                chrdev_show(f, i);
        }
 #ifdef CONFIG_BLOCK
        else {
                i -= CHRDEV_MAJOR_HASH_SIZE;
                if (i == 0)
-                       seq_printf(f, "\nBlock devices:\n");
+                       seq_puts(f, "\nBlock devices:\n");
                blkdev_show(f, i);
        }
 #endif
index 83adcc86943742ef58bf22b4fb16a986a560450e..cb761f01030028db501075eeadd71da259697b15 100644 (file)
@@ -36,27 +36,27 @@ static void show_tty_range(struct seq_file *m, struct tty_driver *p,
        }
        switch (p->type) {
        case TTY_DRIVER_TYPE_SYSTEM:
-               seq_printf(m, "system");
+               seq_puts(m, "system");
                if (p->subtype == SYSTEM_TYPE_TTY)
-                       seq_printf(m, ":/dev/tty");
+                       seq_puts(m, ":/dev/tty");
                else if (p->subtype == SYSTEM_TYPE_SYSCONS)
-                       seq_printf(m, ":console");
+                       seq_puts(m, ":console");
                else if (p->subtype == SYSTEM_TYPE_CONSOLE)
-                       seq_printf(m, ":vtmaster");
+                       seq_puts(m, ":vtmaster");
                break;
        case TTY_DRIVER_TYPE_CONSOLE:
-               seq_printf(m, "console");
+               seq_puts(m, "console");
                break;
        case TTY_DRIVER_TYPE_SERIAL:
-               seq_printf(m, "serial");
+               seq_puts(m, "serial");
                break;
        case TTY_DRIVER_TYPE_PTY:
                if (p->subtype == PTY_TYPE_MASTER)
-                       seq_printf(m, "pty:master");
+                       seq_puts(m, "pty:master");
                else if (p->subtype == PTY_TYPE_SLAVE)
-                       seq_printf(m, "pty:slave");
+                       seq_puts(m, "pty:slave");
                else
-                       seq_printf(m, "pty");
+                       seq_puts(m, "pty");
                break;
        default:
                seq_printf(m, "type:%d.%d", p->type, p->subtype);
@@ -74,19 +74,19 @@ static int show_tty_driver(struct seq_file *m, void *v)
                /* pseudo-drivers first */
                seq_printf(m, "%-20s /dev/%-8s ", "/dev/tty", "tty");
                seq_printf(m, "%3d %7d ", TTYAUX_MAJOR, 0);
-               seq_printf(m, "system:/dev/tty\n");
+               seq_puts(m, "system:/dev/tty\n");
                seq_printf(m, "%-20s /dev/%-8s ", "/dev/console", "console");
                seq_printf(m, "%3d %7d ", TTYAUX_MAJOR, 1);
-               seq_printf(m, "system:console\n");
+               seq_puts(m, "system:console\n");
 #ifdef CONFIG_UNIX98_PTYS
                seq_printf(m, "%-20s /dev/%-8s ", "/dev/ptmx", "ptmx");
                seq_printf(m, "%3d %7d ", TTYAUX_MAJOR, 2);
-               seq_printf(m, "system\n");
+               seq_puts(m, "system\n");
 #endif
 #ifdef CONFIG_VT
                seq_printf(m, "%-20s /dev/%-8s ", "/dev/vc/0", "vc/0");
                seq_printf(m, "%3d %7d ", TTY_MAJOR, 0);
-               seq_printf(m, "system:vtmaster\n");
+               seq_puts(m, "system:vtmaster\n");
 #endif
        }
 
index 37994737c9834fe83d541b68d80b4925010e3bd0..62604be9f58d61ef6b9c4cf5b8f787e214d8dc78 100644 (file)
@@ -10,16 +10,16 @@ static int show_softirqs(struct seq_file *p, void *v)
 {
        int i, j;
 
-       seq_printf(p, "                    ");
+       seq_puts(p, "                    ");
        for_each_possible_cpu(i)
                seq_printf(p, "CPU%-8d", i);
-       seq_printf(p, "\n");
+       seq_putc(p, '\n');
 
        for (i = 0; i < NR_SOFTIRQS; i++) {
                seq_printf(p, "%12s:", softirq_to_name[i]);
                for_each_possible_cpu(j)
                        seq_printf(p, " %10u", kstat_softirqs_cpu(i, j));
-               seq_printf(p, "\n");
+               seq_putc(p, '\n');
        }
        return 0;
 }
index e15a19c93baefa87ed4fd7ebbe57a532a5c80270..1cffa2b8a2fcd5dc9a6b329ce29498ef9e24cab0 100644 (file)
@@ -126,7 +126,7 @@ static int show_stat(struct seq_file *p, void *v)
 
        for (i = 0; i < NR_SOFTIRQS; i++)
                seq_printf(p, " %u", per_softirq_sums[i]);
-       seq_printf(p, "\n");
+       seq_putc(p, '\n');
 
        return 0;
 }