linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Zanussi <zanussi@kernel.org>
To: rostedt@goodmis.org, axelrasmussen@google.com
Cc: mhiramat@kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 3/4] tracing: Update synth command errors
Date: Fri, 16 Oct 2020 16:48:24 -0500	[thread overview]
Message-ID: <839b078ba3e31a3fcd82ff3a4e6c483ba5cfe7db.1602883818.git.zanussi@kernel.org> (raw)
In-Reply-To: <cover.1602883818.git.zanussi@kernel.org>
In-Reply-To: <cover.1602883818.git.zanussi@kernel.org>

Since array types are handled differently, errors referencing them
also need to be handled differently.  Add and use a new
INVALID_ARRAY_SPEC error.  Also remove INVALID_FIELD since it can
better be handled using CMD_INCOMPLETE, and remove CMD_TOO_LONG, since
it's no longer used.

Signed-off-by: Tom Zanussi <zanussi@kernel.org>
---
 kernel/trace/trace_events_synth.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_synth.c
index 2333025ef31e..f48964bdd66e 100644
--- a/kernel/trace/trace_events_synth.c
+++ b/kernel/trace/trace_events_synth.c
@@ -28,8 +28,7 @@
 	C(TOO_MANY_FIELDS,	"Too many fields"),		\
 	C(INCOMPLETE_TYPE,	"Incomplete type"),		\
 	C(INVALID_TYPE,		"Invalid type"),		\
-	C(INVALID_FIELD,	"Invalid field"),		\
-	C(CMD_TOO_LONG,		"Command too long"),
+	C(INVALID_ARRAY_SPEC,	"Invalid array specification"),
 
 #undef C
 #define C(a, b)		SYNTH_ERR_##a
@@ -643,6 +642,10 @@ static struct synth_field *parse_synth_field(int argc, const char **argv,
 	size = synth_field_size(field->type);
 	if (size < 0) {
 		synth_err(SYNTH_ERR_INVALID_TYPE, errpos(field_type));
+		if (array)
+			synth_err(SYNTH_ERR_INVALID_ARRAY_SPEC, errpos(field_name));
+		else
+			synth_err(SYNTH_ERR_INVALID_TYPE, errpos(field_type));
 		ret = -EINVAL;
 		goto free;
 	} else if (size == 0) {
@@ -1191,7 +1194,7 @@ static int __create_synth_event(int argc, const char *name, const char **argv)
 	}
 
 	if (i < argc) {
-		synth_err(SYNTH_ERR_INVALID_FIELD, errpos(argv[i]));
+		synth_err(SYNTH_ERR_CMD_INCOMPLETE, errpos(argv[i]));
 		ret = -EINVAL;
 		goto err;
 	}
-- 
2.17.1


  parent reply	other threads:[~2020-10-16 21:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-16 21:48 [PATCH 0/4] tracing: More synthetic event error fixes Tom Zanussi
2020-10-16 21:48 ` [PATCH 1/4] tracing: Make trace_*_run_command() more flexible Tom Zanussi
2020-10-18 14:20   ` Masami Hiramatsu
2020-10-18 15:15     ` Masami Hiramatsu
2020-10-19 14:35       ` Tom Zanussi
2020-10-20 13:20         ` Masami Hiramatsu
2020-10-16 21:48 ` [PATCH 2/4] tracing: Use new trace_run_command() options Tom Zanussi
2020-10-16 21:48 ` Tom Zanussi [this message]
2020-10-16 21:48 ` [PATCH 4/4] selftests/ftrace: Update synthetic event syntax errors Tom Zanussi
2020-10-18 15:13 ` [PATCH 0/4] tracing: More synthetic event error fixes Masami Hiramatsu

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=839b078ba3e31a3fcd82ff3a4e6c483ba5cfe7db.1602883818.git.zanussi@kernel.org \
    --to=zanussi@kernel.org \
    --cc=axelrasmussen@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.org \
    /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).