Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-8a1hvrqe3r5i0kw865u3uxwt@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+13 -13
+1 -1
tools/perf/tests/vmlinux-kallsyms.c
··· 183 183 * so use the short name, less descriptive but the same ("[kernel]" in 184 184 * both cases. 185 185 */ 186 - pair = map_groups__find_by_name(&kallsyms.kmaps, type, 186 + pair = map_groups__find_by_name(&kallsyms.kmaps, 187 187 (map->dso->kernel ? 188 188 map->dso->short_name : 189 189 map->dso->name));
+2 -4
tools/perf/util/machine.c
··· 673 673 if (kmod_path__parse_name(&m, filename)) 674 674 return NULL; 675 675 676 - map = map_groups__find_by_name(&machine->kmaps, MAP__FUNCTION, 677 - m.name); 676 + map = map_groups__find_by_name(&machine->kmaps, m.name); 678 677 if (map) { 679 678 /* 680 679 * If the map's dso is an offline module, give dso__load() ··· 1054 1055 static int map_groups__set_module_path(struct map_groups *mg, const char *path, 1055 1056 struct kmod_path *m) 1056 1057 { 1057 - struct map *map; 1058 1058 char *long_name; 1059 + struct map *map = map_groups__find_by_name(mg, m->name); 1059 1060 1060 - map = map_groups__find_by_name(mg, MAP__FUNCTION, m->name); 1061 1061 if (map == NULL) 1062 1062 return 0; 1063 1063
+6 -2
tools/perf/util/map.h
··· 254 254 int map_groups__fixup_overlappings(struct map_groups *mg, struct map *map, 255 255 FILE *fp); 256 256 257 - struct map *map_groups__find_by_name(struct map_groups *mg, 258 - enum map_type type, const char *name); 257 + struct map *__map_groups__find_by_name(struct map_groups *mg, enum map_type type, const char *name); 258 + 259 + static inline struct map *map_groups__find_by_name(struct map_groups *mg, const char *name) 260 + { 261 + return __map_groups__find_by_name(mg, MAP__FUNCTION, name); 262 + } 259 263 260 264 bool __map__is_kernel(const struct map *map); 261 265
+1 -1
tools/perf/util/probe-event.c
··· 341 341 char module_name[128]; 342 342 343 343 snprintf(module_name, sizeof(module_name), "[%s]", module); 344 - map = map_groups__find_by_name(&host_machine->kmaps, MAP__FUNCTION, module_name); 344 + map = map_groups__find_by_name(&host_machine->kmaps, module_name); 345 345 if (map) { 346 346 dso = map->dso; 347 347 goto found;
+1 -1
tools/perf/util/symbol-elf.c
··· 1042 1042 snprintf(dso_name, sizeof(dso_name), 1043 1043 "%s%s", dso->short_name, section_name); 1044 1044 1045 - curr_map = map_groups__find_by_name(kmaps, map->type, dso_name); 1045 + curr_map = __map_groups__find_by_name(kmaps, map->type, dso_name); 1046 1046 if (curr_map == NULL) { 1047 1047 u64 start = sym.st_value; 1048 1048
+2 -4
tools/perf/util/symbol.c
··· 792 792 curr_map->type); 793 793 } 794 794 795 - curr_map = map_groups__find_by_name(kmaps, 796 - map->type, module); 795 + curr_map = __map_groups__find_by_name(kmaps, map->type, module); 797 796 if (curr_map == NULL) { 798 797 pr_debug("%s/proc/{kallsyms,modules} " 799 798 "inconsistency while looking " ··· 1666 1667 return ret; 1667 1668 } 1668 1669 1669 - struct map *map_groups__find_by_name(struct map_groups *mg, 1670 - enum map_type type, const char *name) 1670 + struct map *__map_groups__find_by_name(struct map_groups *mg, enum map_type type, const char *name) 1671 1671 { 1672 1672 struct maps *maps = &mg->maps[type]; 1673 1673 struct map *map;