perf tools: Pass build_id object to filename__read_build_id()

Pass a build_id object to filename__read_build_id function, so it can
populate the size of the build_id object.

Changing filename__read_build_id() code for both ELF/non-ELF code.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20201013192441.1299447-3-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Jiri Olsa
2020-10-13 21:24:34 +02:00
committed by Arnaldo Carvalho de Melo
parent 0aba7f036a
commit f766819cd5
11 changed files with 60 additions and 57 deletions

View File

@@ -130,16 +130,14 @@ int sysfs__sprintf_build_id(const char *root_dir, char *sbuild_id)
int filename__sprintf_build_id(const char *pathname, char *sbuild_id)
{
u8 build_id[BUILD_ID_SIZE];
struct build_id bid;
int ret;
ret = filename__read_build_id(pathname, build_id, sizeof(build_id));
ret = filename__read_build_id(pathname, &bid);
if (ret < 0)
return ret;
else if (ret != sizeof(build_id))
return -EINVAL;
return build_id__sprintf(build_id, sizeof(build_id), sbuild_id);
return build_id__sprintf(bid.data, sizeof(bid.data), sbuild_id);
}
/* asnprintf consolidates asprintf and snprintf */