Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 34f76afa authored by Tom Zanussi's avatar Tom Zanussi Committed by Steven Rostedt (VMware)
Browse files

tracing: Use tracing error_log with trace event filters

Use tracing_log_err() from the new tracing error_log mechanism to send
filter parse errors to tracing/error_log.

With this change, users will be able to see filter errors by looking
at tracing/error_log.

The same errors will also be available in the filter file, as
expected.

Link: http://lkml.kernel.org/r/1d942c419941539a11d78a6810fc5740a99b2974.1554072478.git.tom.zanussi@linux.intel.com



Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
Signed-off-by: default avatarTom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent d566c5e9
Loading
Loading
Loading
Loading
+9 −2
Original line number Original line Diff line number Diff line
@@ -66,7 +66,8 @@ static const char * ops[] = { OPS };
	C(INVALID_FILTER,	"Meaningless filter expression"),	\
	C(INVALID_FILTER,	"Meaningless filter expression"),	\
	C(IP_FIELD_ONLY,	"Only 'ip' field is supported for function trace"), \
	C(IP_FIELD_ONLY,	"Only 'ip' field is supported for function trace"), \
	C(INVALID_VALUE,	"Invalid value (did you forget quotes)?"), \
	C(INVALID_VALUE,	"Invalid value (did you forget quotes)?"), \
	C(NO_FILTER,		"No filter found"),
	C(ERRNO,		"Error"),				\
	C(NO_FILTER,		"No filter found")


#undef C
#undef C
#define C(a, b)		FILT_ERR_##a
#define C(a, b)		FILT_ERR_##a
@@ -76,7 +77,7 @@ enum { ERRORS };
#undef C
#undef C
#define C(a, b)		b
#define C(a, b)		b


static char *err_text[] = { ERRORS };
static const char *err_text[] = { ERRORS };


/* Called after a '!' character but "!=" and "!~" are not "not"s */
/* Called after a '!' character but "!=" and "!~" are not "not"s */
static bool is_not(const char *str)
static bool is_not(const char *str)
@@ -947,8 +948,14 @@ static void append_filter_err(struct filter_parse_error *pe,
	if (pe->lasterr > 0) {
	if (pe->lasterr > 0) {
		trace_seq_printf(s, "\n%*s", pos, "^");
		trace_seq_printf(s, "\n%*s", pos, "^");
		trace_seq_printf(s, "\nparse_error: %s\n", err_text[pe->lasterr]);
		trace_seq_printf(s, "\nparse_error: %s\n", err_text[pe->lasterr]);
		tracing_log_err("event filter parse error",
				filter->filter_string, err_text,
				pe->lasterr, pe->lasterr_pos);
	} else {
	} else {
		trace_seq_printf(s, "\nError: (%d)\n", pe->lasterr);
		trace_seq_printf(s, "\nError: (%d)\n", pe->lasterr);
		tracing_log_err("event filter parse error",
				filter->filter_string, err_text,
				FILT_ERR_ERRNO, 0);
	}
	}
	trace_seq_putc(s, 0);
	trace_seq_putc(s, 0);
	buf = kmemdup_nul(s->buffer, s->seq.len, GFP_KERNEL);
	buf = kmemdup_nul(s->buffer, s->seq.len, GFP_KERNEL);