diff options
author | Namhyung Kim <namhyung@kernel.org> | 2014-01-14 20:45:28 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-01-15 13:10:40 -0500 |
commit | 8d0c2224ca6e04ba51c403805e7e1e2ca536520b (patch) | |
tree | 18eb4f1e284dd5dddc94f67533d7fe658d98802c /tools | |
parent | e825e756f84eab0e68d7d6644c018c3412748406 (diff) |
tools lib traceevent: Make plugin unload function receive pevent
The PEVENT_PLUGIN_UNLOADER function might need some cleanup using pevent
like unregister some handlers. So pass pevent as argument.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Reviewed-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1389750340-15965-6-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/lib/traceevent/event-parse.h | 7 | ||||
-rw-r--r-- | tools/lib/traceevent/event-plugin.c | 4 | ||||
-rw-r--r-- | tools/lib/traceevent/plugin_function.c | 2 | ||||
-rw-r--r-- | tools/perf/util/trace-event.c | 2 |
4 files changed, 8 insertions, 7 deletions
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h index 3c890cb28db7..a3beca56cb35 100644 --- a/tools/lib/traceevent/event-parse.h +++ b/tools/lib/traceevent/event-parse.h | |||
@@ -105,7 +105,7 @@ typedef int (*pevent_event_handler_func)(struct trace_seq *s, | |||
105 | void *context); | 105 | void *context); |
106 | 106 | ||
107 | typedef int (*pevent_plugin_load_func)(struct pevent *pevent); | 107 | typedef int (*pevent_plugin_load_func)(struct pevent *pevent); |
108 | typedef int (*pevent_plugin_unload_func)(void); | 108 | typedef int (*pevent_plugin_unload_func)(struct pevent *pevent); |
109 | 109 | ||
110 | struct plugin_option { | 110 | struct plugin_option { |
111 | struct plugin_option *next; | 111 | struct plugin_option *next; |
@@ -130,7 +130,7 @@ struct plugin_option { | |||
130 | * PEVENT_PLUGIN_UNLOADER: (optional) | 130 | * PEVENT_PLUGIN_UNLOADER: (optional) |
131 | * The function called just before unloading | 131 | * The function called just before unloading |
132 | * | 132 | * |
133 | * int PEVENT_PLUGIN_UNLOADER(void) | 133 | * int PEVENT_PLUGIN_UNLOADER(struct pevent *pevent) |
134 | * | 134 | * |
135 | * PEVENT_PLUGIN_OPTIONS: (optional) | 135 | * PEVENT_PLUGIN_OPTIONS: (optional) |
136 | * Plugin options that can be set before loading | 136 | * Plugin options that can be set before loading |
@@ -411,7 +411,8 @@ enum pevent_errno { | |||
411 | struct plugin_list; | 411 | struct plugin_list; |
412 | 412 | ||
413 | struct plugin_list *traceevent_load_plugins(struct pevent *pevent); | 413 | struct plugin_list *traceevent_load_plugins(struct pevent *pevent); |
414 | void traceevent_unload_plugins(struct plugin_list *plugin_list); | 414 | void traceevent_unload_plugins(struct plugin_list *plugin_list, |
415 | struct pevent *pevent); | ||
415 | 416 | ||
416 | struct cmdline; | 417 | struct cmdline; |
417 | struct cmdline_list; | 418 | struct cmdline_list; |
diff --git a/tools/lib/traceevent/event-plugin.c b/tools/lib/traceevent/event-plugin.c index 125f5676bcb5..0c8bf6780e4d 100644 --- a/tools/lib/traceevent/event-plugin.c +++ b/tools/lib/traceevent/event-plugin.c | |||
@@ -197,7 +197,7 @@ traceevent_load_plugins(struct pevent *pevent) | |||
197 | } | 197 | } |
198 | 198 | ||
199 | void | 199 | void |
200 | traceevent_unload_plugins(struct plugin_list *plugin_list) | 200 | traceevent_unload_plugins(struct plugin_list *plugin_list, struct pevent *pevent) |
201 | { | 201 | { |
202 | pevent_plugin_unload_func func; | 202 | pevent_plugin_unload_func func; |
203 | struct plugin_list *list; | 203 | struct plugin_list *list; |
@@ -207,7 +207,7 @@ traceevent_unload_plugins(struct plugin_list *plugin_list) | |||
207 | plugin_list = list->next; | 207 | plugin_list = list->next; |
208 | func = dlsym(list->handle, PEVENT_PLUGIN_UNLOADER_NAME); | 208 | func = dlsym(list->handle, PEVENT_PLUGIN_UNLOADER_NAME); |
209 | if (func) | 209 | if (func) |
210 | func(); | 210 | func(pevent); |
211 | dlclose(list->handle); | 211 | dlclose(list->handle); |
212 | free(list->name); | 212 | free(list->name); |
213 | free(list); | 213 | free(list); |
diff --git a/tools/lib/traceevent/plugin_function.c b/tools/lib/traceevent/plugin_function.c index aad92ad5e96f..39461485f9a7 100644 --- a/tools/lib/traceevent/plugin_function.c +++ b/tools/lib/traceevent/plugin_function.c | |||
@@ -144,7 +144,7 @@ int PEVENT_PLUGIN_LOADER(struct pevent *pevent) | |||
144 | return 0; | 144 | return 0; |
145 | } | 145 | } |
146 | 146 | ||
147 | void PEVENT_PLUGIN_UNLOADER(void) | 147 | void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent) |
148 | { | 148 | { |
149 | int i, x; | 149 | int i, x; |
150 | 150 | ||
diff --git a/tools/perf/util/trace-event.c b/tools/perf/util/trace-event.c index d9f5f6137ab3..6322d37164c5 100644 --- a/tools/perf/util/trace-event.c +++ b/tools/perf/util/trace-event.c | |||
@@ -34,8 +34,8 @@ int trace_event__init(struct trace_event *t) | |||
34 | 34 | ||
35 | void trace_event__cleanup(struct trace_event *t) | 35 | void trace_event__cleanup(struct trace_event *t) |
36 | { | 36 | { |
37 | traceevent_unload_plugins(t->plugin_list, t->pevent); | ||
37 | pevent_free(t->pevent); | 38 | pevent_free(t->pevent); |
38 | traceevent_unload_plugins(t->plugin_list); | ||
39 | } | 39 | } |
40 | 40 | ||
41 | static struct event_format* | 41 | static struct event_format* |