linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] ftrace: remove redundant strsep in mod_callback
@ 2015-09-29 16:46 Dmitry Safonov
  2015-09-29 16:46 ` [PATCH 2/5] ftrace: clarify code for mod command Dmitry Safonov
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Dmitry Safonov @ 2015-09-29 16:46 UTC (permalink / raw)
  To: rostedt; +Cc: mingo, corbet, linux-doc, linux-kernel, Dmitry Safonov

By now there isn't any subcommand for mod.

Before:
	sh$ echo '*:mod:ipv6:a' > set_ftrace_filter
	sh$ echo '*:mod:ipv6' > set_ftrace_filter
had the same results, but now first will result in:
	sh$ echo '*:mod:ipv6:a' > set_ftrace_filter
	-bash: echo: write error: Invalid argument

Also, I clarified ftrace_mod_callback code a little.

Signed-off-by: Dmitry Safonov <0x7f454c46@gmail.com>
---
 kernel/trace/ftrace.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index b0623ac..f87401b 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -3564,8 +3564,7 @@ static int
 ftrace_mod_callback(struct ftrace_hash *hash,
 		    char *func, char *cmd, char *param, int enable)
 {
-	char *mod;
-	int ret = -EINVAL;
+	int ret;
 
 	/*
 	 * cmd == 'mod' because we only registered this func
@@ -3576,16 +3575,12 @@ ftrace_mod_callback(struct ftrace_hash *hash,
 	 */
 
 	/* we must have a module name */
-	if (!param)
-		return ret;
-
-	mod = strsep(&param, ":");
-	if (!strlen(mod))
-		return ret;
+	if (!param || !strlen(param))
+		return -EINVAL;
 
-	ret = ftrace_match_module_records(hash, func, mod);
-	if (!ret)
-		ret = -EINVAL;
+	ret = ftrace_match_module_records(hash, func, param);
+	if (ret == 0)
+		return -EINVAL;
 	if (ret < 0)
 		return ret;
 
-- 
2.5.3


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-10-16 22:32 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-29 16:46 [PATCH 1/5] ftrace: remove redundant strsep in mod_callback Dmitry Safonov
2015-09-29 16:46 ` [PATCH 2/5] ftrace: clarify code for mod command Dmitry Safonov
2015-09-29 16:46 ` [PATCH 3/5] ftrace: introduce ftrace_glob structure Dmitry Safonov
2015-10-16 15:05   ` Steven Rostedt
2015-10-16 22:32     ` Dmitry Safonov
2015-09-29 16:46 ` [PATCH 4/5] ftrace: add module globbing Dmitry Safonov
2015-09-29 16:46 ` [PATCH 5/5] Documentation: ftrace: module globbing usage Dmitry Safonov
2015-09-29 19:11 ` [PATCH 1/5] ftrace: remove redundant strsep in mod_callback Steven Rostedt
2015-10-05 15:16   ` Дмитрий Сафонов
2015-10-14  0:48 ` Steven Rostedt
2015-10-16  8:52   ` Dmitry Safonov

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).