From patchwork Fri Aug 2 11:00:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Tzvetomir Stoyanov (VMware)" X-Patchwork-Id: 11073183 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D2F191399 for ; Fri, 2 Aug 2019 11:01:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD1F328451 for ; Fri, 2 Aug 2019 11:01:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B15D328712; Fri, 2 Aug 2019 11:01:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8F8828451 for ; Fri, 2 Aug 2019 11:01:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729797AbfHBLBM (ORCPT ); Fri, 2 Aug 2019 07:01:12 -0400 Received: from mail-wr1-f43.google.com ([209.85.221.43]:34523 "EHLO mail-wr1-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729430AbfHBLBM (ORCPT ); Fri, 2 Aug 2019 07:01:12 -0400 Received: by mail-wr1-f43.google.com with SMTP id 31so76753083wrm.1 for ; Fri, 02 Aug 2019 04:01:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=op5qMTCmnobHOHUOYgemlbsXJr25MTo6R85Nb11EB5E=; b=NIjm0eYmXpJA7o7ypfOzMCZrHCNxzqmTKp8tblACQ/f+4wQLIL15p8ndWU/LojNPEC 6v3R9+Vr263NtbKix0WJ11VoxDJfXftZKBHLIHSGOayFrNgLeATef++tkc+8c0JeDmuu FCJxDmz7TLLUb+AZS3hlXAqUvzujm5jCEDwrh+E1lHkzH8Qq7J0UsO/OZNPX8qMsGGFM Uzmiv9WP8s6rJzMOej883Wr7XBcgYIAwCk3ajTrpSuL+kMv1XYDbGD4XAJpuOSiJVCE1 O61qFMIJvd1Xbk01NNTJLq1CBLNKsX3efJLnc6A/xhnAn8OoYPmih6osgOJWRBOO0hGK WM3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=op5qMTCmnobHOHUOYgemlbsXJr25MTo6R85Nb11EB5E=; b=lLu36gDxcNImA4qVFbbOe8Rc20HtonRIQEitjUyoMSShv6i5/Lj25jYzUT4fTi1HxX wXO3ovY0dxFb7qtUh6gcisgDRbUA5ar0k4CibEl8xTuB6SnAAxSZXZVrO3Tts/Qpp6fm mQhR+lKFvsM3y7dxuLi1oabFj6HRYnx/Bk1QxosURz8T4tjUUasQWsqXRhCn/Z0UBdkV faA5zMxl4mp3/6Xa+tkDD0vJtcxGZRxYfH7ktT7mvNIKAf+JgKDO+xUc5U/b3FzgNZiI wRzvE4kIi89ec7YaudfO3+pUwdGXQbQ9AoVanZWYHp5AiUphfLatpQojxxubUzFCFhRU scHg== X-Gm-Message-State: APjAAAVBJhhMn5rSXMNXsZcRVqTsDClALm/izBANGijCSMvfgRlrtd1D xNGKmoAXUkJ8W95Swg5PLfEoEvqRICY= X-Google-Smtp-Source: APXvYqwrrTsc3KaqEm6VfAfXgVowCyibx11Mp6OEBdG6zkF1gW2xv1fEgQO1BL5/9ut+yGjuvfTYqA== X-Received: by 2002:a05:6000:187:: with SMTP id p7mr22271342wrx.189.1564743667364; Fri, 02 Aug 2019 04:01:07 -0700 (PDT) Received: from oberon.eng.vmware.com ([146.247.46.5]) by smtp.gmail.com with ESMTPSA id r15sm79511433wrj.68.2019.08.02.04.01.06 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 02 Aug 2019 04:01:06 -0700 (PDT) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH v2 2/6] trace-cmd: Move plugin options from trace-cmd to libtraceevent. Date: Fri, 2 Aug 2019 14:00:57 +0300 Message-Id: <20190802110101.14759-3-tz.stoyanov@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190802110101.14759-1-tz.stoyanov@gmail.com> References: <20190802110101.14759-1-tz.stoyanov@gmail.com> MIME-Version: 1.0 Sender: linux-trace-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There are two different implementations of plugin options, which work in parallel - one in trace-cmd and the other one in libtraceevent. Both have the same functionality and most of the implementation is the same, duplicated. As currently there are only libtraceevent plugins,the implementation plugin options should be in libtraceevent only. Signed-off-by: Tzvetomir Stoyanov (VMware) --- include/trace-cmd/trace-cmd.h | 6 - include/traceevent/event-parse.h | 2 + kernel-shark/src/libkshark.c | 4 +- lib/trace-cmd/trace-ftrace.c | 4 +- lib/trace-cmd/trace-util.c | 422 ------------------------------- lib/traceevent/event-plugin.c | 173 +++++++++++++ plugins/plugin_function.c | 4 +- tracecmd/trace-list.c | 2 +- tracecmd/trace-read.c | 2 +- 9 files changed, 183 insertions(+), 436 deletions(-) diff --git a/include/trace-cmd/trace-cmd.h b/include/trace-cmd/trace-cmd.h index 6f62ab9..c06067e 100644 --- a/include/trace-cmd/trace-cmd.h +++ b/include/trace-cmd/trace-cmd.h @@ -337,9 +337,6 @@ void tracecmd_msg_set_done(struct tracecmd_msg_handle *msg_handle); /* --- Plugin handling --- */ extern struct tep_plugin_option trace_ftrace_options[]; -int trace_util_add_options(const char *name, struct tep_plugin_option *options); -void trace_util_remove_options(struct tep_plugin_option *options); -int trace_util_add_option(const char *name, const char *val); int trace_util_load_plugins(struct tep_handle *pevent, const char *suffix, int (*load_plugin)(struct tep_handle *pevent, const char *path, @@ -352,10 +349,7 @@ char **trace_util_find_plugin_files(const char *suffix); void trace_util_free_plugin_files(char **files); void trace_util_print_plugins(struct trace_seq *s, const char *prefix, const char *suffix, const struct tep_plugin_list *list); -void trace_util_print_plugin_options(struct trace_seq *s); -char **trace_util_list_plugin_options(void); void trace_util_free_plugin_options_list(char **list); -const char *trace_util_plugin_option_value(const char *name); /* Used for trace-cmd list */ void tracecmd_ftrace_load_options(void); diff --git a/include/traceevent/event-parse.h b/include/traceevent/event-parse.h index 65cabd9..a51b73f 100644 --- a/include/traceevent/event-parse.h +++ b/include/traceevent/event-parse.h @@ -386,7 +386,9 @@ char **tep_plugin_list_options(void); void tep_plugin_free_options_list(char **list); int tep_plugin_add_options(const char *name, struct tep_plugin_option *options); +int tep_plugin_add_option(const char *name, const char *val); void tep_plugin_remove_options(struct tep_plugin_option *options); +void tep_plugin_print_options(struct trace_seq *s); void tep_print_plugins(struct trace_seq *s, const char *prefix, const char *suffix, const struct tep_plugin_list *list); diff --git a/kernel-shark/src/libkshark.c b/kernel-shark/src/libkshark.c index 4201fa0..47ec9c2 100644 --- a/kernel-shark/src/libkshark.c +++ b/kernel-shark/src/libkshark.c @@ -160,8 +160,8 @@ bool kshark_open(struct kshark_context *kshark_ctx, const char *file) * Turn off function trace indent and turn on show parent * if possible. */ - trace_util_add_option("ftrace:parent", "1"); - trace_util_add_option("ftrace:indent", "0"); + tep_plugin_add_option("ftrace:parent", "1"); + tep_plugin_add_option("ftrace:indent", "0"); return true; } diff --git a/lib/trace-cmd/trace-ftrace.c b/lib/trace-cmd/trace-ftrace.c index 22e5213..20bf71f 100644 --- a/lib/trace-cmd/trace-ftrace.c +++ b/lib/trace-cmd/trace-ftrace.c @@ -359,7 +359,7 @@ fgraph_ret_handler(struct trace_seq *s, struct tep_record *record, */ void tracecmd_ftrace_load_options(void) { - trace_util_add_options("ftrace", trace_ftrace_options); + tep_plugin_add_options("ftrace", trace_ftrace_options); } int tracecmd_ftrace_overrides(struct tracecmd_input *handle, @@ -381,7 +381,7 @@ int tracecmd_ftrace_overrides(struct tracecmd_input *handle, tep_register_event_handler(pevent, -1, "ftrace", "funcgraph_exit", fgraph_ret_handler, finfo); - trace_util_add_options("ftrace", trace_ftrace_options); + tep_plugin_add_options("ftrace", trace_ftrace_options); /* Store the func ret id and event for later use */ event = tep_find_event_by_name(pevent, "ftrace", "funcgraph_exit"); diff --git a/lib/trace-cmd/trace-util.c b/lib/trace-cmd/trace-util.c index 7c74bae..910c6c5 100644 --- a/lib/trace-cmd/trace-util.c +++ b/lib/trace-cmd/trace-util.c @@ -29,18 +29,6 @@ int tracecmd_disable_sys_plugins; int tracecmd_disable_plugins; -static struct registered_plugin_options { - struct registered_plugin_options *next; - struct tep_plugin_option *options; -} *registered_options; - -static struct trace_plugin_options { - struct trace_plugin_options *next; - char *plugin; - char *option; - char *value; -} *trace_plugin_options; - #define _STR(x) #x #define STR(x) _STR(x) @@ -50,108 +38,11 @@ struct tep_plugin_list { void *handle; }; -/** - * trace_util_list_plugin_options - get list of plugin options - * - * Returns an array of char strings that list the currently registered - * plugin options in the format of :