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=-7.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 A3DC7C433E1 for ; Tue, 7 Jul 2020 14:55:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8367020773 for ; Tue, 7 Jul 2020 14:55:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594133749; bh=aHocRiSUxiusQJVW3h6x7684Mvq5u9pKr23eOxvna4s=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=jl8pt5spXdsuWbm9eoGKArlhEIWsEPbWbywAozdIjAWL0VNccGRasa7sGkmBlXaeb jnAKOH6ECR1q/L3rv977trKkixG6l9HEcVTYpLZt+zeNeMJzZERc7+m62P2GOgXNlJ /hOpMNtLOSijDll9DXvSNPLO5dOC/O09zI9zQGxQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728330AbgGGOzs (ORCPT ); Tue, 7 Jul 2020 10:55:48 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:40442 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727975AbgGGOzr (ORCPT ); Tue, 7 Jul 2020 10:55:47 -0400 Received: by mail-wm1-f66.google.com with SMTP id f139so46871843wmf.5; Tue, 07 Jul 2020 07:55:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DVk7panNQ6v9maJMNYGJyJFPDhFb8C1XdWOE6GaZmDo=; b=Mf/cwMRbVC7yMED1r/gGW4jSswFN/qv5pIM2pRUWwrxl2+pNJbui/Gx/evfyX7+UWp NcXkx/+5X72qejB3zD4pg2fWEqam15DwAoojumfoE7l2bJonJN6JD10pnJU0W975qouT XnWTSG5wKY5gLMb4/2sPofqus70F77T9npsl9AJINAvQJyQxGv27OZijCV2FmS36zvPt 3+eECdmWHnx3hwYKgpQnjm5qHHixa+vV7ekFTqr/C5l4dHYOV+ICnSkL7fOhjLK3Cnsc TohAo/4UqHftRIZmET94UAlZM6LDOmzbnWVF2IuzGEdkH01lWbmM7Bla18f+6jTeiyDJ NAwA== X-Gm-Message-State: AOAM532cWQfDD/Su+I505EpHM3H2suzm4DMI676fz5XPR41vvDmRXK4k 0zeLjsDN3dnApmA5MJYH1c1wc2WSytGhks/evU8= X-Google-Smtp-Source: ABdhPJwI4SEGicEFTStrXGPXnf0reXhLqLPKVodm4fV0CGLtP7Cm22Kn4tTG4alEoR8IeihwACfrTt5uH9ookEHpGqY= X-Received: by 2002:a1c:7d56:: with SMTP id y83mr4872746wmc.154.1594133745559; Tue, 07 Jul 2020 07:55:45 -0700 (PDT) MIME-Version: 1.0 References: <20200702185344.913492689@goodmis.org> <20200702185703.946652691@goodmis.org> In-Reply-To: <20200702185703.946652691@goodmis.org> From: Namhyung Kim Date: Tue, 7 Jul 2020 23:55:34 +0900 Message-ID: Subject: Re: [PATCH v2 03/15] tools lib traceevent: Add tep_load_plugins_hook() API To: Steven Rostedt Cc: linux-kernel , Linux Trace Devel , Arnaldo Carvalho de Melo , Ingo Molnar , Jiri Olsa , Andrew Morton , "Tzvetomir Stoyanov (VMware)" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Steve and Tzvetomir, On Fri, Jul 3, 2020 at 3:57 AM Steven Rostedt wrote: > > From: "Tzvetomir Stoyanov (VMware)" > > Add the API function tep_load_plugins_hook() to the traceevent API to allow > tools a common method to load in the plugins that are part of the lib > traceevent library. > > Link: http://lore.kernel.org/linux-trace-devel/20190802110101.14759-4-tz.stoyanov@gmail.com > Link: http://lore.kernel.org/linux-trace-devel/20200625100516.365338-4-tz.stoyanov@gmail.com > > Signed-off-by: Tzvetomir Stoyanov (VMware) > Signed-off-by: Steven Rostedt (VMware) > --- > tools/lib/traceevent/event-parse.h | 6 ++++++ > tools/lib/traceevent/event-plugin.c | 19 +++++++++---------- > 2 files changed, 15 insertions(+), 10 deletions(-) > > diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h > index b77837f75a0d..776c7c24ee79 100644 > --- a/tools/lib/traceevent/event-parse.h > +++ b/tools/lib/traceevent/event-parse.h > @@ -396,6 +396,12 @@ struct tep_plugin_list; > struct tep_plugin_list *tep_load_plugins(struct tep_handle *tep); > void tep_unload_plugins(struct tep_plugin_list *plugin_list, > struct tep_handle *tep); > +void tep_load_plugins_hook(struct tep_handle *tep, const char *suffix, > + void (*load_plugin)(struct tep_handle *tep, > + const char *path, > + const char *name, > + void *data), > + void *data); > char **tep_plugin_list_options(void); > void tep_plugin_free_options_list(char **list); > int tep_plugin_add_options(const char *name, > diff --git a/tools/lib/traceevent/event-plugin.c b/tools/lib/traceevent/event-plugin.c > index e1f7ddd5a6cf..b53d9a53bcf9 100644 > --- a/tools/lib/traceevent/event-plugin.c > +++ b/tools/lib/traceevent/event-plugin.c > @@ -365,20 +365,19 @@ load_plugins_dir(struct tep_handle *tep, const char *suffix, > closedir(dir); > } > > -static void > -load_plugins(struct tep_handle *tep, const char *suffix, > - void (*load_plugin)(struct tep_handle *tep, > - const char *path, > - const char *name, > - void *data), > - void *data) > +void tep_load_plugins_hook(struct tep_handle *tep, const char *suffix, > + void (*load_plugin)(struct tep_handle *tep, > + const char *path, > + const char *name, > + void *data), > + void *data) Can we have a comment (or a doc) for this API? I'm not sure how it's used.. > { > char *home; > char *path; > char *envdir; > int ret; > > - if (tep->flags & TEP_DISABLE_PLUGINS) > + if (tep && tep->flags & TEP_DISABLE_PLUGINS) > return; Is it ok to call with a NULL tep handle? Thanks Namhyung > > /* > @@ -386,7 +385,7 @@ load_plugins(struct tep_handle *tep, const char *suffix, > * check that first. > */ > #ifdef PLUGIN_DIR > - if (!(tep->flags & TEP_DISABLE_SYS_PLUGINS)) > + if (!tep || !(tep->flags & TEP_DISABLE_SYS_PLUGINS)) > load_plugins_dir(tep, suffix, PLUGIN_DIR, > load_plugin, data); > #endif > @@ -423,7 +422,7 @@ tep_load_plugins(struct tep_handle *tep) > { > struct tep_plugin_list *list = NULL; > > - load_plugins(tep, ".so", load_plugin, &list); > + tep_load_plugins_hook(tep, ".so", load_plugin, &list); > return list; > } > > -- > 2.26.2 > >