Skip to contentSkip to conversation

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

PATCH In review zhangwei(Jovi) 2 participants 4 messages Jul 15, 2013 – Jul 19, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 2/3 tracing: use trace_seq_puts()/trace_seq_putc() where possible

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

---
 kernel/trace/ring_buffer.c           |   10 +++----
 kernel/trace/trace_events_filter.c   |    4 +--
 kernel/trace/trace_functions_graph.c |   52 +++++++++++++++++-----------------
 kernel/trace/trace_mmiotrace.c       |    8 +++---
 kernel/trace/trace_output.c          |   14 ++++-----
 kernel/trace/trace_syscalls.c        |    2 +-
 6 files changed, 45 insertions(+), 45 deletions(-)
kernel/trace/ring_buffer.c +5 -5
index e444ff8..eef2e56 100644
@@ -36,11 +36,11 @@ int ring_buffer_print_entry_header(struct trace_seq *s)
 {
 	int ret;
 
-	ret = trace_seq_printf(s, "# compressed entry header\n");
-	ret = trace_seq_printf(s, "\ttype_len    :    5 bits\n");
-	ret = trace_seq_printf(s, "\ttime_delta  :   27 bits\n");
-	ret = trace_seq_printf(s, "\tarray       :   32 bits\n");
-	ret = trace_seq_printf(s, "\n");
+	ret = trace_seq_puts(s, "# compressed entry header\n");
+	ret = trace_seq_puts(s, "\ttype_len    :    5 bits\n");
+	ret = trace_seq_puts(s, "\ttime_delta  :   27 bits\n");
+	ret = trace_seq_puts(s, "\tarray       :   32 bits\n");
+	ret = trace_seq_putc(s, '\n');
 	ret = trace_seq_printf(s, "\tpadding     : type == %d\n",
 			       RINGBUF_TYPE_PADDING);
 	ret = trace_seq_printf(s, "\ttime_extend : type == %d\n",
kernel/trace/trace_events_filter.c +2 -2
index e1b653f..8af0489 100644
@@ -640,7 +640,7 @@ void print_event_filter(struct ftrace_event_call *call, struct trace_seq *s)
 	if (filter && filter->filter_string)
 		trace_seq_printf(s, "%s\n", filter->filter_string);
 	else
-		trace_seq_printf(s, "none\n");
+		trace_seq_puts(s, "none\n");
 	mutex_unlock(&event_mutex);
 }
 
@@ -654,7 +654,7 @@ void print_subsystem_event_filter(struct event_subsystem *system,
 	if (filter && filter->filter_string)
 		trace_seq_printf(s, "%s\n", filter->filter_string);
 	else
-		trace_seq_printf(s, DEFAULT_SYS_FILTER_MESSAGE "\n");
+		trace_seq_puts(s, DEFAULT_SYS_FILTER_MESSAGE "\n");
 	mutex_unlock(&event_mutex);
 }
 
kernel/trace/trace_functions_graph.c +26 -26

189 lines not on this page · raw message

kernel/trace/trace_mmiotrace.c +4 -4
index a5e8f48..b3dcfb2 100644
@@ -90,7 +90,7 @@ static int mmio_print_pcidev(struct trace_seq *s, const struct pci_dev *dev)
 	if (drv)
 		ret += trace_seq_printf(s, " %s\n", drv->name);
 	else
-		ret += trace_seq_printf(s, " \n");
+		ret += trace_seq_puts(s, " \n");
 	return ret;
 }
 
@@ -107,7 +107,7 @@ static void mmio_pipe_open(struct trace_iterator *iter)
 	struct header_iter *hiter;
 	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);
 	if (!hiter)
@@ -209,7 +209,7 @@ static enum print_line_t mmio_print_rw(struct trace_iterator *iter)
 			(rw->value >> 0) & 0xff, rw->pc, 0);
 		break;
 	default:
-		ret = trace_seq_printf(s, "rw what?\n");
+		ret = trace_seq_puts(s, "rw what?\n");
 		break;
 	}
 	if (ret)
@@ -245,7 +245,7 @@ static enum print_line_t mmio_print_map(struct trace_iterator *iter)
 			secs, usec_rem, m->map_id, 0UL, 0);
 		break;
 	default:
-		ret = trace_seq_printf(s, "map what?\n");
+		ret = trace_seq_puts(s, "map what?\n");
 		break;
 	}
 	if (ret)
kernel/trace/trace_output.c +7 -7
index bb922d9..34e7cba 100644
@@ -78,7 +78,7 @@ enum print_line_t trace_print_printk_msg_only(struct trace_iterator *iter)
 
 	trace_assign_type(field, entry);
 
-	ret = trace_seq_printf(s, "%s", field->buf);
+	ret = trace_seq_puts(s, field->buf);
 	if (!ret)
 		return TRACE_TYPE_PARTIAL_LINE;
 
@@ -558,14 +558,14 @@ seq_print_userip_objs(const struct userstack_entry *entry, struct trace_seq *s,
 			if (ret)
 				ret = trace_seq_puts(s, "??");
 			if (ret)
-				ret = trace_seq_puts(s, "\n");
+				ret = trace_seq_putc(s, '\n');
 			continue;
 		}
 		if (!ret)
 			break;
 		if (ret)
 			ret = seq_print_user_ip(s, mm, ip, sym_flags);
-		ret = trace_seq_puts(s, "\n");
+		ret = trace_seq_putc(s, '\n');
 	}
 
 	if (mm)
@@ -579,7 +579,7 @@ seq_print_ip_sym(struct trace_seq *s, unsigned long ip, unsigned long sym_flags)
 	int ret;
 
 	if (!ip)
-		return trace_seq_printf(s, "0");
+		return trace_seq_putc(s, '0');
 
 	if (sym_flags & TRACE_ITER_SYM_OFFSET)
 		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,
 		goto partial;
 
 	if ((flags & TRACE_ITER_PRINT_PARENT) && field->parent_ip) {
-		if (!trace_seq_printf(s, " <-"))
+		if (!trace_seq_puts(s, " <-"))
 			goto partial;
 		if (!seq_print_ip_sym(s,
 				      field->parent_ip,
 				      flags))
 			goto partial;
 	}
-	if (!trace_seq_printf(s, "\n"))
+	if (!trace_seq_putc(s, '\n'))
 		goto partial;
 
 	return TRACE_TYPE_HANDLED;
@@ -1210,7 +1210,7 @@ static enum print_line_t trace_stack_print(struct trace_iterator *iter,
 
 		if (!seq_print_ip_sym(s, *p, flags))
 			goto partial;
-		if (!trace_seq_puts(s, "\n"))
+		if (!trace_seq_putc(s, '\n'))
 			goto partial;
 	}
 
kernel/trace/trace_syscalls.c +1 -1
index 8f2ac73..f87a0da 100644
@@ -175,7 +175,7 @@ print_syscall_exit(struct trace_iterator *iter, int flags,
 	entry = syscall_nr_to_meta(syscall);
 
 	if (!entry) {
-		trace_seq_printf(s, "\n");
+		trace_seq_putc(s, '\n');
 		return TRACE_TYPE_HANDLED;
 	}
 
Signature · 1 line
1.7.9.7
maintainer
#1 lore raw
Quoted 15 lines · zhangwei(Jovi)
kernel/trace/trace_functions_graph.c +1 -1
index 8388bc9..3793f90 100644
@@ -446,7 +446,7 @@ print_graph_proc(struct trace_seq *s, pid_t pid)
 
        /* First spaces to align center */
        for (i = 0; i < spaces / 2; i++) {
-               ret = trace_seq_printf(s, " ");
+               ret = trace_seq_putc(s, ' ');
                if (!ret)
                        return TRACE_TYPE_PARTIAL_LINE;
        }

kernel/trace/trace_functions_graph.c print_graph_proc(struct trace_seq *s, pid_t pid) · line 460

Quoted 5 lines
kernel/trace/trace_functions_graph.c +1 -1
@@ -457,7 +457,7 @@ print_graph_proc(struct trace_seq *s, pid_t pid)
 
        /* Last spaces to align center */
        for (i = 0; i < spaces - (spaces / 2); i++) {
-               ret = trace_seq_printf(s, " ");
+               ret = trace_seq_putc(s, " ");

Oops, s/"/'/g

I'll fix it.

-- Steve

Quoted 7 lines
kernel/trace/trace_functions_graph.c +0 -0
                if (!ret)
                        return TRACE_TYPE_PARTIAL_LINE;
        }
@@ -503,7 +503,7 @@ verif_pid(struct trace_seq *s, pid_t pid, int cpu,
 struct fgraph_data *data)
 
 
#2 lore raw
Quoted 17 lines · Steven Rostedt
Quoted 16 lines · zhangwei(Jovi)
kernel/trace/trace_functions_graph.c +1 -1
index 8388bc9..3793f90 100644
@@ -446,7 +446,7 @@ print_graph_proc(struct trace_seq *s, pid_t pid)
 
        /* First spaces to align center */
        for (i = 0; i < spaces / 2; i++) {
-               ret = trace_seq_printf(s, " ");
+               ret = trace_seq_putc(s, ' ');
                if (!ret)
                        return TRACE_TYPE_PARTIAL_LINE;
        }
@@ -457,7 +457,7 @@ print_graph_proc(struct trace_seq *s, pid_t pid)
 
Quoted 9 lines

kernel/trace/trace_functions_graph.c print_graph_proc(struct trace_seq *s, pid_t pid) · line 460

Quoted 4 lines
kernel/trace/trace_functions_graph.c +1 -1
        /* Last spaces to align center */
        for (i = 0; i < spaces - (spaces / 2); i++) {
-               ret = trace_seq_printf(s, " ");
+               ret = trace_seq_putc(s, " ");

Oops, s/"/'/g

I'll fix it.

Sorry for this, I will open my eyes more larger next time.

jovi

maintainer
#3 lore raw
Quoted 25 lines · zhangwei(Jovi)
Quoted 24 lines · Steven Rostedt
Quoted 15 lines · zhangwei(Jovi)
kernel/trace/trace_functions_graph.c +1 -1
index 8388bc9..3793f90 100644
@@ -446,7 +446,7 @@ print_graph_proc(struct trace_seq *s, pid_t pid)
 
        /* First spaces to align center */
        for (i = 0; i < spaces / 2; i++) {
-               ret = trace_seq_printf(s, " ");
+               ret = trace_seq_putc(s, ' ');
                if (!ret)
                        return TRACE_TYPE_PARTIAL_LINE;
        }

kernel/trace/trace_functions_graph.c print_graph_proc(struct trace_seq *s, pid_t pid) · line 460

Quoted 5 lines
kernel/trace/trace_functions_graph.c +1 -1
@@ -457,7 +457,7 @@ print_graph_proc(struct trace_seq *s, pid_t pid)
 
        /* Last spaces to align center */
        for (i = 0; i < spaces - (spaces / 2); i++) {
-               ret = trace_seq_printf(s, " ");
+               ret = trace_seq_putc(s, " ");

Oops, s/"/'/g

Quoted 4 lines
Quoted 2 lines

I'll fix it.

Sorry for this, I will open my eyes more larger next time.

Honest mistake. My tests caught it, as ktest will fail a test if a patch causes a new warning to appear.

-- Steve