From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161266AbcFODal (ORCPT ); Tue, 14 Jun 2016 23:30:41 -0400 Received: from mail.kernel.org ([198.145.29.136]:59180 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161035AbcFODah (ORCPT ); Tue, 14 Jun 2016 23:30:37 -0400 From: Masami Hiramatsu To: Arnaldo Carvalho de Melo Cc: Masami Hiramatsu , linux-kernel@vger.kernel.org, Namhyung Kim , Peter Zijlstra , Ingo Molnar , Hemant Kumar , Ananth N Mavinakayanahalli , Brendan Gregg Subject: [PATCH perf/core v11 17/20] perf: probe-cache: Add for_each_probe_cache_entry() wrapper Date: Wed, 15 Jun 2016 12:30:22 +0900 Message-Id: <20160615033021.31330.5884.stgit@devbox> X-Mailer: git-send-email 2.1.0 In-Reply-To: <20160615032728.31330.45150.stgit@devbox> References: <20160615032728.31330.45150.stgit@devbox> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add for_each_probe_cache_entry() wrapper macro for hiding list in probe_cache. Signed-off-by: Masami Hiramatsu --- Changes in v10: - Splitted from "perf probe: Allow wildcard for cached events" --- tools/perf/util/probe-file.c | 8 ++++---- tools/perf/util/probe-file.h | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c index a6a2d60..503d7c2 100644 --- a/tools/perf/util/probe-file.c +++ b/tools/perf/util/probe-file.c @@ -546,7 +546,7 @@ probe_cache__find(struct probe_cache *pcache, struct perf_probe_event *pev) if (!cmd) return NULL; - list_for_each_entry(entry, &pcache->entries, node) { + for_each_probe_cache_entry(entry, pcache) { if (pev->sdt) { if (entry->pev.event && streql(entry->pev.event, pev->event) && @@ -576,7 +576,7 @@ probe_cache__find_by_name(struct probe_cache *pcache, { struct probe_cache_entry *entry = NULL; - list_for_each_entry(entry, &pcache->entries, node) { + for_each_probe_cache_entry(entry, pcache) { /* Hit if same event name or same command-string */ if (streql(entry->pev.group, group) && streql(entry->pev.event, event)) @@ -746,7 +746,7 @@ int probe_cache__commit(struct probe_cache *pcache) if (ret < 0) goto out; - list_for_each_entry(entry, &pcache->entries, node) { + for_each_probe_cache_entry(entry, pcache) { ret = probe_cache_entry__write(entry, pcache->fd); pr_debug("Cache committed: %d\n", ret); if (ret < 0) @@ -788,7 +788,7 @@ static int probe_cache__show_entries(struct probe_cache *pcache, { struct probe_cache_entry *entry; - list_for_each_entry(entry, &pcache->entries, node) { + for_each_probe_cache_entry(entry, pcache) { if (probe_cache_entry__compare(entry, filter)) printf("%s\n", entry->spev); } diff --git a/tools/perf/util/probe-file.h b/tools/perf/util/probe-file.h index b2b4c39..837f530 100644 --- a/tools/perf/util/probe-file.h +++ b/tools/perf/util/probe-file.h @@ -21,6 +21,8 @@ struct probe_cache { #define PF_FL_UPROBE 1 #define PF_FL_RW 2 +#define for_each_probe_cache_entry(entry, pcache) \ + list_for_each_entry(entry, &pcache->entries, node) /* probe-file.c depends on libelf */ #ifdef HAVE_LIBELF_SUPPORT