aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-09-03 19:11:07 -0400
committerSteven Rostedt <rostedt@goodmis.org>2009-09-04 19:13:53 -0400
commit659372d3e42a3e17a2e042d38a8bcdb94bfbe797 (patch)
tree4c6195eb5e96569f902695f33babbea37e00bd41 /kernel/trace
parente77405ad80f53966524b5c31244e13fbbbecbd84 (diff)
tracing: add trace_array_printk for internal tracers to use
This patch adds a trace_array_printk to allow a tracer to use the trace_printk on its own trace array. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/trace.c24
-rw-r--r--kernel/trace/trace.h5
2 files changed, 27 insertions, 2 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 0c61836e30e7..ef08328eb28d 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1201,7 +1201,23 @@ out:
1201} 1201}
1202EXPORT_SYMBOL_GPL(trace_vbprintk); 1202EXPORT_SYMBOL_GPL(trace_vbprintk);
1203 1203
1204int trace_vprintk(unsigned long ip, const char *fmt, va_list args) 1204int trace_array_printk(struct trace_array *tr,
1205 unsigned long ip, const char *fmt, ...)
1206{
1207 int ret;
1208 va_list ap;
1209
1210 if (!(trace_flags & TRACE_ITER_PRINTK))
1211 return 0;
1212
1213 va_start(ap, fmt);
1214 ret = trace_array_vprintk(tr, ip, fmt, ap);
1215 va_end(ap);
1216 return ret;
1217}
1218
1219int trace_array_vprintk(struct trace_array *tr,
1220 unsigned long ip, const char *fmt, va_list args)
1205{ 1221{
1206 static raw_spinlock_t trace_buf_lock = __RAW_SPIN_LOCK_UNLOCKED; 1222 static raw_spinlock_t trace_buf_lock = __RAW_SPIN_LOCK_UNLOCKED;
1207 static char trace_buf[TRACE_BUF_SIZE]; 1223 static char trace_buf[TRACE_BUF_SIZE];
@@ -1209,7 +1225,6 @@ int trace_vprintk(unsigned long ip, const char *fmt, va_list args)
1209 struct ftrace_event_call *call = &event_print; 1225 struct ftrace_event_call *call = &event_print;
1210 struct ring_buffer_event *event; 1226 struct ring_buffer_event *event;
1211 struct ring_buffer *buffer; 1227 struct ring_buffer *buffer;
1212 struct trace_array *tr = &global_trace;
1213 struct trace_array_cpu *data; 1228 struct trace_array_cpu *data;
1214 int cpu, len = 0, size, pc; 1229 int cpu, len = 0, size, pc;
1215 struct print_entry *entry; 1230 struct print_entry *entry;
@@ -1260,6 +1275,11 @@ int trace_vprintk(unsigned long ip, const char *fmt, va_list args)
1260 1275
1261 return len; 1276 return len;
1262} 1277}
1278
1279int trace_vprintk(unsigned long ip, const char *fmt, va_list args)
1280{
1281 return trace_array_printk(&global_trace, ip, fmt, args);
1282}
1263EXPORT_SYMBOL_GPL(trace_vprintk); 1283EXPORT_SYMBOL_GPL(trace_vprintk);
1264 1284
1265enum trace_file_type { 1285enum trace_file_type {
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 4d30414fe19a..fa1dccb579d5 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -566,6 +566,11 @@ extern int
566trace_vbprintk(unsigned long ip, const char *fmt, va_list args); 566trace_vbprintk(unsigned long ip, const char *fmt, va_list args);
567extern int 567extern int
568trace_vprintk(unsigned long ip, const char *fmt, va_list args); 568trace_vprintk(unsigned long ip, const char *fmt, va_list args);
569extern int
570trace_array_vprintk(struct trace_array *tr,
571 unsigned long ip, const char *fmt, va_list args);
572int trace_array_printk(struct trace_array *tr,
573 unsigned long ip, const char *fmt, ...);
569 574
570extern unsigned long trace_flags; 575extern unsigned long trace_flags;
571 576