Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp4160114pxb; Tue, 17 Nov 2020 12:58:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJwDmjedXW1rP00wJsSyuL0TqoWpQzzpCg6F9ZLbZw1xOGCQu0pCFN3i64R8CUcuBhYBYm3b X-Received: by 2002:aa7:d34e:: with SMTP id m14mr22049510edr.42.1605646704974; Tue, 17 Nov 2020 12:58:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605646704; cv=none; d=google.com; s=arc-20160816; b=aFf/M/FC+iR8L4EJMW4WZe8TTMwvN8Rrax1wYT2WCWzPDTJMGWbjknRafQScQ/eM50 ovRClDdMrFgMG3TJCzA7T9O1VTqqa7Ba+kIzvjZmqieATcfcVx4w81wbFOC99BjE8w9L 9oJlzvdQMqRBVgPrXhCIU6Nravsl9uUTajoKRIbzpzdRGlfg03J7bTboEwcKgMBd5LJJ DTRprHe2/B6uc/ydOXjW2iaNycDxubL7+haso0qMVsmhkUiJYKLlYOwCCximgerRc5Mk WFqGDnb4qFwAvS+/pNFpvkRVpb1aOfynQCiPVPpStgzdd8GE4Nu/dbja9tG2n1pNuIk8 k5Fw== 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=Na5qrtekWhtUQWyADlsoTi+TWRlxFpXFSkHs1Gld4JY=; b=tuD7KkMauk5hAJtIQ0Omn5o1gIncrKlXSgSOEAuyrpoqpSWHU1Sk9dGnaogfJNNfM6 5tS/JXSjrkTcI4NgmOIs8SQu00/mDk21PWrAWbrT8ny/lbyi9mXMgtseFyKHBFF6MK6Y A8DIoxfHI+l7ucNtDLAxHadAP9s1S0/it0Ty7MtSwGAaxaVk/zHjpncmGIT6DiUU4IEo fIrYUntYTLs652GfxJEJWDxTgBB6IJOBKmcsA6RwO5WvZLRnoGqfAJ2uwf2UEmtS0v6X EfsIN07y34eV5SBUMCGg9tvCaILfDml7S7d98NuiZzX+zLu4A6Hh8+pwKirhdMVlTto3 kRxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dg6PqXsT; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o2si13824602edv.416.2020.11.17.12.57.39; Tue, 17 Nov 2020 12:58:24 -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=@redhat.com header.s=mimecast20190719 header.b=dg6PqXsT; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726308AbgKQUyP (ORCPT + 99 others); Tue, 17 Nov 2020 15:54:15 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:51742 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726297AbgKQUyP (ORCPT ); Tue, 17 Nov 2020 15:54:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605646453; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Na5qrtekWhtUQWyADlsoTi+TWRlxFpXFSkHs1Gld4JY=; b=dg6PqXsT2y6+N26rS3npXlYuY+7qbDXd/kXxtEzw87IOkKFlF6DdMxCsmgHJa056JHhFiO zWBLXmNMWKmykS6kXeyVQ4Cb2k7oDS71eVfERrcXAhEQEc7BI0BWcJWpZIciOgCc7G9cmg ybhQV73y+QWNGnGYL7pdJd8Xw1jkWcc= 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-295-WJ5oIdGpNcWrgVNJG58W-g-1; Tue, 17 Nov 2020 15:54:06 -0500 X-MC-Unique: WJ5oIdGpNcWrgVNJG58W-g-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 5D5D08030B9; Tue, 17 Nov 2020 20:54:04 +0000 (UTC) Received: from krava (unknown [10.40.192.215]) by smtp.corp.redhat.com (Postfix) with SMTP id 660526B8E9; Tue, 17 Nov 2020 20:54:00 +0000 (UTC) Date: Tue, 17 Nov 2020 21:53:59 +0100 From: Jiri Olsa To: Ian Rogers Cc: Jiri Olsa , Arnaldo Carvalho de Melo , lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Namhyung Kim , Alexander Shishkin , Michael Petlan , Song Liu , Stephane Eranian , Alexey Budankov , Andi Kleen , Adrian Hunter Subject: Re: [PATCH 06/24] perf tools: Add build_id__is_defined function Message-ID: <20201117205359.GJ1216482@krava> References: <20201117110053.1303113-1-jolsa@kernel.org> <20201117110053.1303113-7-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 17, 2020 at 11:00:37AM -0800, Ian Rogers wrote: > On Tue, Nov 17, 2020 at 3:01 AM Jiri Olsa wrote: > > > 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; > > > > Fwiw, I find this method to test for zero a little hard to parse - I'm heh, it's controversial one, Namhyung commented on this one in previous version, so I changed it ;-) https://lore.kernel.org/lkml/CAM9d7cjjGjTN8sDgLZ1PoQZ-sUXWjnVaNdyOVE1yHxq46PrPkw@mail.gmail.com/ > failing as a C programmer :-) Nit, should zero be const? right, should be const, will change thanks, jirka