From: Steven Rostedt <rostedt@goodmis.org>
To: linux-trace-devel@vger.kernel.org
Cc: Sameeruddin shaik <sameeruddin.shaik8@gmail.com>
Subject: [PATCH 3/4] libtracefs: Allow filter to be NULL if module is set in tracefs_function_filter()
Date: Tue, 30 Mar 2021 14:33:27 -0400 [thread overview]
Message-ID: <20210330183546.207110833@goodmis.org> (raw)
In-Reply-To: 20210330183324.709017776@goodmis.org
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
If the module is set then a NULL filter will be the same as if "*" was
passed in as filter. This will select all the functions for a given
module.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
Documentation/libtracefs-function-filter.txt | 4 +++-
src/tracefs-tools.c | 4 ++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/Documentation/libtracefs-function-filter.txt b/Documentation/libtracefs-function-filter.txt
index a4218b75deea..fa0f0de6f567 100644
--- a/Documentation/libtracefs-function-filter.txt
+++ b/Documentation/libtracefs-function-filter.txt
@@ -37,7 +37,9 @@ not a period, but will match any one character. To force a regular
expression, either prefix _filter_ with a '^' or append it with a '$' as
the _filter_ does complete matches of the functions anyway.
-The _filter_ may be NULL if a previous call to *tracefs_function_filter()* with
+If _module_ is set and _filter_ is NULL, this will imply the same as _filter_ being
+equal to "pass:[*]". Which will enable all functions for a given _module_. Otherwise
+the _filter_ may be NULL if a previous call to *tracefs_function_filter()* with
the same _instance_ had *TRACEFS_FL_CONTINUE* set and this call does not. This is
useful to simply commit the previous filters. It may also be NULL
if *TRACEFS_FL_RESET* is set and the previous call did not have the same _instance_
diff --git a/src/tracefs-tools.c b/src/tracefs-tools.c
index a9a51beb02b2..82809fae3e6d 100644
--- a/src/tracefs-tools.c
+++ b/src/tracefs-tools.c
@@ -786,6 +786,10 @@ int tracefs_function_filter(struct tracefs_instance *instance, const char *filte
*/
errno = EINVAL;
+ /* module set with NULL filter means to enable all functions in a module */
+ if (module && !filter)
+ filter = "*";
+
if (!filter) {
/* OK to call without filters if this is closing the opened file */
if (!cont && *fd >= 0) {
--
2.30.1
next prev parent reply other threads:[~2021-03-30 18:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-30 18:33 [PATCH 0/4] libtracefs: More updates to tracefs_function_filter() Steven Rostedt
2021-03-30 18:33 ` [PATCH 1/4] libtracefs: Only allow RESET flag if file is not already opened Steven Rostedt
2021-03-30 18:33 ` [PATCH 2/4] libtracefs: Allow filter be NULL if RESET flag is set Steven Rostedt
2021-03-30 18:33 ` Steven Rostedt [this message]
2021-03-30 18:33 ` [PATCH 4/4] libtracefs: Add TRACEFS_FL_FUTURE flag for future module filtering Steven Rostedt
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=20210330183546.207110833@goodmis.org \
--to=rostedt@goodmis.org \
--cc=linux-trace-devel@vger.kernel.org \
--cc=sameeruddin.shaik8@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).