perf map: Shorten map_groups__find_by_name() signature
tip-bot for Arnaldo Carvalho de Melo
merge botCommit-ID: 83cf774b028fa67acfdd0176d54aa9387c2ad10d Gitweb: https://git.kernel.org/tip/83cf774b028fa67acfdd0176d54aa9387c2ad10d Author: Arnaldo Carvalho de Melo <[email protected]> AuthorDate: Tue, 24 Apr 2018 12:16:09 -0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Thu, 26 Apr 2018 13:47:09 -0300
perf map: Shorten map_groups__find_by_name() signature
Another step in the road to elliminate the MAP_{FUNCTION,VARIABLE} separation, reducing the exposure to these details in the tools using the symbol APIs.
Cc Adrian Hunter <[email protected]>
Cc David Ahern <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Wang Nan <[email protected]>
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
--- tools/perf/tests/vmlinux-kallsyms.c | 2 +- tools/perf/util/machine.c | 6 ++---- tools/perf/util/map.h | 8 ++++++-- tools/perf/util/probe-event.c | 2 +- tools/perf/util/symbol-elf.c | 2 +- tools/perf/util/symbol.c | 6 ++---- 6 files changed, 13 insertions(+), 13 deletions(-)
tools/perf/tests/vmlinux-kallsyms.c +1 -1
@@ -183,7 +183,7 @@ next_pair:* so use the short name, less descriptive but the same ("[kernel]" in * both cases. */ - pair =map_groups__find_by_name (&kallsyms.kmaps, type, + pair =map_groups__find_by_name (&kallsyms.kmaps, (map->dso->kernel ? map->dso->short_name : map->dso->name));
tools/perf/util/machine.c +2 -4
@@ -673,8 +673,7 @@ struct map *machine__findnew_module_map(struct machine *machine, u64 start,if (kmod_path__parse_name (&m, filename))return NULL ; - map =map_groups__find_by_name (&machine->kmaps,MAP__FUNCTION , - m.name); + map =map_groups__find_by_name (&machine->kmaps, m.name);if (map) {/* * If the map's dso is an offline module, give dso__load()
@@ -1055,10 +1054,9 @@ static bool is_kmod_dso(struct dso *dso)static int map_groups__set_module_path (struct map_groups *mg,const char *path,struct kmod_path *m) { -struct map *map;char *long_name; +struct map *map =map_groups__find_by_name (mg, m->name); - map =map_groups__find_by_name (mg,MAP__FUNCTION , m->name);if (map ==NULL )return 0 ;
tools/perf/util/map.h +6 -2
@@ -254,8 +254,12 @@ struct symbol *map_groups__find_function_by_name(struct map_groups *mg,int map_groups__fixup_overlappings (struct map_groups *mg,struct map *map,FILE *fp); -struct map *map_groups__find_by_name (struct map_groups *mg, -enum map_type type,const char *name); +struct map *__map_groups__find_by_name (struct map_groups *mg,enum map_type type,const char *name); + +static inline struct map *map_groups__find_by_name (struct map_groups *mg,const char *name) +{ +return __map_groups__find_by_name (mg,MAP__FUNCTION , name); +}bool __map__is_kernel (const struct map *map);
tools/perf/util/probe-event.c +1 -1
@@ -341,7 +341,7 @@ static int kernel_get_module_dso(const char *module, struct dso **pdso)char module_name[128 ];snprintf (module_name,sizeof (module_name),"[%s]" , module); - map =map_groups__find_by_name (&host_machine->kmaps,MAP__FUNCTION , module_name); + map =map_groups__find_by_name (&host_machine->kmaps, module_name);if (map) { dso = map->dso; goto found;
tools/perf/util/symbol-elf.c +1 -1
@@ -1042,7 +1042,7 @@ int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss,snprintf (dso_name,sizeof (dso_name),"%s%s" , dso->short_name, section_name); - curr_map =map_groups__find_by_name (kmaps, map->type, dso_name); + curr_map =__map_groups__find_by_name (kmaps, map->type, dso_name);if (curr_map ==NULL ) {u64 start = sym.st_value;
tools/perf/util/symbol.c +2 -4
@@ -792,8 +792,7 @@ static int dso__split_kallsyms(struct dso *dso, struct map *map, u64 delta) curr_map->type); } - curr_map =map_groups__find_by_name (kmaps, - map->type, module); + curr_map =__map_groups__find_by_name (kmaps, map->type, module);if (curr_map ==NULL ) {pr_debug ("%s/proc/{kallsyms,modules} " "inconsistency while looking "
@@ -1667,8 +1666,7 @@ out:return ret; } -struct map *map_groups__find_by_name (struct map_groups *mg, -enum map_type type,const char *name) +struct map *__map_groups__find_by_name (struct map_groups *mg,enum map_type type,const char *name) {struct maps *maps = &mg->maps[type];struct map *map;