Skip to content

Commit ee4e962

Browse files
committed
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.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 631d34b commit ee4e962

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

‎tools/perf/util/dso.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ char dso__symtab_origin(const struct dso *dso)
2828
return origin[dso->symtab_type];
2929
}
3030

31-
int dso__binary_type_file(const struct dso *dso, enum dso_binary_type type,
32-
char *root_dir, char *filename, size_t size)
31+
int dso__read_binary_type_filename(const struct dso *dso,
32+
enum dso_binary_type type,
33+
char *root_dir, char *filename, size_t size)
3334
{
3435
char build_id_hex[BUILD_ID_SIZE * 2 + 1];
3536
int ret = 0;
@@ -137,19 +138,18 @@ int dso__binary_type_file(const struct dso *dso, enum dso_binary_type type,
137138

138139
static int open_dso(struct dso *dso, struct machine *machine)
139140
{
140-
char *root_dir = (char *) "";
141-
char *name;
142141
int fd;
142+
char *root_dir = (char *)"";
143+
char *name = malloc(PATH_MAX);
143144

144-
name = malloc(PATH_MAX);
145145
if (!name)
146146
return -ENOMEM;
147147

148148
if (machine)
149149
root_dir = machine->root_dir;
150150

151-
if (dso__binary_type_file(dso, dso->data_type,
152-
root_dir, name, PATH_MAX)) {
151+
if (dso__read_binary_type_filename(dso, dso->data_type,
152+
root_dir, name, PATH_MAX)) {
153153
free(name);
154154
return -EINVAL;
155155
}

‎tools/perf/util/dso.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ void dso__read_running_kernel_build_id(struct dso *dso,
128128
int dso__kernel_module_get_build_id(struct dso *dso, const char *root_dir);
129129

130130
char dso__symtab_origin(const struct dso *dso);
131-
int dso__binary_type_file(const struct dso *dso, enum dso_binary_type type,
132-
char *root_dir, char *filename, size_t size);
131+
int dso__read_binary_type_filename(const struct dso *dso, enum dso_binary_type type,
132+
char *root_dir, char *filename, size_t size);
133133

134134
int dso__data_fd(struct dso *dso, struct machine *machine);
135135
ssize_t dso__data_read_offset(struct dso *dso, struct machine *machine,

‎tools/perf/util/symbol.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,8 +1258,8 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter)
12581258

12591259
enum dso_binary_type symtab_type = binary_type_symtab[i];
12601260

1261-
if (dso__binary_type_file(dso, symtab_type,
1262-
root_dir, name, PATH_MAX))
1261+
if (dso__read_binary_type_filename(dso, symtab_type,
1262+
root_dir, name, PATH_MAX))
12631263
continue;
12641264

12651265
/* Name is now the name of the next image to try */

0 commit comments

Comments
 (0)