Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934701AbbDXJt5 (ORCPT ); Fri, 24 Apr 2015 05:49:57 -0400 Received: from mail9.hitachi.co.jp ([133.145.228.44]:59493 "EHLO mail9.hitachi.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934682AbbDXJtz (ORCPT ); Fri, 24 Apr 2015 05:49:55 -0400 X-AuditID: 85900ec0-a1ec9b9000003d4c-a7-553a11b70fbf Subject: [PATCH perf/core v3 3/8] perf probe: Accept multiple filter options From: Masami Hiramatsu To: Arnaldo Carvalho de Melo Cc: Peter Zijlstra , Linux Kernel Mailing List , David Ahern , namhyung@kernel.org, Jiri Olsa , Ingo Molnar Date: Fri, 24 Apr 2015 18:47:48 +0900 Message-ID: <20150424094748.23967.63355.stgit@localhost.localdomain> In-Reply-To: <20150424094741.23967.758.stgit@localhost.localdomain> References: <20150424094741.23967.758.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: AAAAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1518 Lines: 50 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: Masami Hiramatsu --- tools/perf/builtin-probe.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index 92dcce0..be17075 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c @@ -262,21 +262,25 @@ static int opt_set_filter(const struct option *opt __maybe_unused, const char *str, int unset __maybe_unused) { const char *err; + int ret = 0; if (str) { pr_debug2("Set filter: %s\n", str); - if (params.filter) - strfilter__delete(params.filter); - params.filter = strfilter__new(str, &err); 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("Source: \"%s\"\n", str); pr_err(" %*c\n", (int)(err - str + 1), '^'); - return -EINVAL; } } - return 0; + return ret; } static int init_params(void) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/