From: Steven Rostedt <rostedt@goodmis.org>
To: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH 1/2] trace-cmd: Add new tracefs API tracefs_instances_walk()
Date: Fri, 17 Jul 2020 09:25:07 -0400 [thread overview]
Message-ID: <20200717092507.3a81a812@oasis.local.home> (raw)
In-Reply-To: <20200717080326.82151-2-tz.stoyanov@gmail.com>
On Fri, 17 Jul 2020 11:03:25 +0300
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote:
> The logic for finding all configured ftrace instances is encapuslated in
> the new tracefs_instances_walk() API. A user specified callback is
> called for each ftrace instance in the system, excpet for the top level
> one.
> The implementation of "trace-cmd stat" is modified to use the new API.
>
> Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
> ---
> include/tracefs/tracefs.h | 1 +
> lib/tracefs/include/tracefs-local.h | 1 +
> lib/tracefs/tracefs-events.c | 14 ++++----
> lib/tracefs/tracefs-instance.c | 52 +++++++++++++++++++++++++++++
> tracecmd/trace-stat.c | 52 ++++++++---------------------
> 5 files changed, 74 insertions(+), 46 deletions(-)
>
> diff --git a/include/tracefs/tracefs.h b/include/tracefs/tracefs.h
> index 8ee7ba6e..0dd8046f 100644
> --- a/include/tracefs/tracefs.h
> +++ b/include/tracefs/tracefs.h
> @@ -32,6 +32,7 @@ int tracefs_instance_file_write(struct tracefs_instance *instance,
> const char *file, const char *str);
> char *tracefs_instance_file_read(struct tracefs_instance *instance,
> char *file, int *psize);
> +int tracefs_instances_walk(int (*callback)(const char *, void *), void *context);
Perhaps a better name would be: tracefs_instance_iterate()?
I usually consider a "walk" as going through a tree, not a list. If
this was a directory tree, then "walk" would be more appropriate.
An "iterator" is something that walks through a list and triggers a
callback, like this does.
But other than that, the patch looks good.
-- Steve
>
> bool tracefs_file_exists(struct tracefs_instance *instance, char *name);
> bool tracefs_dir_exists(struct tracefs_instance *instance, char *name);
> diff --git a/lib/tracefs/include/tracefs-local.h b/lib/tracefs/include/tracefs-local.h
> index fe327a0f..08b67fa9 100644
> --- a/lib/tracefs/include/tracefs-local.h
>
next prev parent reply other threads:[~2020-07-17 13:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-17 8:03 [PATCH 0/2] Enhancements to trace-cmd clear Tzvetomir Stoyanov (VMware)
2020-07-17 8:03 ` [PATCH 1/2] trace-cmd: Add new tracefs API tracefs_instances_walk() Tzvetomir Stoyanov (VMware)
2020-07-17 13:25 ` Steven Rostedt [this message]
2020-07-17 8:03 ` [PATCH 2/2] trace-cmd: Enhance "trace-cmd clear" to be instance aware Tzvetomir Stoyanov (VMware)
2020-07-17 13:31 ` Steven Rostedt
2020-07-17 14:06 ` Steven Rostedt
2020-07-17 14:29 ` Tzvetomir Stoyanov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200717092507.3a81a812@oasis.local.home \
--to=rostedt@goodmis.org \
--cc=linux-trace-devel@vger.kernel.org \
--cc=tz.stoyanov@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).