Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9f2de315 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 457ae94a
Loading
Loading
Loading
Loading
+9 −9
Original line number Original line Diff line number Diff line
@@ -490,8 +490,8 @@ int machine__process_lost_samples_event(struct machine *machine __maybe_unused,
	return 0;
	return 0;
}
}


static struct dso*
static struct dso *machine__findnew_module_dso(struct machine *machine,
machine__module_dso(struct machine *machine, struct kmod_path *m,
					       struct kmod_path *m,
					       const char *filename)
					       const char *filename)
{
{
	struct dso *dso;
	struct dso *dso;
@@ -534,7 +534,7 @@ int machine__process_itrace_start_event(struct machine *machine __maybe_unused,
	return 0;
	return 0;
}
}


struct map *machine__new_module(struct machine *machine, u64 start,
struct map *machine__findnew_module_map(struct machine *machine, u64 start,
					const char *filename)
					const char *filename)
{
{
	struct map *map = NULL;
	struct map *map = NULL;
@@ -549,7 +549,7 @@ struct map *machine__new_module(struct machine *machine, u64 start,
	if (map)
	if (map)
		goto out;
		goto out;


	dso = machine__module_dso(machine, &m, filename);
	dso = machine__findnew_module_dso(machine, &m, filename);
	if (dso == NULL)
	if (dso == NULL)
		goto out;
		goto out;


@@ -1017,7 +1017,7 @@ static int machine__create_module(void *arg, const char *name, u64 start)
	struct machine *machine = arg;
	struct machine *machine = arg;
	struct map *map;
	struct map *map;


	map = machine__new_module(machine, start, name);
	map = machine__findnew_module_map(machine, start, name);
	if (map == NULL)
	if (map == NULL)
		return -1;
		return -1;


@@ -1140,7 +1140,7 @@ static int machine__process_kernel_mmap_event(struct machine *machine,
				strlen(kmmap_prefix) - 1) == 0;
				strlen(kmmap_prefix) - 1) == 0;
	if (event->mmap.filename[0] == '/' ||
	if (event->mmap.filename[0] == '/' ||
	    (!is_kernel_mmap && event->mmap.filename[0] == '[')) {
	    (!is_kernel_mmap && event->mmap.filename[0] == '[')) {
		map = machine__new_module(machine, event->mmap.start,
		map = machine__findnew_module_map(machine, event->mmap.start,
						  event->mmap.filename);
						  event->mmap.filename);
		if (map == NULL)
		if (map == NULL)
			goto out_problem;
			goto out_problem;
+2 −2
Original line number Original line Diff line number Diff line
@@ -189,7 +189,7 @@ struct symbol *machine__find_kernel_function_by_name(struct machine *machine,
						 filter);
						 filter);
}
}


struct map *machine__new_module(struct machine *machine, u64 start,
struct map *machine__findnew_module_map(struct machine *machine, u64 start,
					const char *filename);
					const char *filename);


int machine__load_kallsyms(struct machine *machine, const char *filename,
int machine__load_kallsyms(struct machine *machine, const char *filename,
+1 −1
Original line number Original line Diff line number Diff line
@@ -168,7 +168,7 @@ static struct map *kernel_get_module_map(const char *module)


	/* A file path -- this is an offline module */
	/* A file path -- this is an offline module */
	if (module && strchr(module, '/'))
	if (module && strchr(module, '/'))
		return machine__new_module(host_machine, 0, module);
		return machine__findnew_module_map(host_machine, 0, module);


	if (!module)
	if (!module)
		module = "kernel";
		module = "kernel";
+1 −1
Original line number Original line Diff line number Diff line
@@ -1364,7 +1364,7 @@ static bool dso__is_compatible_symtab_type(struct dso *dso, bool kmod,
	case DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP:
	case DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP:
		/*
		/*
		 * kernel modules know their symtab type - it's set when
		 * kernel modules know their symtab type - it's set when
		 * creating a module dso in machine__new_module().
		 * creating a module dso in machine__findnew_module_map().
		 */
		 */
		return kmod && dso->symtab_type == type;
		return kmod && dso->symtab_type == type;