Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf probe-cache: Add for_each_probe_cache_entry() wrapper

Add for_each_probe_cache_entry() wrapper macro for hiding list in
probe_cache.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/146831790386.17065.15082256697569419710.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Masami Hiramatsu and committed by
Arnaldo Carvalho de Melo
05bf2c8a c3492a3a

+6 -4
+4 -4
tools/perf/util/probe-file.c
··· 546 546 if (!cmd) 547 547 return NULL; 548 548 549 - list_for_each_entry(entry, &pcache->entries, node) { 549 + for_each_probe_cache_entry(entry, pcache) { 550 550 if (pev->sdt) { 551 551 if (entry->pev.event && 552 552 streql(entry->pev.event, pev->event) && ··· 576 576 { 577 577 struct probe_cache_entry *entry = NULL; 578 578 579 - list_for_each_entry(entry, &pcache->entries, node) { 579 + for_each_probe_cache_entry(entry, pcache) { 580 580 /* Hit if same event name or same command-string */ 581 581 if (streql(entry->pev.group, group) && 582 582 streql(entry->pev.event, event)) ··· 748 748 if (ret < 0) 749 749 goto out; 750 750 751 - list_for_each_entry(entry, &pcache->entries, node) { 751 + for_each_probe_cache_entry(entry, pcache) { 752 752 ret = probe_cache_entry__write(entry, pcache->fd); 753 753 pr_debug("Cache committed: %d\n", ret); 754 754 if (ret < 0) ··· 790 790 { 791 791 struct probe_cache_entry *entry; 792 792 793 - list_for_each_entry(entry, &pcache->entries, node) { 793 + for_each_probe_cache_entry(entry, pcache) { 794 794 if (probe_cache_entry__compare(entry, filter)) 795 795 printf("%s\n", entry->spev); 796 796 }
+2
tools/perf/util/probe-file.h
··· 21 21 22 22 #define PF_FL_UPROBE 1 23 23 #define PF_FL_RW 2 24 + #define for_each_probe_cache_entry(entry, pcache) \ 25 + list_for_each_entry(entry, &pcache->entries, node) 24 26 25 27 int probe_file__open(int flag); 26 28 int probe_file__open_both(int *kfd, int *ufd, int flag);