diff options
author | Jiri Olsa <jolsa@kernel.org> | 2020-10-13 21:24:34 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2020-10-14 08:45:16 -0300 |
commit | f766819cd5290d42efa55c505b9bed184fec17bf (patch) | |
tree | faace7f54816f983cd14bcbee4479712a853d44c /tools/perf/util/build-id.c | |
parent | 0aba7f036a56675b7fdc536757b4c49fc76a2208 (diff) |
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>
Diffstat (limited to 'tools/perf/util/build-id.c')
-rw-r--r-- | tools/perf/util/build-id.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c index 7da13ddb0d50..62b258aaa128 100644 --- a/tools/perf/util/build-id.c +++ b/tools/perf/util/build-id.c @@ -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 */ |