linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Sameeruddin Shaik <sameeruddin.shaik8@gmail.com>
Cc: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>,
	Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: Re: [PATCH][WIP]libtracefs:New API to enable the filtering of functions
Date: Wed, 10 Feb 2021 10:38:46 -0500	[thread overview]
Message-ID: <20210210103846.1ccbc4f1@gandalf.local.home> (raw)
In-Reply-To: <CAK7tX=YfQ4SGdUu3ac7bwRw0jGKBzgrNGtVib6VfrBUYEdJj2g@mail.gmail.com>

On Thu, 11 Feb 2021 08:33:50 +0530
Sameeruddin Shaik <sameeruddin.shaik8@gmail.com> wrote:

> By this you mean to say like, we have to do the filter functions
> validation in the API?
> or
> shall we continue with tzvetomir idea (I mean depending on the kernel
> validation)?

I mean write to the file, and if it errors, then do our own operations on
it. This would need to be documented in the man page for this function.


For example:

   filter = "sched*"

would write into the file, which the kernel should turn into a selection of
all functions that start with "sched".

But if you had:

   filter = "sched_feat_[^w].*"

Which would set "sched_feat_open" and "sched_feat_show" but not
"sched_feat_write". Since it is a regex and not a glob expression, it will
fail the filter.

 fd = open("set_ftrace_filter", O_WRONLY);
 write(fd, "sched_feat_[^w].*", 7);

Will return an error of EINVAL. When that happens, you should run this
through the regex exec, and then use the result to find all the matches.

Note, it should be implied that if the regex does not start with "^" and
end with "$", then that should be added too.

  "sched_feat_[^w].*" turns into "^sched_feat_[^w].*$"

before processing it into the regex.

You may be asking, what if someone wants to add something that is a regex,
but also acceptable as a glob?

Let's say you want "_*acpi_device_uevent_modalias", where you want:

 "__acpi_device_uevent_modalias" and "acpi_device_uevent_modalias"

But the glob would only select "__acpi_device_uevent_modalias"

To force the regex, the user should just add "^" to the beginning of the
string.

Thus "_*acpi_device_uevent_modalias" wont work as expected, but
"^_*acpi_device_uevent_modalias" will.

Make sense?

-- Steve


  reply	other threads:[~2021-02-10 15:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAK7tX=angRdxNdg2yNnss-NuBm+i-Y3unyT6BaeY0Quj-QB+UA@mail.gmail.com>
2021-02-09  5:52 ` [PATCH][WIP]libtracefs:New API to enable the filtering of functions Tzvetomir Stoyanov
2021-02-09  6:38   ` Sameeruddin Shaik
2021-02-09 14:41     ` Tzvetomir Stoyanov
2021-02-09 16:58   ` Steven Rostedt
2021-02-11  3:03     ` Sameeruddin Shaik
2021-02-10 15:38       ` Steven Rostedt [this message]
2021-02-12  3:09         ` Sameeruddin Shaik

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=20210210103846.1ccbc4f1@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=sameeruddin.shaik8@gmail.com \
    --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).