Commit 146c3442 authored by zhangwei(Jovi)'s avatar zhangwei(Jovi) Committed by Steven Rostedt

tracing: Use trace_seq_puts()/trace_seq_putc() where possible

For string without format specifiers, use trace_seq_puts()
or trace_seq_putc().

Link: http://lkml.kernel.org/r/51E3B3AC.1000605@huawei.comSigned-off-by: default avatarzhangwei(Jovi) <jovi.zhangwei@huawei.com>
[ fixed a trace_seq_putc(s, " ") to trace_seq_putc(s, ' ') ]
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent 991821c8
...@@ -36,11 +36,11 @@ int ring_buffer_print_entry_header(struct trace_seq *s) ...@@ -36,11 +36,11 @@ int ring_buffer_print_entry_header(struct trace_seq *s)
{ {
int ret; int ret;
ret = trace_seq_printf(s, "# compressed entry header\n"); ret = trace_seq_puts(s, "# compressed entry header\n");
ret = trace_seq_printf(s, "\ttype_len : 5 bits\n"); ret = trace_seq_puts(s, "\ttype_len : 5 bits\n");
ret = trace_seq_printf(s, "\ttime_delta : 27 bits\n"); ret = trace_seq_puts(s, "\ttime_delta : 27 bits\n");
ret = trace_seq_printf(s, "\tarray : 32 bits\n"); ret = trace_seq_puts(s, "\tarray : 32 bits\n");
ret = trace_seq_printf(s, "\n"); ret = trace_seq_putc(s, '\n');
ret = trace_seq_printf(s, "\tpadding : type == %d\n", ret = trace_seq_printf(s, "\tpadding : type == %d\n",
RINGBUF_TYPE_PADDING); RINGBUF_TYPE_PADDING);
ret = trace_seq_printf(s, "\ttime_extend : type == %d\n", ret = trace_seq_printf(s, "\ttime_extend : type == %d\n",
......
...@@ -646,7 +646,7 @@ void print_event_filter(struct ftrace_event_call *call, struct trace_seq *s) ...@@ -646,7 +646,7 @@ void print_event_filter(struct ftrace_event_call *call, struct trace_seq *s)
if (filter && filter->filter_string) if (filter && filter->filter_string)
trace_seq_printf(s, "%s\n", filter->filter_string); trace_seq_printf(s, "%s\n", filter->filter_string);
else else
trace_seq_printf(s, "none\n"); trace_seq_puts(s, "none\n");
mutex_unlock(&event_mutex); mutex_unlock(&event_mutex);
} }
...@@ -660,7 +660,7 @@ void print_subsystem_event_filter(struct event_subsystem *system, ...@@ -660,7 +660,7 @@ void print_subsystem_event_filter(struct event_subsystem *system,
if (filter && filter->filter_string) if (filter && filter->filter_string)
trace_seq_printf(s, "%s\n", filter->filter_string); trace_seq_printf(s, "%s\n", filter->filter_string);
else else
trace_seq_printf(s, DEFAULT_SYS_FILTER_MESSAGE "\n"); trace_seq_puts(s, DEFAULT_SYS_FILTER_MESSAGE "\n");
mutex_unlock(&event_mutex); mutex_unlock(&event_mutex);
} }
......
...@@ -446,7 +446,7 @@ print_graph_proc(struct trace_seq *s, pid_t pid) ...@@ -446,7 +446,7 @@ print_graph_proc(struct trace_seq *s, pid_t pid)
/* First spaces to align center */ /* First spaces to align center */
for (i = 0; i < spaces / 2; i++) { for (i = 0; i < spaces / 2; i++) {
ret = trace_seq_printf(s, " "); ret = trace_seq_putc(s, ' ');
if (!ret) if (!ret)
return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_PARTIAL_LINE;
} }
...@@ -457,7 +457,7 @@ print_graph_proc(struct trace_seq *s, pid_t pid) ...@@ -457,7 +457,7 @@ print_graph_proc(struct trace_seq *s, pid_t pid)
/* Last spaces to align center */ /* Last spaces to align center */
for (i = 0; i < spaces - (spaces / 2); i++) { for (i = 0; i < spaces - (spaces / 2); i++) {
ret = trace_seq_printf(s, " "); ret = trace_seq_putc(s, ' ');
if (!ret) if (!ret)
return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_PARTIAL_LINE;
} }
...@@ -503,7 +503,7 @@ verif_pid(struct trace_seq *s, pid_t pid, int cpu, struct fgraph_data *data) ...@@ -503,7 +503,7 @@ verif_pid(struct trace_seq *s, pid_t pid, int cpu, struct fgraph_data *data)
------------------------------------------ ------------------------------------------
*/ */
ret = trace_seq_printf(s, ret = trace_seq_puts(s,
" ------------------------------------------\n"); " ------------------------------------------\n");
if (!ret) if (!ret)
return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_PARTIAL_LINE;
...@@ -516,7 +516,7 @@ verif_pid(struct trace_seq *s, pid_t pid, int cpu, struct fgraph_data *data) ...@@ -516,7 +516,7 @@ verif_pid(struct trace_seq *s, pid_t pid, int cpu, struct fgraph_data *data)
if (ret == TRACE_TYPE_PARTIAL_LINE) if (ret == TRACE_TYPE_PARTIAL_LINE)
return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_PARTIAL_LINE;
ret = trace_seq_printf(s, " => "); ret = trace_seq_puts(s, " => ");
if (!ret) if (!ret)
return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_PARTIAL_LINE;
...@@ -524,7 +524,7 @@ verif_pid(struct trace_seq *s, pid_t pid, int cpu, struct fgraph_data *data) ...@@ -524,7 +524,7 @@ verif_pid(struct trace_seq *s, pid_t pid, int cpu, struct fgraph_data *data)
if (ret == TRACE_TYPE_PARTIAL_LINE) if (ret == TRACE_TYPE_PARTIAL_LINE)
return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_PARTIAL_LINE;
ret = trace_seq_printf(s, ret = trace_seq_puts(s,
"\n ------------------------------------------\n\n"); "\n ------------------------------------------\n\n");
if (!ret) if (!ret)
return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_PARTIAL_LINE;
...@@ -645,7 +645,7 @@ print_graph_irq(struct trace_iterator *iter, unsigned long addr, ...@@ -645,7 +645,7 @@ print_graph_irq(struct trace_iterator *iter, unsigned long addr,
ret = print_graph_proc(s, pid); ret = print_graph_proc(s, pid);
if (ret == TRACE_TYPE_PARTIAL_LINE) if (ret == TRACE_TYPE_PARTIAL_LINE)
return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_PARTIAL_LINE;
ret = trace_seq_printf(s, " | "); ret = trace_seq_puts(s, " | ");
if (!ret) if (!ret)
return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_PARTIAL_LINE;
} }
...@@ -657,9 +657,9 @@ print_graph_irq(struct trace_iterator *iter, unsigned long addr, ...@@ -657,9 +657,9 @@ print_graph_irq(struct trace_iterator *iter, unsigned long addr,
return ret; return ret;
if (type == TRACE_GRAPH_ENT) if (type == TRACE_GRAPH_ENT)
ret = trace_seq_printf(s, "==========>"); ret = trace_seq_puts(s, "==========>");
else else
ret = trace_seq_printf(s, "<=========="); ret = trace_seq_puts(s, "<==========");
if (!ret) if (!ret)
return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_PARTIAL_LINE;
...@@ -668,7 +668,7 @@ print_graph_irq(struct trace_iterator *iter, unsigned long addr, ...@@ -668,7 +668,7 @@ print_graph_irq(struct trace_iterator *iter, unsigned long addr,
if (ret != TRACE_TYPE_HANDLED) if (ret != TRACE_TYPE_HANDLED)
return ret; return ret;
ret = trace_seq_printf(s, "\n"); ret = trace_seq_putc(s, '\n');
if (!ret) if (!ret)
return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_PARTIAL_LINE;
...@@ -705,13 +705,13 @@ trace_print_graph_duration(unsigned long long duration, struct trace_seq *s) ...@@ -705,13 +705,13 @@ trace_print_graph_duration(unsigned long long duration, struct trace_seq *s)
len += strlen(nsecs_str); len += strlen(nsecs_str);
} }
ret = trace_seq_printf(s, " us "); ret = trace_seq_puts(s, " us ");
if (!ret) if (!ret)
return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_PARTIAL_LINE;
/* Print remaining spaces to fit the row's width */ /* Print remaining spaces to fit the row's width */
for (i = len; i < 7; i++) { for (i = len; i < 7; i++) {
ret = trace_seq_printf(s, " "); ret = trace_seq_putc(s, ' ');
if (!ret) if (!ret)
return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_PARTIAL_LINE;
} }
...@@ -731,13 +731,13 @@ print_graph_duration(unsigned long long duration, struct trace_seq *s, ...@@ -731,13 +731,13 @@ print_graph_duration(unsigned long long duration, struct trace_seq *s,
/* No real adata, just filling the column with spaces */ /* No real adata, just filling the column with spaces */
switch (duration) { switch (duration) {
case DURATION_FILL_FULL: case DURATION_FILL_FULL:
ret = trace_seq_printf(s, " | "); ret = trace_seq_puts(s, " | ");
return ret ? TRACE_TYPE_HANDLED : TRACE_TYPE_PARTIAL_LINE; return ret ? TRACE_TYPE_HANDLED : TRACE_TYPE_PARTIAL_LINE;
case DURATION_FILL_START: case DURATION_FILL_START:
ret = trace_seq_printf(s, " "); ret = trace_seq_puts(s, " ");
return ret ? TRACE_TYPE_HANDLED : TRACE_TYPE_PARTIAL_LINE; return ret ? TRACE_TYPE_HANDLED : TRACE_TYPE_PARTIAL_LINE;
case DURATION_FILL_END: case DURATION_FILL_END:
ret = trace_seq_printf(s, " |"); ret = trace_seq_puts(s, " |");
return ret ? TRACE_TYPE_HANDLED : TRACE_TYPE_PARTIAL_LINE; return ret ? TRACE_TYPE_HANDLED : TRACE_TYPE_PARTIAL_LINE;
} }
...@@ -745,10 +745,10 @@ print_graph_duration(unsigned long long duration, struct trace_seq *s, ...@@ -745,10 +745,10 @@ print_graph_duration(unsigned long long duration, struct trace_seq *s,
if (flags & TRACE_GRAPH_PRINT_OVERHEAD) { if (flags & TRACE_GRAPH_PRINT_OVERHEAD) {
/* Duration exceeded 100 msecs */ /* Duration exceeded 100 msecs */
if (duration > 100000ULL) if (duration > 100000ULL)
ret = trace_seq_printf(s, "! "); ret = trace_seq_puts(s, "! ");
/* Duration exceeded 10 msecs */ /* Duration exceeded 10 msecs */
else if (duration > 10000ULL) else if (duration > 10000ULL)
ret = trace_seq_printf(s, "+ "); ret = trace_seq_puts(s, "+ ");
} }
/* /*
...@@ -757,7 +757,7 @@ print_graph_duration(unsigned long long duration, struct trace_seq *s, ...@@ -757,7 +757,7 @@ print_graph_duration(unsigned long long duration, struct trace_seq *s,
* to fill out the space. * to fill out the space.
*/ */
if (ret == -1) if (ret == -1)
ret = trace_seq_printf(s, " "); ret = trace_seq_puts(s, " ");
/* Catching here any failure happenned above */ /* Catching here any failure happenned above */
if (!ret) if (!ret)
...@@ -767,7 +767,7 @@ print_graph_duration(unsigned long long duration, struct trace_seq *s, ...@@ -767,7 +767,7 @@ print_graph_duration(unsigned long long duration, struct trace_seq *s,
if (ret != TRACE_TYPE_HANDLED) if (ret != TRACE_TYPE_HANDLED)
return ret; return ret;
ret = trace_seq_printf(s, "| "); ret = trace_seq_puts(s, "| ");
if (!ret) if (!ret)
return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_PARTIAL_LINE;
...@@ -817,7 +817,7 @@ print_graph_entry_leaf(struct trace_iterator *iter, ...@@ -817,7 +817,7 @@ print_graph_entry_leaf(struct trace_iterator *iter,
/* Function */ /* Function */
for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++) { for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++) {
ret = trace_seq_printf(s, " "); ret = trace_seq_putc(s, ' ');
if (!ret) if (!ret)
return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_PARTIAL_LINE;
} }
...@@ -858,7 +858,7 @@ print_graph_entry_nested(struct trace_iterator *iter, ...@@ -858,7 +858,7 @@ print_graph_entry_nested(struct trace_iterator *iter,
/* Function */ /* Function */
for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++) { for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++) {
ret = trace_seq_printf(s, " "); ret = trace_seq_putc(s, ' ');
if (!ret) if (!ret)
return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_PARTIAL_LINE;
} }
...@@ -917,7 +917,7 @@ print_graph_prologue(struct trace_iterator *iter, struct trace_seq *s, ...@@ -917,7 +917,7 @@ print_graph_prologue(struct trace_iterator *iter, struct trace_seq *s,
if (ret == TRACE_TYPE_PARTIAL_LINE) if (ret == TRACE_TYPE_PARTIAL_LINE)
return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_PARTIAL_LINE;
ret = trace_seq_printf(s, " | "); ret = trace_seq_puts(s, " | ");
if (!ret) if (!ret)
return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_PARTIAL_LINE;
} }
...@@ -1117,7 +1117,7 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s, ...@@ -1117,7 +1117,7 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s,
/* Closing brace */ /* Closing brace */
for (i = 0; i < trace->depth * TRACE_GRAPH_INDENT; i++) { for (i = 0; i < trace->depth * TRACE_GRAPH_INDENT; i++) {
ret = trace_seq_printf(s, " "); ret = trace_seq_putc(s, ' ');
if (!ret) if (!ret)
return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_PARTIAL_LINE;
} }
...@@ -1129,7 +1129,7 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s, ...@@ -1129,7 +1129,7 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s,
* belongs to, write out the function name. * belongs to, write out the function name.
*/ */
if (func_match) { if (func_match) {
ret = trace_seq_printf(s, "}\n"); ret = trace_seq_puts(s, "}\n");
if (!ret) if (!ret)
return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_PARTIAL_LINE;
} else { } else {
...@@ -1179,13 +1179,13 @@ print_graph_comment(struct trace_seq *s, struct trace_entry *ent, ...@@ -1179,13 +1179,13 @@ print_graph_comment(struct trace_seq *s, struct trace_entry *ent,
/* Indentation */ /* Indentation */
if (depth > 0) if (depth > 0)
for (i = 0; i < (depth + 1) * TRACE_GRAPH_INDENT; i++) { for (i = 0; i < (depth + 1) * TRACE_GRAPH_INDENT; i++) {
ret = trace_seq_printf(s, " "); ret = trace_seq_putc(s, ' ');
if (!ret) if (!ret)
return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_PARTIAL_LINE;
} }
/* The comment */ /* The comment */
ret = trace_seq_printf(s, "/* "); ret = trace_seq_puts(s, "/* ");
if (!ret) if (!ret)
return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_PARTIAL_LINE;
...@@ -1216,7 +1216,7 @@ print_graph_comment(struct trace_seq *s, struct trace_entry *ent, ...@@ -1216,7 +1216,7 @@ print_graph_comment(struct trace_seq *s, struct trace_entry *ent,
s->len--; s->len--;
} }
ret = trace_seq_printf(s, " */\n"); ret = trace_seq_puts(s, " */\n");
if (!ret) if (!ret)
return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_PARTIAL_LINE;
......
...@@ -90,7 +90,7 @@ static int mmio_print_pcidev(struct trace_seq *s, const struct pci_dev *dev) ...@@ -90,7 +90,7 @@ static int mmio_print_pcidev(struct trace_seq *s, const struct pci_dev *dev)
if (drv) if (drv)
ret += trace_seq_printf(s, " %s\n", drv->name); ret += trace_seq_printf(s, " %s\n", drv->name);
else else
ret += trace_seq_printf(s, " \n"); ret += trace_seq_puts(s, " \n");
return ret; return ret;
} }
...@@ -107,7 +107,7 @@ static void mmio_pipe_open(struct trace_iterator *iter) ...@@ -107,7 +107,7 @@ static void mmio_pipe_open(struct trace_iterator *iter)
struct header_iter *hiter; struct header_iter *hiter;
struct trace_seq *s = &iter->seq; struct trace_seq *s = &iter->seq;
trace_seq_printf(s, "VERSION 20070824\n"); trace_seq_puts(s, "VERSION 20070824\n");
hiter = kzalloc(sizeof(*hiter), GFP_KERNEL); hiter = kzalloc(sizeof(*hiter), GFP_KERNEL);
if (!hiter) if (!hiter)
...@@ -209,7 +209,7 @@ static enum print_line_t mmio_print_rw(struct trace_iterator *iter) ...@@ -209,7 +209,7 @@ static enum print_line_t mmio_print_rw(struct trace_iterator *iter)
(rw->value >> 0) & 0xff, rw->pc, 0); (rw->value >> 0) & 0xff, rw->pc, 0);
break; break;
default: default:
ret = trace_seq_printf(s, "rw what?\n"); ret = trace_seq_puts(s, "rw what?\n");
break; break;
} }
if (ret) if (ret)
...@@ -245,7 +245,7 @@ static enum print_line_t mmio_print_map(struct trace_iterator *iter) ...@@ -245,7 +245,7 @@ static enum print_line_t mmio_print_map(struct trace_iterator *iter)
secs, usec_rem, m->map_id, 0UL, 0); secs, usec_rem, m->map_id, 0UL, 0);
break; break;
default: default:
ret = trace_seq_printf(s, "map what?\n"); ret = trace_seq_puts(s, "map what?\n");
break; break;
} }
if (ret) if (ret)
......
...@@ -78,7 +78,7 @@ enum print_line_t trace_print_printk_msg_only(struct trace_iterator *iter) ...@@ -78,7 +78,7 @@ enum print_line_t trace_print_printk_msg_only(struct trace_iterator *iter)
trace_assign_type(field, entry); trace_assign_type(field, entry);
ret = trace_seq_printf(s, "%s", field->buf); ret = trace_seq_puts(s, field->buf);
if (!ret) if (!ret)
return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_PARTIAL_LINE;
...@@ -558,14 +558,14 @@ seq_print_userip_objs(const struct userstack_entry *entry, struct trace_seq *s, ...@@ -558,14 +558,14 @@ seq_print_userip_objs(const struct userstack_entry *entry, struct trace_seq *s,
if (ret) if (ret)
ret = trace_seq_puts(s, "??"); ret = trace_seq_puts(s, "??");
if (ret) if (ret)
ret = trace_seq_puts(s, "\n"); ret = trace_seq_putc(s, '\n');
continue; continue;
} }
if (!ret) if (!ret)
break; break;
if (ret) if (ret)
ret = seq_print_user_ip(s, mm, ip, sym_flags); ret = seq_print_user_ip(s, mm, ip, sym_flags);
ret = trace_seq_puts(s, "\n"); ret = trace_seq_putc(s, '\n');
} }
if (mm) if (mm)
...@@ -579,7 +579,7 @@ seq_print_ip_sym(struct trace_seq *s, unsigned long ip, unsigned long sym_flags) ...@@ -579,7 +579,7 @@ seq_print_ip_sym(struct trace_seq *s, unsigned long ip, unsigned long sym_flags)
int ret; int ret;
if (!ip) if (!ip)
return trace_seq_printf(s, "0"); return trace_seq_putc(s, '0');
if (sym_flags & TRACE_ITER_SYM_OFFSET) if (sym_flags & TRACE_ITER_SYM_OFFSET)
ret = seq_print_sym_offset(s, "%s", ip); ret = seq_print_sym_offset(s, "%s", ip);
...@@ -964,14 +964,14 @@ static enum print_line_t trace_fn_trace(struct trace_iterator *iter, int flags, ...@@ -964,14 +964,14 @@ static enum print_line_t trace_fn_trace(struct trace_iterator *iter, int flags,
goto partial; goto partial;
if ((flags & TRACE_ITER_PRINT_PARENT) && field->parent_ip) { if ((flags & TRACE_ITER_PRINT_PARENT) && field->parent_ip) {
if (!trace_seq_printf(s, " <-")) if (!trace_seq_puts(s, " <-"))
goto partial; goto partial;
if (!seq_print_ip_sym(s, if (!seq_print_ip_sym(s,
field->parent_ip, field->parent_ip,
flags)) flags))
goto partial; goto partial;
} }
if (!trace_seq_printf(s, "\n")) if (!trace_seq_putc(s, '\n'))
goto partial; goto partial;
return TRACE_TYPE_HANDLED; return TRACE_TYPE_HANDLED;
...@@ -1210,7 +1210,7 @@ static enum print_line_t trace_stack_print(struct trace_iterator *iter, ...@@ -1210,7 +1210,7 @@ static enum print_line_t trace_stack_print(struct trace_iterator *iter,
if (!seq_print_ip_sym(s, *p, flags)) if (!seq_print_ip_sym(s, *p, flags))
goto partial; goto partial;
if (!trace_seq_puts(s, "\n")) if (!trace_seq_putc(s, '\n'))
goto partial; goto partial;
} }
......
...@@ -175,7 +175,7 @@ print_syscall_exit(struct trace_iterator *iter, int flags, ...@@ -175,7 +175,7 @@ print_syscall_exit(struct trace_iterator *iter, int flags,
entry = syscall_nr_to_meta(syscall); entry = syscall_nr_to_meta(syscall);
if (!entry) { if (!entry) {
trace_seq_printf(s, "\n"); trace_seq_putc(s, '\n');
return TRACE_TYPE_HANDLED; return TRACE_TYPE_HANDLED;
} }
......
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