perf symbols: Clarify method to get DSO binary_type filename

Using dso__binary_type_file() make it look like this function will
return a file, not just its filename, so rename it to:

	dso__read_binary_type_filename()

to make its purpose clear, just like we have:

	dso__read_running_kernel_build_id()

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-vkf3upzrfrxtr01wueej4xw4@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 631d34b5
...@@ -28,8 +28,9 @@ char dso__symtab_origin(const struct dso *dso) ...@@ -28,8 +28,9 @@ char dso__symtab_origin(const struct dso *dso)
return origin[dso->symtab_type]; return origin[dso->symtab_type];
} }
int dso__binary_type_file(const struct dso *dso, enum dso_binary_type type, int dso__read_binary_type_filename(const struct dso *dso,
char *root_dir, char *filename, size_t size) enum dso_binary_type type,
char *root_dir, char *filename, size_t size)
{ {
char build_id_hex[BUILD_ID_SIZE * 2 + 1]; char build_id_hex[BUILD_ID_SIZE * 2 + 1];
int ret = 0; int ret = 0;
...@@ -137,19 +138,18 @@ int dso__binary_type_file(const struct dso *dso, enum dso_binary_type type, ...@@ -137,19 +138,18 @@ int dso__binary_type_file(const struct dso *dso, enum dso_binary_type type,
static int open_dso(struct dso *dso, struct machine *machine) static int open_dso(struct dso *dso, struct machine *machine)
{ {
char *root_dir = (char *) "";
char *name;
int fd; int fd;
char *root_dir = (char *)"";
char *name = malloc(PATH_MAX);
name = malloc(PATH_MAX);
if (!name) if (!name)
return -ENOMEM; return -ENOMEM;
if (machine) if (machine)
root_dir = machine->root_dir; root_dir = machine->root_dir;
if (dso__binary_type_file(dso, dso->data_type, if (dso__read_binary_type_filename(dso, dso->data_type,
root_dir, name, PATH_MAX)) { root_dir, name, PATH_MAX)) {
free(name); free(name);
return -EINVAL; return -EINVAL;
} }
......
...@@ -128,8 +128,8 @@ void dso__read_running_kernel_build_id(struct dso *dso, ...@@ -128,8 +128,8 @@ void dso__read_running_kernel_build_id(struct dso *dso,
int dso__kernel_module_get_build_id(struct dso *dso, const char *root_dir); int dso__kernel_module_get_build_id(struct dso *dso, const char *root_dir);
char dso__symtab_origin(const struct dso *dso); char dso__symtab_origin(const struct dso *dso);
int dso__binary_type_file(const struct dso *dso, enum dso_binary_type type, int dso__read_binary_type_filename(const struct dso *dso, enum dso_binary_type type,
char *root_dir, char *filename, size_t size); char *root_dir, char *filename, size_t size);
int dso__data_fd(struct dso *dso, struct machine *machine); int dso__data_fd(struct dso *dso, struct machine *machine);
ssize_t dso__data_read_offset(struct dso *dso, struct machine *machine, ssize_t dso__data_read_offset(struct dso *dso, struct machine *machine,
......
...@@ -1258,8 +1258,8 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter) ...@@ -1258,8 +1258,8 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter)
enum dso_binary_type symtab_type = binary_type_symtab[i]; enum dso_binary_type symtab_type = binary_type_symtab[i];
if (dso__binary_type_file(dso, symtab_type, if (dso__read_binary_type_filename(dso, symtab_type,
root_dir, name, PATH_MAX)) root_dir, name, PATH_MAX))
continue; continue;
/* Name is now the name of the next image to try */ /* Name is now the name of the next image to try */
......
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