aboutsummaryrefslogtreecommitdiff
path: root/kernel/trace/trace.h
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-04-11 12:59:57 -0400
committerSteven Rostedt <rostedt@goodmis.org>2009-04-14 12:57:57 -0400
commit9504504cbab29ecb694186b1c5b15d3579c43c51 (patch)
treefd91bec634dfff191699616523812a3d4ffe6348 /kernel/trace/trace.h
parenta8d154b009168337494fbf345671bab74d3e4b8b (diff)
tracing: make trace_seq operations available for core kernel
In the process to make TRACE_EVENT macro work for modules, the trace_seq operations must be available for core kernel code. These operations are quite useful and can be used for other implementations. The main idea is that we create a trace_seq handle that acts very much like the seq_file handle. struct trace_seq *s = kmalloc(sizeof(*s, GFP_KERNEL); trace_seq_init(s); trace_seq_printf(s, "some data %d\n", variable); printk("%s", s->buffer); The main use is to allow a top level function call several other functions that may store printf like data into the buffer. Then at the end, the top level function can process all the data with any method it would like to. It could be passed to userspace, output via printk or even use seq_file: trace_seq_to_user(s, ubuf, cnt); seq_puts(m, s->buffer); Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace.h')
-rw-r--r--kernel/trace/trace.h15
1 files changed, 2 insertions, 13 deletions
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index b05b6ac982a..1882846b738 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -12,6 +12,8 @@
#include <linux/kmemtrace.h>
#include <trace/power.h>
+#include <linux/trace_seq.h>
+
enum trace_type {
__TRACE_FIRST_TYPE = 0,
@@ -423,19 +425,6 @@ struct tracer {
struct tracer_stat *stats;
};
-struct trace_seq {
- unsigned char buffer[PAGE_SIZE];
- unsigned int len;
- unsigned int readpos;
-};
-
-static inline void
-trace_seq_init(struct trace_seq *s)
-{
- s->len = 0;
- s->readpos = 0;
-}
-
#define TRACE_PIPE_ALL_CPU -1