Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3535144pxb; Mon, 9 Nov 2020 13:56:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJzgkLC2xfavC7pyBSADciBIBeFNTXy307aLuCE4yS5i2hFc5NTEcR+i3J8Ck9gxUIZTxcE+ X-Received: by 2002:a50:dec5:: with SMTP id d5mr18086303edl.362.1604959017841; Mon, 09 Nov 2020 13:56:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604959017; cv=none; d=google.com; s=arc-20160816; b=blL+FaT6B4GUr8kUXMcHgxQv4h2XNN+hj3N2bTDPsY3tz5Q1Vz8o7jpr9Vh5qIA+ua RRhZJKo/OAt6xxUca31zGyC5A2o2w4cgmIw9tzzqgxrQVSMSR9+VeB8mhVi6gHlV0Ls3 dHMnt/uxI2BVHxhHkl36PObEcZNGXVS+A00FSb3djHiKMYMTm+QzXb69xWRxUj/tw9th zLz+9gtc7Y+C8qFT8YMfRv+IILDvNeKjKLmuWkNnrEX76LBQHEpP7BxWDmnpE2Et6ccf tOr+S/4VaOGjRnUBXA6HrzbPTNN0fi3g3KGyo9IDDjC4nw7uSo9aMMUIuafzSXP3nE/J tNFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=9wPW0U7H8KxnmUIchSUXNGe4bd2TPws//UNEd0M313U=; b=mNI9teY4Pd60Zon6sApZesu/uAYd52YTkQBQecCDZnj6p3LXI1Y6pYhyPzwNK7M7dh ixbWr2XOFg8o6qieTOEOfy72LHZSonHp7xbduIwdFyo0wu452zn88nBbo8H/m2Bhuoc2 4T/h0EWrKdDmb99Rx+eh8Ob6n66/MDw8DHTrkat+S0laLo22YRBlOYakqrgb49+CnWAg dnYsmIvf9EYqvY54tTKIg3f+aHASaJMRqJcD7cCXSyiA92Ns+5iICGzgLEEa3QwHYfdw sMs5YE4jH3UolAIeP0giprTZuYwf904QXYCOKGKAIF8kbyqlG4vDm87KN+shhTVo72Rl oK8Q== 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 bm22si8167836edb.342.2020.11.09.13.56.35; Mon, 09 Nov 2020 13:56:57 -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; 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 S1731285AbgKIVy4 convert rfc822-to-8bit (ORCPT + 99 others); Mon, 9 Nov 2020 16:54:56 -0500 Received: from us-smtp-delivery-44.mimecast.com ([207.211.30.44]:54836 "EHLO us-smtp-delivery-44.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731284AbgKIVyy (ORCPT ); Mon, 9 Nov 2020 16:54:54 -0500 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-595-mjeoXuxFNSyHfGNZoCyOCQ-1; Mon, 09 Nov 2020 16:54:47 -0500 X-MC-Unique: mjeoXuxFNSyHfGNZoCyOCQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 42F8E57241; Mon, 9 Nov 2020 21:54:45 +0000 (UTC) Received: from krava.redhat.com (unknown [10.40.192.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 48BB26EF51; Mon, 9 Nov 2020 21:54:42 +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 , Ian Rogers , Stephane Eranian , Alexey Budankov , Andi Kleen , Adrian Hunter Subject: [PATCH 06/24] perf tools: Add build_id__is_defined function Date: Mon, 9 Nov 2020 22:53:57 +0100 Message-Id: <20201109215415.400153-7-jolsa@kernel.org> In-Reply-To: <20201109215415.400153-1-jolsa@kernel.org> References: <20201109215415.400153-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jolsa@kernel.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset=WINDOWS-1252 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 | 7 +++++++ tools/perf/util/build-id.h | 1 + 2 files changed, 8 insertions(+) diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c index 6b410c3d52dc..7d9ecc37849c 100644 --- a/tools/perf/util/build-id.c +++ b/tools/perf/util/build-id.c @@ -912,3 +912,10 @@ 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) +{ + static u8 zero[BUILD_ID_SIZE]; + + return bid && bid->size ? memcmp(bid->data, &zero, 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