Commit 9d6de12f authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by Linus Torvalds

proc: use seq_puts()/seq_putc() where possible

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: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a2ade7b6
...@@ -95,7 +95,7 @@ static inline void task_name(struct seq_file *m, struct task_struct *p) ...@@ -95,7 +95,7 @@ static inline void task_name(struct seq_file *m, struct task_struct *p)
get_task_comm(tcomm, p); get_task_comm(tcomm, p);
seq_printf(m, "Name:\t"); seq_puts(m, "Name:\t");
end = m->buf + m->size; end = m->buf + m->size;
buf = m->buf + m->count; buf = m->buf + m->count;
name = tcomm; name = tcomm;
...@@ -122,7 +122,7 @@ static inline void task_name(struct seq_file *m, struct task_struct *p) ...@@ -122,7 +122,7 @@ static inline void task_name(struct seq_file *m, struct task_struct *p)
buf++; buf++;
} }
m->count = buf - m->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, ...@@ -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)); seq_printf(m, "%d ", GROUP_AT(group_info, g));
put_cred(cred); put_cred(cred);
seq_printf(m, "\n"); seq_putc(m, '\n');
} }
static void render_sigset_t(struct seq_file *m, const char *header, 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, ...@@ -216,7 +216,7 @@ static void render_sigset_t(struct seq_file *m, const char *header,
{ {
int i; int i;
seq_printf(m, "%s", header); seq_puts(m, header);
i = _NSIG; i = _NSIG;
do { do {
...@@ -230,7 +230,7 @@ static void render_sigset_t(struct seq_file *m, const char *header, ...@@ -230,7 +230,7 @@ static void render_sigset_t(struct seq_file *m, const char *header,
seq_printf(m, "%x", x); seq_printf(m, "%x", x);
} while (i >= 4); } while (i >= 4);
seq_printf(m, "\n"); seq_putc(m, '\n');
} }
static void collect_sigign_sigcatch(struct task_struct *p, sigset_t *ign, 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, ...@@ -291,12 +291,12 @@ static void render_cap_t(struct seq_file *m, const char *header,
{ {
unsigned __capi; unsigned __capi;
seq_printf(m, "%s", header); seq_puts(m, header);
CAP_FOR_EACH_U32(__capi) { CAP_FOR_EACH_U32(__capi) {
seq_printf(m, "%08x", seq_printf(m, "%08x",
a->cap[(_KERNEL_CAPABILITY_U32S-1) - __capi]); 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) 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, ...@@ -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) 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_cpumask(m, &task->cpus_allowed);
seq_printf(m, "\n"); seq_putc(m, '\n');
seq_printf(m, "Cpus_allowed_list:\t"); seq_puts(m, "Cpus_allowed_list:\t");
seq_cpumask_list(m, &task->cpus_allowed); 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, int proc_pid_status(struct seq_file *m, struct pid_namespace *ns,
......
...@@ -386,7 +386,7 @@ static int lstats_show_proc(struct seq_file *m, void *v) ...@@ -386,7 +386,7 @@ static int lstats_show_proc(struct seq_file *m, void *v)
break; break;
seq_printf(m, " %ps", (void *)bt); seq_printf(m, " %ps", (void *)bt);
} }
seq_printf(m, "\n"); seq_putc(m, '\n');
} }
} }
......
...@@ -9,14 +9,14 @@ static int devinfo_show(struct seq_file *f, void *v) ...@@ -9,14 +9,14 @@ static int devinfo_show(struct seq_file *f, void *v)
if (i < CHRDEV_MAJOR_HASH_SIZE) { if (i < CHRDEV_MAJOR_HASH_SIZE) {
if (i == 0) if (i == 0)
seq_printf(f, "Character devices:\n"); seq_puts(f, "Character devices:\n");
chrdev_show(f, i); chrdev_show(f, i);
} }
#ifdef CONFIG_BLOCK #ifdef CONFIG_BLOCK
else { else {
i -= CHRDEV_MAJOR_HASH_SIZE; i -= CHRDEV_MAJOR_HASH_SIZE;
if (i == 0) if (i == 0)
seq_printf(f, "\nBlock devices:\n"); seq_puts(f, "\nBlock devices:\n");
blkdev_show(f, i); blkdev_show(f, i);
} }
#endif #endif
......
...@@ -36,27 +36,27 @@ static void show_tty_range(struct seq_file *m, struct tty_driver *p, ...@@ -36,27 +36,27 @@ static void show_tty_range(struct seq_file *m, struct tty_driver *p,
} }
switch (p->type) { switch (p->type) {
case TTY_DRIVER_TYPE_SYSTEM: case TTY_DRIVER_TYPE_SYSTEM:
seq_printf(m, "system"); seq_puts(m, "system");
if (p->subtype == SYSTEM_TYPE_TTY) if (p->subtype == SYSTEM_TYPE_TTY)
seq_printf(m, ":/dev/tty"); seq_puts(m, ":/dev/tty");
else if (p->subtype == SYSTEM_TYPE_SYSCONS) else if (p->subtype == SYSTEM_TYPE_SYSCONS)
seq_printf(m, ":console"); seq_puts(m, ":console");
else if (p->subtype == SYSTEM_TYPE_CONSOLE) else if (p->subtype == SYSTEM_TYPE_CONSOLE)
seq_printf(m, ":vtmaster"); seq_puts(m, ":vtmaster");
break; break;
case TTY_DRIVER_TYPE_CONSOLE: case TTY_DRIVER_TYPE_CONSOLE:
seq_printf(m, "console"); seq_puts(m, "console");
break; break;
case TTY_DRIVER_TYPE_SERIAL: case TTY_DRIVER_TYPE_SERIAL:
seq_printf(m, "serial"); seq_puts(m, "serial");
break; break;
case TTY_DRIVER_TYPE_PTY: case TTY_DRIVER_TYPE_PTY:
if (p->subtype == PTY_TYPE_MASTER) if (p->subtype == PTY_TYPE_MASTER)
seq_printf(m, "pty:master"); seq_puts(m, "pty:master");
else if (p->subtype == PTY_TYPE_SLAVE) else if (p->subtype == PTY_TYPE_SLAVE)
seq_printf(m, "pty:slave"); seq_puts(m, "pty:slave");
else else
seq_printf(m, "pty"); seq_puts(m, "pty");
break; break;
default: default:
seq_printf(m, "type:%d.%d", p->type, p->subtype); 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) ...@@ -74,19 +74,19 @@ static int show_tty_driver(struct seq_file *m, void *v)
/* pseudo-drivers first */ /* pseudo-drivers first */
seq_printf(m, "%-20s /dev/%-8s ", "/dev/tty", "tty"); seq_printf(m, "%-20s /dev/%-8s ", "/dev/tty", "tty");
seq_printf(m, "%3d %7d ", TTYAUX_MAJOR, 0); 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, "%-20s /dev/%-8s ", "/dev/console", "console");
seq_printf(m, "%3d %7d ", TTYAUX_MAJOR, 1); seq_printf(m, "%3d %7d ", TTYAUX_MAJOR, 1);
seq_printf(m, "system:console\n"); seq_puts(m, "system:console\n");
#ifdef CONFIG_UNIX98_PTYS #ifdef CONFIG_UNIX98_PTYS
seq_printf(m, "%-20s /dev/%-8s ", "/dev/ptmx", "ptmx"); seq_printf(m, "%-20s /dev/%-8s ", "/dev/ptmx", "ptmx");
seq_printf(m, "%3d %7d ", TTYAUX_MAJOR, 2); seq_printf(m, "%3d %7d ", TTYAUX_MAJOR, 2);
seq_printf(m, "system\n"); seq_puts(m, "system\n");
#endif #endif
#ifdef CONFIG_VT #ifdef CONFIG_VT
seq_printf(m, "%-20s /dev/%-8s ", "/dev/vc/0", "vc/0"); seq_printf(m, "%-20s /dev/%-8s ", "/dev/vc/0", "vc/0");
seq_printf(m, "%3d %7d ", TTY_MAJOR, 0); seq_printf(m, "%3d %7d ", TTY_MAJOR, 0);
seq_printf(m, "system:vtmaster\n"); seq_puts(m, "system:vtmaster\n");
#endif #endif
} }
......
...@@ -10,16 +10,16 @@ static int show_softirqs(struct seq_file *p, void *v) ...@@ -10,16 +10,16 @@ static int show_softirqs(struct seq_file *p, void *v)
{ {
int i, j; int i, j;
seq_printf(p, " "); seq_puts(p, " ");
for_each_possible_cpu(i) for_each_possible_cpu(i)
seq_printf(p, "CPU%-8d", i); seq_printf(p, "CPU%-8d", i);
seq_printf(p, "\n"); seq_putc(p, '\n');
for (i = 0; i < NR_SOFTIRQS; i++) { for (i = 0; i < NR_SOFTIRQS; i++) {
seq_printf(p, "%12s:", softirq_to_name[i]); seq_printf(p, "%12s:", softirq_to_name[i]);
for_each_possible_cpu(j) for_each_possible_cpu(j)
seq_printf(p, " %10u", kstat_softirqs_cpu(i, j)); seq_printf(p, " %10u", kstat_softirqs_cpu(i, j));
seq_printf(p, "\n"); seq_putc(p, '\n');
} }
return 0; return 0;
} }
......
...@@ -126,7 +126,7 @@ static int show_stat(struct seq_file *p, void *v) ...@@ -126,7 +126,7 @@ static int show_stat(struct seq_file *p, void *v)
for (i = 0; i < NR_SOFTIRQS; i++) for (i = 0; i < NR_SOFTIRQS; i++)
seq_printf(p, " %u", per_softirq_sums[i]); seq_printf(p, " %u", per_softirq_sums[i]);
seq_printf(p, "\n"); seq_putc(p, '\n');
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment