Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp714917pxu; Thu, 26 Nov 2020 09:47:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJyrSwMTmPBAtoDV/jAgMShCXHYNtrRuYHBtRJQx9Cq46vB+ayy2VQFqcXmw9HI7v/ueBLgP X-Received: by 2002:aa7:ca44:: with SMTP id j4mr3730910edt.354.1606412863701; Thu, 26 Nov 2020 09:47:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606412863; cv=none; d=google.com; s=arc-20160816; b=bmaPR5IA9HqkAq+GG17JZBMBnRtj2wN30Z29uMGcReFMNZhMEV2lcNMI15QJ3ZEpgG G0rAIQVMUwyIMTQjJB+K+DWpfem2SLvGoQLqbiXVGhCx9j4VtDbKQBz+0f3Yk79K+oac OZzx+82tdl4avcQsWVfzRk+SAASSi1xD67OEP3D6jK7o2+3N0pWohwrT6JwKQLCY0TSa HiOEfpfHmT21IeyO2shsjkp05ITonUx/zBc3I3/RJ0HdTY/RDsbE4nxu1imSyiQaAAd6 VHSPtJe3TG2aFzF2mZlIoS21fgTd6pjBTL8sf9vWrKEbuw8sUQdlO+Bho8Km6J3L/S6E savw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=8nE8rAq48ZxPW3xY1boHUi+TQYas7Vzy0JmbXhn6F9o=; b=RnHvs2r7XFWoitLmsJhL3d8ANGAb8I+nL2+EWkLWu2NQt+k8u1JfKO+2wlgAAlkO4s NUhq7BaGNEXc8JAr+7cclSqX6SMQndrqMX1n+/70fDOFNFZj21LyFkzoO7PwT5B0Safd VI9cazIeFMjfdMjUodjK12khakLKZ/RMQoSTFcFTcFifbRrO0GaTOqaYinyAbfG5GbmV 8X8T3h5BT4XIFHughcrn+/EAnphs0ZgE8N53zp/x/Klp6lkTX7ZMObqc+95mhnneJ8jQ E//2xNZZEbyYyB0CMzgKTFGrL3JdDBNoXy7hr3SLcol0kVcHN70ZKNbOZMxiuR0qJqEp JAfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fiEry9VI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t7si3461142edv.378.2020.11.26.09.47.21; Thu, 26 Nov 2020 09:47:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fiEry9VI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391679AbgKZRna (ORCPT + 99 others); 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