Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752460AbaAOBs4 (ORCPT ); Tue, 14 Jan 2014 20:48:56 -0500 Received: from LGEMRELSE7Q.lge.com ([156.147.1.151]:53517 "EHLO LGEMRELSE7Q.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751503AbaAOBpo (ORCPT ); Tue, 14 Jan 2014 20:45:44 -0500 X-AuditID: 9c930197-b7b7cae000000e34-5a-52d5e84650d6 From: Namhyung Kim To: Steven Rostedt , Arnaldo Carvalho de Melo Cc: Frederic Weisbecker , Peter Zijlstra , Ingo Molnar , Namhyung Kim , LKML , Jiri Olsa Subject: [PATCH 07/17] tools lib traceevent: Add pevent_unregister_print_function() Date: Wed, 15 Jan 2014 10:45:30 +0900 Message-Id: <1389750340-15965-8-git-send-email-namhyung@kernel.org> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1389750340-15965-1-git-send-email-namhyung@kernel.org> References: <1389750340-15965-1-git-send-email-namhyung@kernel.org> X-Brightmail-Tracker: AAAAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When a plugin unloaded it needs to unregister its print handler from pevent. So add unregister function to do it. Cc: Jiri Olsa Signed-off-by: Namhyung Kim --- 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 05ae4b4ed0c8..fe962fbb156c 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/