diff options
author | Jiri Olsa <jolsa@kernel.org> | 2020-11-26 18:00:08 +0100 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2020-11-27 08:36:37 -0300 |
commit | f45edd86b23a7dc576b881b3da53936ac9f8dffb (patch) | |
tree | 19a7464403882c93eebca7f95ea47e86aa37be02 /tools/perf/util/build-id.c | |
parent | b3e453272d436aab8adbe810c6d7043670281487 (diff) | |
download | linux-f45edd86b23a7dc576b881b3da53936ac9f8dffb.tar.bz2 |
perf tools: Add build_id__is_defined function
Adding build_id__is_defined helper to check build id is defined and is
!= zero build id.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Song Liu <songliubraving@fb.com>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lore.kernel.org/lkml/20201126170026.2619053-8-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 | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c index 6b410c3d52dc..2aacc8b29f7e 100644 --- a/tools/perf/util/build-id.c +++ b/tools/perf/util/build-id.c @@ -37,6 +37,7 @@ #include <linux/ctype.h> #include <linux/zalloc.h> +#include <linux/string.h> #include <asm/bug.h> static bool no_buildid_cache; @@ -912,3 +913,8 @@ void build_id__init(struct build_id *bid, const u8 *data, size_t size) memcpy(bid->data, data, size); bid->size = size; } + +bool build_id__is_defined(const struct build_id *bid) +{ + return bid && bid->size ? !!memchr_inv(bid->data, 0, bid->size) : false; +} |