Skip to content

Commit

Permalink
libperf: Add 'fd' to struct perf_mmap
Browse files Browse the repository at this point in the history
Move 'fd' from tools/perf's mmap to libperf's perf_mmap struct.

Signed-off-by: Jiri Olsa <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Michael Petlan <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lore.kernel.org/lkml/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
olsajiri authored and acmel committed Sep 25, 2019
1 parent 4fd0cef commit 2cf07b2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions tools/perf/lib/include/internal/mmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
struct perf_mmap {
void *base;
int mask;
int fd;
};

#endif /* __LIBPERF_INTERNAL_MMAP_H */
4 changes: 2 additions & 2 deletions tools/perf/util/evlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tools/perf/util/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion tools/perf/util/mmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ struct aiocb;
*/
struct mmap {
struct perf_mmap core;
int fd;
int cpu;
refcount_t refcnt;
u64 prev;
Expand Down

0 comments on commit 2cf07b2

Please sign in to comment.