perf maps: Add for_each_entry()/_safe() iterators
To reduce boilerplate, provide a more compact form using an idiom present in other trees of data structures. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Link: https://lkml.kernel.org/n/tip-59gmq4kg1r68ou1wknyjl78x@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
@@ -182,7 +182,7 @@ next_pair:
|
||||
|
||||
header_printed = false;
|
||||
|
||||
for (map = maps__first(maps); map; map = map__next(map)) {
|
||||
maps__for_each_entry(maps, map) {
|
||||
struct map *
|
||||
/*
|
||||
* If it is the kernel, kallsyms is always "[kernel.kallsyms]", while
|
||||
@@ -207,7 +207,7 @@ next_pair:
|
||||
|
||||
header_printed = false;
|
||||
|
||||
for (map = maps__first(maps); map; map = map__next(map)) {
|
||||
maps__for_each_entry(maps, map) {
|
||||
struct map *pair;
|
||||
|
||||
mem_start = vmlinux_map->unmap_ip(vmlinux_map, map->start);
|
||||
@@ -237,7 +237,7 @@ next_pair:
|
||||
|
||||
maps = machine__kernel_maps(&kallsyms);
|
||||
|
||||
for (map = maps__first(maps); map; map = map__next(map)) {
|
||||
maps__for_each_entry(maps, map) {
|
||||
if (!map->priv) {
|
||||
if (!header_printed) {
|
||||
pr_info("WARN: Maps only in kallsyms:\n");
|
||||
|
Reference in New Issue
Block a user