perf map: Pass a dso_id to map__new()

Instead of the 4 fields, a step in the direction of moving this to
struct dso.

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-gp5s1xgxacurmih5d1l94ymy@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 99459a84
...@@ -1651,6 +1651,12 @@ int machine__process_mmap2_event(struct machine *machine, ...@@ -1651,6 +1651,12 @@ int machine__process_mmap2_event(struct machine *machine,
{ {
struct thread *thread; struct thread *thread;
struct map *map; struct map *map;
struct dso_id dso_id = {
.maj = event->mmap2.maj,
.min = event->mmap2.min,
.ino = event->mmap2.ino,
.ino_generation = event->mmap2.ino_generation,
};
int ret = 0; int ret = 0;
if (dump_trace) if (dump_trace)
...@@ -1671,10 +1677,7 @@ int machine__process_mmap2_event(struct machine *machine, ...@@ -1671,10 +1677,7 @@ int machine__process_mmap2_event(struct machine *machine,
map = map__new(machine, event->mmap2.start, map = map__new(machine, event->mmap2.start,
event->mmap2.len, event->mmap2.pgoff, event->mmap2.len, event->mmap2.pgoff,
event->mmap2.maj, &dso_id, event->mmap2.prot,
event->mmap2.min, event->mmap2.ino,
event->mmap2.ino_generation,
event->mmap2.prot,
event->mmap2.flags, event->mmap2.flags,
event->mmap2.filename, thread); event->mmap2.filename, thread);
...@@ -1727,9 +1730,7 @@ int machine__process_mmap_event(struct machine *machine, union perf_event *event ...@@ -1727,9 +1730,7 @@ int machine__process_mmap_event(struct machine *machine, union perf_event *event
map = map__new(machine, event->mmap.start, map = map__new(machine, event->mmap.start,
event->mmap.len, event->mmap.pgoff, event->mmap.len, event->mmap.pgoff,
0, 0, 0, 0, prot, 0, NULL, prot, 0, event->mmap.filename, thread);
event->mmap.filename,
thread);
if (map == NULL) if (map == NULL)
goto out_problem_map; goto out_problem_map;
......
...@@ -144,8 +144,8 @@ void map__init(struct map *map, u64 start, u64 end, u64 pgoff, struct dso *dso) ...@@ -144,8 +144,8 @@ void map__init(struct map *map, u64 start, u64 end, u64 pgoff, struct dso *dso)
} }
struct map *map__new(struct machine *machine, u64 start, u64 len, struct map *map__new(struct machine *machine, u64 start, u64 len,
u64 pgoff, u32 d_maj, u32 d_min, u64 ino, u64 pgoff, struct dso_id *id,
u64 ino_gen, u32 prot, u32 flags, char *filename, u32 prot, u32 flags, char *filename,
struct thread *thread) struct thread *thread)
{ {
struct map *map = malloc(sizeof(*map)); struct map *map = malloc(sizeof(*map));
...@@ -162,10 +162,11 @@ struct map *map__new(struct machine *machine, u64 start, u64 len, ...@@ -162,10 +162,11 @@ struct map *map__new(struct machine *machine, u64 start, u64 len,
vdso = is_vdso_map(filename); vdso = is_vdso_map(filename);
no_dso = is_no_dso_memory(filename); no_dso = is_no_dso_memory(filename);
map->dso_id.maj = d_maj; if (id)
map->dso_id.min = d_min; map->dso_id = *id;
map->dso_id.ino = ino; else
map->dso_id.ino_generation = ino_gen; map->dso_id.min = map->dso_id.ino = map->dso_id.ino_generation = 0;
map->prot = prot; map->prot = prot;
map->flags = flags; map->flags = flags;
nsi = nsinfo__get(thread->nsinfo); nsi = nsinfo__get(thread->nsinfo);
......
...@@ -117,8 +117,7 @@ struct thread; ...@@ -117,8 +117,7 @@ struct thread;
void map__init(struct map *map, void map__init(struct map *map,
u64 start, u64 end, u64 pgoff, struct dso *dso); u64 start, u64 end, u64 pgoff, struct dso *dso);
struct map *map__new(struct machine *machine, u64 start, u64 len, struct map *map__new(struct machine *machine, u64 start, u64 len,
u64 pgoff, u32 d_maj, u32 d_min, u64 ino, u64 pgoff, struct dso_id *id, u32 prot, u32 flags,
u64 ino_gen, u32 prot, u32 flags,
char *filename, struct thread *thread); char *filename, struct thread *thread);
struct map *map__new2(u64 start, struct dso *dso); struct map *map__new2(u64 start, struct dso *dso);
void map__delete(struct map *map); void map__delete(struct map *map);
......
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