Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965565AbbEFDOg (ORCPT ); Tue, 5 May 2015 23:14:36 -0400 Received: from terminus.zytor.com ([198.137.202.10]:36371 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965520AbbEFDOc (ORCPT ); Tue, 5 May 2015 23:14:32 -0400 Date: Tue, 5 May 2015 20:14:02 -0700 From: tip-bot for Masami Hiramatsu Message-ID: Cc: mingo@kernel.org, tglx@linutronix.de, masami.hiramatsu.pt@hitachi.com, linux-kernel@vger.kernel.org, namhyung@kernel.org, jolsa@redhat.com, acme@redhat.com, dsahern@gmail.com, hpa@zytor.com, peterz@infradead.org Reply-To: hpa@zytor.com, peterz@infradead.org, namhyung@kernel.org, jolsa@redhat.com, acme@redhat.com, dsahern@gmail.com, mingo@kernel.org, tglx@linutronix.de, masami.hiramatsu.pt@hitachi.com, linux-kernel@vger.kernel.org In-Reply-To: <20150424094748.23967.63355.stgit@localhost.localdomain> References: <20150424094748.23967.63355.stgit@localhost.localdomain> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf probe: Accept multiple filter options Git-Commit-ID: 96b55e39237b8bc92d8e6b96f896c106f2d39cf6 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2191 Lines: 63 Commit-ID: 96b55e39237b8bc92d8e6b96f896c106f2d39cf6 Gitweb: http://git.kernel.org/tip/96b55e39237b8bc92d8e6b96f896c106f2d39cf6 Author: Masami Hiramatsu AuthorDate: Fri, 24 Apr 2015 18:47:48 +0900 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 4 May 2015 12:43:55 -0300 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: Masami Hiramatsu Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20150424094748.23967.63355.stgit@localhost.localdomain Signed-off-by: Arnaldo Carvalho de Melo --- 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/