From: Namhyung Kim <namhyung@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>,
Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Ingo Molnar <mingo@kernel.org>,
Namhyung Kim <namhyung.kim@lge.com>,
LKML <linux-kernel@vger.kernel.org>, Jiri Olsa <jolsa@redhat.com>
Subject: [PATCH 02/12] tools lib traceevent: Add pevent_unregister_print_function()
Date: Thu, 16 Jan 2014 11:31:08 +0900 [thread overview]
Message-ID: <1389839478-5887-3-git-send-email-namhyung@kernel.org> (raw)
In-Reply-To: <1389839478-5887-1-git-send-email-namhyung@kernel.org>
When a plugin unloaded it needs to unregister its print handler from
pevent. So add unregister function to do it.
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Reviewed-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/lib/traceevent/event-parse.c | 23 +++++++++++++++++++++++
tools/lib/traceevent/event-parse.h | 2 ++
2 files changed, 25 insertions(+)
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index d1973cb8388b..1587ea392ad6 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -5560,6 +5560,29 @@ int pevent_register_print_function(struct pevent *pevent,
return ret;
}
+/**
+ * pevent_unregister_print_function - unregister a helper function
+ * @pevent: the handle to the pevent
+ * @func: the function to process the helper function
+ * @name: the name of the helper function
+ *
+ * This function removes existing print handler for function @name.
+ *
+ * Returns 0 if the handler was removed successully, -1 otherwise.
+ */
+int pevent_unregister_print_function(struct pevent *pevent,
+ pevent_func_handler func, char *name)
+{
+ struct pevent_function_handler *func_handle;
+
+ func_handle = find_func_handler(pevent, name);
+ if (func_handle && func_handle->func == func) {
+ remove_func_handler(pevent, name);
+ return 0;
+ }
+ return -1;
+}
+
static struct event_format *pevent_search_event(struct pevent *pevent, int id,
const char *sys_name,
const char *event_name)
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
index c48acfbc6230..791c539374c7 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -631,6 +631,8 @@ int pevent_register_print_function(struct pevent *pevent,
pevent_func_handler func,
enum pevent_func_arg_type ret_type,
char *name, ...);
+int pevent_unregister_print_function(struct pevent *pevent,
+ pevent_func_handler func, char *name);
struct format_field *pevent_find_common_field(struct event_format *event, const char *name);
struct format_field *pevent_find_field(struct event_format *event, const char *name);
--
1.7.11.7
next prev parent reply other threads:[~2014-01-16 2:31 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-16 2:31 [PATCHSET 00/12] tools lib traceevent: Plugin unload enhancement (v2) Namhyung Kim
2014-01-16 2:31 ` [PATCH 01/12] tools lib traceevent: Add pevent_unregister_event_handler() Namhyung Kim
2014-01-19 12:22 ` [tip:perf/core] " tip-bot for Namhyung Kim
2014-01-16 2:31 ` Namhyung Kim [this message]
2014-01-19 12:22 ` [tip:perf/core] tools lib traceevent: Add pevent_unregister_print_function() tip-bot for Namhyung Kim
2014-01-16 2:31 ` [PATCH 03/12] tools lib traceevent: Unregister handler when function plugin unloaded Namhyung Kim
2014-01-19 12:22 ` [tip:perf/core] tools lib traceevent: Unregister handler when function plugin is unloaded tip-bot for Namhyung Kim
2014-01-16 2:31 ` [PATCH 04/12] tools lib traceevent: Unregister handler when hrtimer plugin unloaded Namhyung Kim
2014-01-19 12:23 ` [tip:perf/core] tools lib traceevent: Unregister handler when hrtimer plugin is unloaded tip-bot for Namhyung Kim
2014-01-16 2:31 ` [PATCH 05/12] tools lib traceevent: Unregister handler when kmem plugin unloaded Namhyung Kim
2014-01-19 12:23 ` [tip:perf/core] tools lib traceevent: Unregister handler when kmem plugin is unloaded tip-bot for Namhyung Kim
2014-01-16 2:31 ` [PATCH 06/12] tools lib traceevent: Unregister handler when kvm plugin unloaded Namhyung Kim
2014-01-19 12:23 ` [tip:perf/core] tools lib traceevent: Unregister handler when kvm plugin is unloaded tip-bot for Namhyung Kim
2014-01-16 2:31 ` [PATCH 07/12] tools lib traceevent: Unregister handler when sched_switch plugin unloaded Namhyung Kim
2014-01-19 12:23 ` [tip:perf/core] tools lib traceevent: Unregister handler when sched_switch plugin is unloaded tip-bot for Namhyung Kim
2014-01-16 2:31 ` [PATCH 08/12] tools lib traceevent: Unregister handler when mac80211 plugin unloaded Namhyung Kim
2014-01-19 12:23 ` [tip:perf/core] tools lib traceevent: Unregister handler when mac80211 plugin is unloaded tip-bot for Namhyung Kim
2014-01-16 2:31 ` [PATCH 09/12] tools lib traceevent: Unregister handler when cfg80211 plugin unloaded Namhyung Kim
2014-01-16 3:23 ` Steven Rostedt
2014-01-19 12:23 ` [tip:perf/core] tools lib traceevent: Unregister handler when cfg80211 plugin is unloaded tip-bot for Namhyung Kim
2014-01-16 2:31 ` [PATCH 10/12] tools lib traceevent: Unregister handler when jbd2 plugin unloaded Namhyung Kim
2014-01-19 12:24 ` [tip:perf/core] tools lib traceevent: Unregister handler when jbd2 plugin is is unloaded tip-bot for Namhyung Kim
2014-01-16 2:31 ` [PATCH 11/12] tools lib traceevent: Unregister handler when scsi plugin unloaded Namhyung Kim
2014-01-19 12:24 ` [tip:perf/core] tools lib traceevent: Unregister handler when scsi plugin is unloaded tip-bot for Namhyung Kim
2014-01-16 2:31 ` [PATCH 12/12] tools lib traceevent: Unregister handler when xen plugin unloaded Namhyung Kim
2014-01-19 12:24 ` [tip:perf/core] tools lib traceevent: Unregister handler when xen plugin is unloaded tip-bot for Namhyung Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1389839478-5887-3-git-send-email-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--cc=fweisbec@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung.kim@lge.com \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®