Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1729603pxk; Sun, 13 Sep 2020 14:05:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyu6VgPe47LOPJaMCON4OAlfj3l+Y429fMDK08Ixt7/mz8IIbww8CYc7+/AViHBR4ch1lsL X-Received: by 2002:a17:906:b1d7:: with SMTP id bv23mr11136378ejb.464.1600031135808; Sun, 13 Sep 2020 14:05:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600031135; cv=none; d=google.com; s=arc-20160816; b=hgNnwT1vCNGdsQ+C+WoIlQffnTM8gmGSBpUpeKj7RF2pKERo+lNjIoFwAFL8KLXpni 6k3MoH96N09/LZSZad6JkO+H0QwEzH9sWegiQZzr6IUn0AmUJEtyU6JrVWU4InOuIdgP EN53PVv9SM+Xx+xyVPBx53aJOIZQzLelBaeNFSBWJ2s+90qI3iFMYQj/8MPaefrwz0rK 8CBn4VNEJQYKZrvVVCtoLAJL2y8Dd+SG8YNATlAU2C/sll4Yw4a5be+aC/BMoOz9w5fZ NzcRwxMUS74HYCiJce9lBvEVVjvkMqxk6CCIIfySHG0/qifo1K2nFX3bUHLvFavAPF0c 8JUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ERfFRGlEXi7JhFEoLxEWyo0JxN7pJ+HqJLzJakxudKk=; b=LZvwCjh9Yy/ua0seELeXqHo7rY2rJUFTy4x28kXpk/Au78N4mYwFLMD66eSXy+opy2 3H7jGEsa9aVT/96QD1laeJ0ajUjcxnSPlroCTb56i9p7a2dQM0BFGDAH+xHHq/ji0UpZ KXXYxjQySUsug903NedI22es5cEZprntce54aW8/+QuqnaUfT5QIQXBZQwd+F4os3Lt8 nVmN5pBYm5uZDBaG8Ji3UarRpBwzjWATMycV7qG7RvE6AAudulat9f4R34IExKuNIOJH x+A9sibFiPkJrLvPU+mhKjF1NiNy5DdqS20yBXr9sUT4rDipfgddix8oFUg372D8s4aR YmoQ== ARC-Authentication-Results: i=1; mx.google.com; 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 uz13si5766777ejb.531.2020.09.13.14.05.13; Sun, 13 Sep 2020 14:05:35 -0700 (PDT) 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; 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 S1726000AbgIMVEL convert rfc822-to-8bit (ORCPT + 99 others); Sun, 13 Sep 2020 17:04:11 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:60442 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725968AbgIMVDv (ORCPT ); Sun, 13 Sep 2020 17:03:51 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-249--FsyTEmQP2ut0tesaM59gA-1; Sun, 13 Sep 2020 17:03:49 -0400 X-MC-Unique: -FsyTEmQP2ut0tesaM59gA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7657E802B6A; Sun, 13 Sep 2020 21:03:46 +0000 (UTC) Received: from krava.redhat.com (ovpn-112-4.ams2.redhat.com [10.36.112.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id A0CE01002393; Sun, 13 Sep 2020 21:03:37 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Namhyung Kim , Alexander Shishkin , Michael Petlan , Song Liu , "Frank Ch. Eigler" , Ian Rogers , Stephane Eranian , Alexey Budankov , Andi Kleen , Adrian Hunter Subject: [PATCH 05/26] perf tools: Add build_id__is_defined function Date: Sun, 13 Sep 2020 23:02:52 +0200 Message-Id: <20200913210313.1985612-6-jolsa@kernel.org> In-Reply-To: <20200913210313.1985612-1-jolsa@kernel.org> References: <20200913210313.1985612-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jolsa@kernel.org X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: kernel.org Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adding build_id__is_defined helper to check build id is defined and is != zero build id. Signed-off-by: Jiri Olsa --- tools/perf/util/build-id.c | 11 +++++++++++ tools/perf/util/build-id.h | 1 + 2 files changed, 12 insertions(+) diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c index 31207b6e2066..bdee4e08e60d 100644 --- a/tools/perf/util/build-id.c +++ b/tools/perf/util/build-id.c @@ -902,3 +902,14 @@ bool perf_session__read_build_ids(struct perf_session *session, bool with_hits) return ret; } + +bool build_id__is_defined(const u8 *build_id) +{ + static u8 zero[BUILD_ID_SIZE]; + int err = 0; + + if (build_id) + err = memcmp(build_id, &zero, BUILD_ID_SIZE); + + return err ? true : false; +} diff --git a/tools/perf/util/build-id.h b/tools/perf/util/build-id.h index aad419bb165c..1ceede45c231 100644 --- a/tools/perf/util/build-id.h +++ b/tools/perf/util/build-id.h @@ -14,6 +14,7 @@ extern struct perf_tool build_id__mark_dso_hit_ops; struct dso; struct feat_fd; +bool build_id__is_defined(const u8 *build_id); int build_id__sprintf(const u8 *build_id, int len, char *bf); int sysfs__sprintf_build_id(const char *root_dir, char *sbuild_id); int filename__sprintf_build_id(const char *pathname, char *sbuild_id); -- 2.26.2