summaryrefslogtreecommitdiff
path: root/tools/perf/util/dso.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2020-10-13 21:24:33 +0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2020-10-14 08:44:47 -0300
commit0aba7f036a56675b7fdc536757b4c49fc76a2208 (patch)
tree02ec0c96f9e8f6d50aeaad0f29ea67ef0b0fd1a9 /tools/perf/util/dso.c
parent79bbbabd227897745786e81ed814ad86c5e1295d (diff)
perf tools: Use build_id object in dso
Replace build_id byte array with struct build_id object and all the code that references it. The objective is to carry size together with build id array, so it's better to keep both together. This is preparatory change for following patches, and there's no functional change. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Acked-by: Ian Rogers <irogers@google.com> Link: https://lore.kernel.org/r/20201013192441.1299447-2-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/dso.c')
-rw-r--r--tools/perf/util/dso.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 5a3b4755f0b3..d2c1ed08c879 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -172,8 +172,8 @@ int dso__read_binary_type_filename(const struct dso *dso,
break;
}
- build_id__sprintf(dso->build_id,
- sizeof(dso->build_id),
+ build_id__sprintf(dso->bid.data,
+ sizeof(dso->bid.data),
build_id_hex);
len = __symbol__join_symfs(filename, size, "/usr/lib/debug/.build-id/");
snprintf(filename + len, size - len, "%.2s/%s.debug",
@@ -1330,13 +1330,13 @@ void dso__put(struct dso *dso)
void dso__set_build_id(struct dso *dso, void *build_id)
{
- memcpy(dso->build_id, build_id, sizeof(dso->build_id));
+ memcpy(dso->bid.data, build_id, sizeof(dso->bid.data));
dso->has_build_id = 1;
}
bool dso__build_id_equal(const struct dso *dso, u8 *build_id)
{
- return memcmp(dso->build_id, build_id, sizeof(dso->build_id)) == 0;
+ return memcmp(dso->bid.data, build_id, sizeof(dso->bid.data)) == 0;
}
void dso__read_running_kernel_build_id(struct dso *dso, struct machine *machine)
@@ -1346,8 +1346,8 @@ void dso__read_running_kernel_build_id(struct dso *dso, struct machine *machine)
if (machine__is_default_guest(machine))
return;
sprintf(path, "%s/sys/kernel/notes", machine->root_dir);
- if (sysfs__read_build_id(path, dso->build_id,
- sizeof(dso->build_id)) == 0)
+ if (sysfs__read_build_id(path, dso->bid.data,
+ sizeof(dso->bid.data)) == 0)
dso->has_build_id = true;
}
@@ -1365,8 +1365,8 @@ int dso__kernel_module_get_build_id(struct dso *dso,
"%s/sys/module/%.*s/notes/.note.gnu.build-id",
root_dir, (int)strlen(name) - 1, name);
- if (sysfs__read_build_id(filename, dso->build_id,
- sizeof(dso->build_id)) == 0)
+ if (sysfs__read_build_id(filename, dso->bid.data,
+ sizeof(dso->bid.data)) == 0)
dso->has_build_id = true;
return 0;
@@ -1376,7 +1376,7 @@ size_t dso__fprintf_buildid(struct dso *dso, FILE *fp)
{
char sbuild_id[SBUILD_ID_SIZE];
- build_id__sprintf(dso->build_id, sizeof(dso->build_id), sbuild_id);
+ build_id__sprintf(dso->bid.data, sizeof(dso->bid.data), sbuild_id);
return fprintf(fp, "%s", sbuild_id);
}