[PATCH 08/36] perf tools: Use perf_mmap way to detect aux mmap

From: Jiri Olsa
Date: Mon Oct 07 2019 - 08:58:20 EST


We will move this code to libperf shortly, so we need to free it of
'struct auxtrace_mmap' usage, because it won't be available in libperf
(for now).

The perf_event_mmap_page::aux_size is set when the aux mmap is mapped,
so the check is equivalent.

Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
Cc: Michael Petlan <mpetlan@xxxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Link: http://lore.kernel.org/lkml/20190913132355.21634-48-jolsa@xxxxxxxxxx
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/perf/util/mmap.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c
index 9f150d50cea5..f246dd403507 100644
--- a/tools/perf/util/mmap.c
+++ b/tools/perf/util/mmap.c
@@ -107,7 +107,9 @@ union perf_event *perf_mmap__read_event(struct mmap *map)

static bool perf_mmap__empty(struct mmap *map)
{
- return perf_mmap__read_head(map) == map->core.prev && !map->auxtrace_mmap.base;
+ struct perf_event_mmap_page *pc = map->core.base;
+
+ return perf_mmap__read_head(map) == map->core.prev && !pc->aux_size;
}

void perf_mmap__consume(struct mmap *map)
--
2.21.0