[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM9d7cgMgqFDvKhs6xwdBSMsaG=3ZG0RtxwgQDCTLGkML1MY4Q@mail.gmail.com>
Date: Wed, 8 Jul 2020 09:02:37 +0900
From: Namhyung Kim <namhyung@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: linux-kernel <linux-kernel@...r.kernel.org>,
Linux Trace Devel <linux-trace-devel@...r.kernel.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Ingo Molnar <mingo@...nel.org>, Jiri Olsa <jolsa@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@...il.com>
Subject: Re: [PATCH v2 05/15] tools lib traceevent: Introduced new traceevent
API, for adding new plugins directories.
On Wed, Jul 8, 2020 at 12:24 AM Steven Rostedt <rostedt@...dmis.org> wrote:
>
> On Wed, 8 Jul 2020 00:06:38 +0900
> Namhyung Kim <namhyung@...nel.org> wrote:
> > >
> > > +/**
> > > + * tep_add_plugin_path - Add a new plugin directory.
> > > + * @tep: Trace event handler.
> > > + * @path: Path to a directory. All files with extension .so in that
> >
> > Is the extension (".so") fixed? I think a new API has the suffix argument
> > which may change it... ?
>
> So this should add a "suffix" argument? NULL for ".so"?
I think it's just fine to change the comment. The file extension handling
belongs to the plugin load API and we are adding the directory path
here IMHO.
>
> >
> >
> > > + * directory will be loaded as plugins.
> > > + *@...o: Load priority of the plugins in that directory.
> > > + *
> > > + * Returns -1 in case of an error, 0 otherwise.
> > > + */
> > > +int tep_add_plugin_path(struct tep_handle *tep, char *path,
> > > + enum tep_plugin_load_priority prio)
> > > +{
> > > + struct tep_plugins_dir *dir;
> > > +
> > > + if (!tep || !path)
> > > + return -1;
> > > +
> > > + dir = calloc(1, sizeof(*dir));
> > > + if (!dir)
> > > + return -1;
> > > +
> > > + dir->path = strdup(path);
> >
> > It needs to check the return value..
>
> Yes it does indeed.
>
> BTW, since these patches are already in trace-cmd.git, would be OK if
> we just write patches on top of this series to address your concerns.
> This way, we would be also adding them to trace-cmd.git as well.
I'm ok with it. I'll review more patches soon..
Thanks
Namhyung
>
> I eventually want a separate libraries repo on kernel.org that this
> lives in and remove it from the tools/lib directory of the kernel.
>
> -- Steve
>
>
> >
> > > + dir->prio = prio;
> > > + dir->next = tep->plugins_dir;
> > > + tep->plugins_dir = dir;
> > > +
> > > + return 0;
> > > +}
> > > +
> > > +void tep_free_plugin_paths(struct tep_handle *tep)
> > > +{
> > > + struct tep_plugins_dir *dir;
> > > +
> > > + if (!tep)
> > > + return;
> > > +
> > > + dir = tep->plugins_dir;
> > > + while (dir) {
> > > + tep->plugins_dir = tep->plugins_dir->next;
> > > + free(dir->path);
> > > + free(dir);
> > > + dir = tep->plugins_dir;
> > > + }
> > > +}
> > > +
> > > void
> > > tep_unload_plugins(struct tep_plugin_list *plugin_list, struct tep_handle *tep)
> > > {
> > > --
> > > 2.26.2
> > >
> > >
>
Powered by blists - more mailing lists