Commit 2cf07b29 authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

libperf: Add 'fd' to struct perf_mmap

Move 'fd' from tools/perf's mmap to libperf's perf_mmap struct.
Signed-off-by: default avatarJiri 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.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 4fd0cef2
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
struct perf_mmap { struct perf_mmap {
void *base; void *base;
int mask; int mask;
int fd;
}; };
#endif /* __LIBPERF_INTERNAL_MMAP_H */ #endif /* __LIBPERF_INTERNAL_MMAP_H */
...@@ -652,7 +652,7 @@ static int perf_evlist__set_paused(struct evlist *evlist, bool value) ...@@ -652,7 +652,7 @@ static int perf_evlist__set_paused(struct evlist *evlist, bool value)
return 0; return 0;
for (i = 0; i < evlist->nr_mmaps; i++) { 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; int err;
if (fd < 0) if (fd < 0)
...@@ -708,7 +708,7 @@ static struct mmap *evlist__alloc_mmap(struct evlist *evlist, ...@@ -708,7 +708,7 @@ static struct mmap *evlist__alloc_mmap(struct evlist *evlist,
return NULL; return NULL;
for (i = 0; i < evlist->nr_mmaps; i++) { for (i = 0; i < evlist->nr_mmaps; i++) {
map[i].fd = -1; map[i].core.fd = -1;
map[i].overwrite = overwrite; map[i].overwrite = overwrite;
/* /*
* When the perf_mmap() call is made we grab one refcount, plus * When the perf_mmap() call is made we grab one refcount, plus
......
...@@ -320,7 +320,7 @@ void perf_mmap__munmap(struct mmap *map) ...@@ -320,7 +320,7 @@ void perf_mmap__munmap(struct mmap *map)
if (map->core.base != NULL) { if (map->core.base != NULL) {
munmap(map->core.base, perf_mmap__mmap_len(map)); munmap(map->core.base, perf_mmap__mmap_len(map));
map->core.base = NULL; map->core.base = NULL;
map->fd = -1; map->core.fd = -1;
refcount_set(&map->refcnt, 0); refcount_set(&map->refcnt, 0);
} }
auxtrace_mmap__munmap(&map->auxtrace_mmap); 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) ...@@ -378,7 +378,7 @@ int perf_mmap__mmap(struct mmap *map, struct mmap_params *mp, int fd, int cpu)
map->core.base = NULL; map->core.base = NULL;
return -1; return -1;
} }
map->fd = fd; map->core.fd = fd;
map->cpu = cpu; map->cpu = cpu;
perf_mmap__setup_affinity_mask(map, mp); perf_mmap__setup_affinity_mask(map, mp);
......
...@@ -22,7 +22,6 @@ struct aiocb; ...@@ -22,7 +22,6 @@ struct aiocb;
*/ */
struct mmap { struct mmap {
struct perf_mmap core; struct perf_mmap core;
int fd;
int cpu; int cpu;
refcount_t refcnt; refcount_t refcnt;
u64 prev; u64 prev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment