From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2487BC56202 for ; Thu, 26 Nov 2020 17:43:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DA54B21D7F for ; Thu, 26 Nov 2020 17:43:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="fiEry9VI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391696AbgKZRna (ORCPT ); Thu, 26 Nov 2020 12:43:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:38176 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391625AbgKZRn3 (ORCPT ); Thu, 26 Nov 2020 12:43:29 -0500 Received: from quaco.ghostprotocols.net (unknown [179.97.37.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E04AB207BC; Thu, 26 Nov 2020 17:43:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1606412609; bh=tOAB4T9doP4SScLqwOdgYF36eBQgrXWFrZe8pJOlJ9k=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fiEry9VID9GyUnIpPj2n4xAjxcmLc6aZ2sRF2SbyPQiziVa8PbYMuBQDVCLUEgREN 8rxDK69Yw+N6Od49uFHQTp0FYRPkcQ3q+6PFPKOwlOhp21OZaAyuvW1gJYcR9d7Ypi oZ0zgdBQSOGY4w8+vunvBD8/+LDLSDiOfBstWUG0= Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id DC5AD40E29; Thu, 26 Nov 2020 14:43:26 -0300 (-03) Date: Thu, 26 Nov 2020 14:43:26 -0300 From: Arnaldo Carvalho de Melo To: Jiri Olsa Cc: lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Namhyung Kim , Alexander Shishkin , Michael Petlan , Song Liu , Ian Rogers , Stephane Eranian , Alexey Budankov , Andi Kleen , Adrian Hunter Subject: Re: [PATCH 07/25] perf tools: Add build_id__is_defined function Message-ID: <20201126174326.GI53384@kernel.org> References: <20201126170026.2619053-1-jolsa@kernel.org> <20201126170026.2619053-8-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201126170026.2619053-8-jolsa@kernel.org> X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Thu, Nov 26, 2020 at 06:00:08PM +0100, Jiri Olsa escreveu: > Adding build_id__is_defined helper to check build id > is defined and is != zero build id. Thanks, applied. - Arnaldo > Signed-off-by: Jiri Olsa > --- > tools/perf/util/build-id.c | 6 ++++++ > tools/perf/util/build-id.h | 1 + > 2 files changed, 7 insertions(+) > > 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 > #include > +#include > #include > > 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; > +} > diff --git a/tools/perf/util/build-id.h b/tools/perf/util/build-id.h > index f293f99d5dba..d53415feaf69 100644 > --- a/tools/perf/util/build-id.h > +++ b/tools/perf/util/build-id.h > @@ -21,6 +21,7 @@ struct feat_fd; > > void build_id__init(struct build_id *bid, const u8 *data, size_t size); > int build_id__sprintf(const struct build_id *build_id, char *bf); > +bool build_id__is_defined(const struct build_id *bid); > int sysfs__sprintf_build_id(const char *root_dir, char *sbuild_id); > int filename__sprintf_build_id(const char *pathname, char *sbuild_id); > char *build_id_cache__kallsyms_path(const char *sbuild_id, char *bf, > -- > 2.26.2 > -- - Arnaldo