From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9C8DC7618B for ; Fri, 26 Jul 2019 12:43:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A4CEB21951 for ; Fri, 26 Jul 2019 12:43:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="oM7A7XyQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726287AbfGZMnR (ORCPT ); Fri, 26 Jul 2019 08:43:17 -0400 Received: from mail-wm1-f47.google.com ([209.85.128.47]:52654 "EHLO mail-wm1-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726277AbfGZMnR (ORCPT ); Fri, 26 Jul 2019 08:43:17 -0400 Received: by mail-wm1-f47.google.com with SMTP id s3so47888786wms.2 for ; Fri, 26 Jul 2019 05:43:14 -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=oM7A7XyQdnrPnTYd0apikbCIepXtezwplBu5oKy6ejNwi0vn3zhqH7RYs2xSmuRye4 z6J/z3sIbBSb96lzwg4W0w5ZNgLikWeMMg+JivPPupaL9nOILS1V2QX4/CcVVDh9CN91 oaByYf0++V2ZwPwnMGQ1hsrTpBMFg92fUlWSSC/7cEJfHOprX8p96xFVfdf/m6PJyQza GaFqE+PAS4Ep5r3mc60EEzhEjlLtqkNCskq/2Vym86gIFInx3dGPh34Ws00LGMMcZ8R6 QQ3frseD6DtErnqAVNgEI6e9m6TrI6JFT0JM2avavrts7WnvADG87AvyvRW42qmIc1++ b1fg== 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=iJO3uGLamqcNVs4zIfoRWKUWMLs2nsSVUCHA+K1eLyZdSX1v0azmnNotVrGkf+aX2D 64prh2V4vskGqIeButi3arNpblklK2mho1MEaWdYht26W6F0+z/KhO/UWqUKmBcdBxgQ +Zo7VsIiuap7JSs2Rryu/Ji5+96BFq/AhZemAkQJGnu11664aWFuEm1Rfj6bjGxxP2YV hAuBpZpQcnIJYybbqsKHtGhk9mBVbEJAyejzlNgE/irPoXshVAPHBZo2G6fF7/XOErp1 /Tzteryvl/aLrGM6KEMV/Z72T8F4f29hugO0A0RWniXPsFkJxOW7SM54ep6PEx9UjCDv tbow== X-Gm-Message-State: APjAAAXGOJovSjm+lwBGpGn7IXIgm2pU8Mc1pKhhvd9k2OO115Xr14Hn yd8XuRhyvmoTRoyeiWbTliI= X-Google-Smtp-Source: APXvYqxUXPvB9m8j5tuQ+8XoU2+lMTmilSjZSJHF9P22AAvNzrCvAKmDfEgaQEX+N/40mAOFuxY24w== X-Received: by 2002:a7b:ce18:: with SMTP id m24mr82538669wmc.126.1564144993028; Fri, 26 Jul 2019 05:43:13 -0700 (PDT) Received: from oberon.eng.vmware.com ([146.247.46.5]) by smtp.gmail.com with ESMTPSA id o26sm105565833wro.53.2019.07.26.05.43.11 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 26 Jul 2019 05:43:11 -0700 (PDT) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH 2/3] trace-cmd: Move plugin options from trace-cmd to libtraceevent. Date: Fri, 26 Jul 2019 15:43:07 +0300 Message-Id: <20190726124308.18735-3-tz.stoyanov@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190726124308.18735-1-tz.stoyanov@gmail.com> References: <20190726124308.18735-1-tz.stoyanov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-trace-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org 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 :