Commit 96b55e39 authored by Masami Hiramatsu's avatar Masami Hiramatsu Committed by Arnaldo Carvalho de Melo

perf probe: Accept multiple filter options

Accept multiple filter options. Each filters are combined by logical-or.
E.g. --filter abc* --filter *def is same as --filter abc*|*def
Signed-off-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20150424094748.23967.63355.stgit@localhost.localdomainSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 3f51972c
...@@ -262,21 +262,25 @@ static int opt_set_filter(const struct option *opt __maybe_unused, ...@@ -262,21 +262,25 @@ static int opt_set_filter(const struct option *opt __maybe_unused,
const char *str, int unset __maybe_unused) const char *str, int unset __maybe_unused)
{ {
const char *err; const char *err;
int ret = 0;
if (str) { if (str) {
pr_debug2("Set filter: %s\n", str); pr_debug2("Set filter: %s\n", str);
if (params.filter)
strfilter__delete(params.filter);
params.filter = strfilter__new(str, &err);
if (!params.filter) { if (!params.filter) {
params.filter = strfilter__new(str, &err);
if (!params.filter)
ret = err ? -EINVAL : -ENOMEM;
} else
ret = strfilter__or(params.filter, str, &err);
if (ret == -EINVAL) {
pr_err("Filter parse error at %td.\n", err - str + 1); pr_err("Filter parse error at %td.\n", err - str + 1);
pr_err("Source: \"%s\"\n", str); pr_err("Source: \"%s\"\n", str);
pr_err(" %*c\n", (int)(err - str + 1), '^'); pr_err(" %*c\n", (int)(err - str + 1), '^');
return -EINVAL;
} }
} }
return 0; return ret;
} }
static int init_params(void) static int init_params(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment