aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-11-24 21:56:08 -0500
committerSteven Rostedt <rostedt@goodmis.org>2009-11-24 21:56:08 -0500
commitc1f23506e61a6f1045a1a3fc3aac6fca39309047 (patch)
tree2edfb76db166eacb7703ae004f4b7cefae31d1dc
parent9e47d25f3dacb1dcd9e0b18cb411026e8f7b338c (diff)
Add event handle to plugin print callback
The plugin should have the ability to look at information in the event (like offsets and sizes of fields). To do this we need to pass the event handle to the callback. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--parse-events.c2
-rw-r--r--parse-events.h7
-rw-r--r--test_plugin.c6
3 files changed, 11 insertions, 4 deletions
diff --git a/parse-events.c b/parse-events.c
index 54a6ab0..1527c2b 100644
--- a/parse-events.c
+++ b/parse-events.c
@@ -3253,7 +3253,7 @@ void pevent_print_event(struct trace_seq *s,
3253 trace_seq_printf(s, " %5lu.%06lu: %s: ", secs, usecs, event->name); 3253 trace_seq_printf(s, " %5lu.%06lu: %s: ", secs, usecs, event->name);
3254 3254
3255 if (event->handler) 3255 if (event->handler)
3256 event->handler(s, data, size); 3256 event->handler(s, data, size, event);
3257 else 3257 else
3258 pretty_print(s, data, size, event); 3258 pretty_print(s, data, size, event);
3259 trace_seq_putc(s, '\n'); 3259 trace_seq_putc(s, '\n');
diff --git a/parse-events.h b/parse-events.h
index b4e7fdf..a29c295 100644
--- a/parse-events.h
+++ b/parse-events.h
@@ -45,8 +45,13 @@ extern int trace_seq_do_printf(struct trace_seq *s);
45 45
46/* ----------------------- pevent ----------------------- */ 46/* ----------------------- pevent ----------------------- */
47 47
48struct event;
49
50typedef int (*pevent_event_handler_func)(struct trace_seq *s,
51 void *data, int size,
52 struct event *event);
53
48typedef int (*pevent_plugin_load_func)(void); 54typedef int (*pevent_plugin_load_func)(void);
49typedef int (*pevent_event_handler_func)(struct trace_seq *s, void *data, int size);
50 55
51#define PEVENT_PLUGIN_LOADER pevent_plugin_loader 56#define PEVENT_PLUGIN_LOADER pevent_plugin_loader
52#define MAKE_STR(x) #x 57#define MAKE_STR(x) #x
diff --git a/test_plugin.c b/test_plugin.c
index c7f3b8b..3a23556 100644
--- a/test_plugin.c
+++ b/test_plugin.c
@@ -4,7 +4,8 @@
4 4
5#include "parse-events.h" 5#include "parse-events.h"
6 6
7static int timer_expire_handler(struct trace_seq *s, void *data, int size) 7static int timer_expire_handler(struct trace_seq *s, void *data, int size,
8 struct event *event)
8{ 9{
9 void *hrtimer = data + 16; 10 void *hrtimer = data + 16;
10 long long now = *(long long *)(data + 24); 11 long long now = *(long long *)(data + 24);
@@ -15,7 +16,8 @@ static int timer_expire_handler(struct trace_seq *s, void *data, int size)
15 return ret; 16 return ret;
16} 17}
17 18
18static int timer_start_handler(struct trace_seq *s, void *data, int size) 19static int timer_start_handler(struct trace_seq *s, void *data, int size,
20 struct event *event)
19{ 21{
20 void *hrtimer = data + 16; 22 void *hrtimer = data + 16;
21 void *function = data + 24; 23 void *function = data + 24;