Re: [PATCH][WIP]libtracefs:New API to enable the filtering of functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 11 Feb 2021 08:33:50 +0530
Sameeruddin Shaik <sameeruddin.shaik8@xxxxxxxxx> 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




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux