aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2015-06-01 11:01:02 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-06-08 09:31:34 -0400
commit9f2de31542f1ac38a15117f90ee6b8449951d86e (patch)
treef16cf299c26559b8fcfdee3e9a76122a9dd78a4b
parent457ae94ae047330e75c13f28ead6de31eab245ed (diff)
perf machine: Fix up some more method names
Calling the function 'machine__new_module' implies a new 'module' will be allocated, when in fact what is returned is a 'struct map' instance, that not necessarily will be instantiated, as if one already exists with the given module name, it will be returned instead. So be consistent with other "find and if not there, create" like functions, like machine__findnew_thread, machine__findnew_dso, etc, and rename it to machine__findnew_module_map(), that in turn will call machine__findnew_module_dso(). Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/n/tip-acv830vd3hwww2ih5vjtbmu3@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/util/machine.c18
-rw-r--r--tools/perf/util/machine.h4
-rw-r--r--tools/perf/util/probe-event.c2
-rw-r--r--tools/perf/util/symbol.c2
4 files changed, 13 insertions, 13 deletions
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index f15ed24a22ac..dfd419797e6e 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -490,9 +490,9 @@ int machine__process_lost_samples_event(struct machine *machine __maybe_unused,
490 return 0; 490 return 0;
491} 491}
492 492
493static struct dso* 493static struct dso *machine__findnew_module_dso(struct machine *machine,
494machine__module_dso(struct machine *machine, struct kmod_path *m, 494 struct kmod_path *m,
495 const char *filename) 495 const char *filename)
496{ 496{
497 struct dso *dso; 497 struct dso *dso;
498 498
@@ -534,8 +534,8 @@ int machine__process_itrace_start_event(struct machine *machine __maybe_unused,
534 return 0; 534 return 0;
535} 535}
536 536
537struct map *machine__new_module(struct machine *machine, u64 start, 537struct map *machine__findnew_module_map(struct machine *machine, u64 start,
538 const char *filename) 538 const char *filename)
539{ 539{
540 struct map *map = NULL; 540 struct map *map = NULL;
541 struct dso *dso; 541 struct dso *dso;
@@ -549,7 +549,7 @@ struct map *machine__new_module(struct machine *machine, u64 start,
549 if (map) 549 if (map)
550 goto out; 550 goto out;
551 551
552 dso = machine__module_dso(machine, &m, filename); 552 dso = machine__findnew_module_dso(machine, &m, filename);
553 if (dso == NULL) 553 if (dso == NULL)
554 goto out; 554 goto out;
555 555
@@ -1017,7 +1017,7 @@ static int machine__create_module(void *arg, const char *name, u64 start)
1017 struct machine *machine = arg; 1017 struct machine *machine = arg;
1018 struct map *map; 1018 struct map *map;
1019 1019
1020 map = machine__new_module(machine, start, name); 1020 map = machine__findnew_module_map(machine, start, name);
1021 if (map == NULL) 1021 if (map == NULL)
1022 return -1; 1022 return -1;
1023 1023
@@ -1140,8 +1140,8 @@ static int machine__process_kernel_mmap_event(struct machine *machine,
1140 strlen(kmmap_prefix) - 1) == 0; 1140 strlen(kmmap_prefix) - 1) == 0;
1141 if (event->mmap.filename[0] == '/' || 1141 if (event->mmap.filename[0] == '/' ||
1142 (!is_kernel_mmap && event->mmap.filename[0] == '[')) { 1142 (!is_kernel_mmap && event->mmap.filename[0] == '[')) {
1143 map = machine__new_module(machine, event->mmap.start, 1143 map = machine__findnew_module_map(machine, event->mmap.start,
1144 event->mmap.filename); 1144 event->mmap.filename);
1145 if (map == NULL) 1145 if (map == NULL)
1146 goto out_problem; 1146 goto out_problem;
1147 1147
diff --git a/tools/perf/util/machine.h b/tools/perf/util/machine.h
index 8e1f796fd137..ca267c41f28d 100644
--- a/tools/perf/util/machine.h
+++ b/tools/perf/util/machine.h
@@ -189,8 +189,8 @@ struct symbol *machine__find_kernel_function_by_name(struct machine *machine,
189 filter); 189 filter);
190} 190}
191 191
192struct map *machine__new_module(struct machine *machine, u64 start, 192struct map *machine__findnew_module_map(struct machine *machine, u64 start,
193 const char *filename); 193 const char *filename);
194 194
195int machine__load_kallsyms(struct machine *machine, const char *filename, 195int machine__load_kallsyms(struct machine *machine, const char *filename,
196 enum map_type type, symbol_filter_t filter); 196 enum map_type type, symbol_filter_t filter);
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index e6f215b7a052..d4cf50b91839 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -168,7 +168,7 @@ static struct map *kernel_get_module_map(const char *module)
168 168
169 /* A file path -- this is an offline module */ 169 /* A file path -- this is an offline module */
170 if (module && strchr(module, '/')) 170 if (module && strchr(module, '/'))
171 return machine__new_module(host_machine, 0, module); 171 return machine__findnew_module_map(host_machine, 0, module);
172 172
173 if (!module) 173 if (!module)
174 module = "kernel"; 174 module = "kernel";
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index a3e80d6ad70a..eaee5d32d39d 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1364,7 +1364,7 @@ static bool dso__is_compatible_symtab_type(struct dso *dso, bool kmod,
1364 case DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP: 1364 case DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP:
1365 /* 1365 /*
1366 * kernel modules know their symtab type - it's set when 1366 * kernel modules know their symtab type - it's set when
1367 * creating a module dso in machine__new_module(). 1367 * creating a module dso in machine__findnew_module_map().
1368 */ 1368 */
1369 return kmod && dso->symtab_type == type; 1369 return kmod && dso->symtab_type == type;
1370 1370