]> git.baikalelectronics.ru Git - kernel.git/commit
tracing: make trace_seq operations available for core kernel
authorSteven Rostedt <srostedt@redhat.com>
Sat, 11 Apr 2009 16:59:57 +0000 (12:59 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Tue, 14 Apr 2009 16:57:57 +0000 (12:57 -0400)
commit85b64fa2053d30ff494b1a29566fe6bb2852e041
treefd91bec634dfff191699616523812a3d4ffe6348
parenta6689a1fc22884f71b76947d56eff68b9bbb78da
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>
include/linux/trace_seq.h [new file with mode: 0644]
kernel/trace/trace.h
kernel/trace/trace_output.h