libperf: Add 'fd' to struct perf_mmap
authorJiri Olsa <jolsa@kernel.org>
Sat, 27 Jul 2019 20:31:17 +0000 (22:31 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 25 Sep 2019 12:51:45 +0000 (09:51 -0300)
Move 'fd' from tools/perf's mmap to libperf's perf_mmap struct.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lore.kernel.org/lkml/20190913132355.21634-13-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/lib/include/internal/mmap.h
tools/perf/util/evlist.c
tools/perf/util/mmap.c
tools/perf/util/mmap.h

index 1caa1e8ee5c616315e408559c5795e8b615c3645..892cbd401d8d718782b8ec53922169f67f520a2b 100644 (file)
@@ -10,6 +10,7 @@
 struct perf_mmap {
        void            *base;
        int              mask;
+       int              fd;
 };
 
 #endif /* __LIBPERF_INTERNAL_MMAP_H */
index f700dbe043b7f0ac440eabafc7bcb88f036ef0b4..a4e1c19c969f14ba1186e19b3219b8e2ef98ea91 100644 (file)
@@ -652,7 +652,7 @@ static int perf_evlist__set_paused(struct evlist *evlist, bool value)
                return 0;
 
        for (i = 0; i < evlist->nr_mmaps; i++) {
-               int fd = evlist->overwrite_mmap[i].fd;
+               int fd = evlist->overwrite_mmap[i].core.fd;
                int err;
 
                if (fd < 0)
@@ -708,7 +708,7 @@ static struct mmap *evlist__alloc_mmap(struct evlist *evlist,
                return NULL;
 
        for (i = 0; i < evlist->nr_mmaps; i++) {
-               map[i].fd = -1;
+               map[i].core.fd = -1;
                map[i].overwrite = overwrite;
                /*
                 * When the perf_mmap() call is made we grab one refcount, plus
index 702e8e0b90ea5cf6079dcb4b2bbb2d0a61605e93..40bf124cb6581b00fdccce47007f705c09c1d9ef 100644 (file)
@@ -320,7 +320,7 @@ void perf_mmap__munmap(struct mmap *map)
        if (map->core.base != NULL) {
                munmap(map->core.base, perf_mmap__mmap_len(map));
                map->core.base = NULL;
-               map->fd = -1;
+               map->core.fd = -1;
                refcount_set(&map->refcnt, 0);
        }
        auxtrace_mmap__munmap(&map->auxtrace_mmap);
@@ -378,7 +378,7 @@ int perf_mmap__mmap(struct mmap *map, struct mmap_params *mp, int fd, int cpu)
                map->core.base = NULL;
                return -1;
        }
-       map->fd = fd;
+       map->core.fd = fd;
        map->cpu = cpu;
 
        perf_mmap__setup_affinity_mask(map, mp);
index 370138e395fc0c5c38b9051ef68efbd0e2ff1927..de991194af8db1f62f2f7f268f2827e1b0ea6f30 100644 (file)
@@ -22,7 +22,6 @@ struct aiocb;
  */
 struct mmap {
        struct perf_mmap        core;
-       int              fd;
        int              cpu;
        refcount_t       refcnt;
        u64              prev;