Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4740569pxk; Wed, 30 Sep 2020 10:25:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyh62V6+jl6n4mRKxM2m19FKRaYqlYlY/aKZHvPrV4Nr8Jzkz7n/T/qnHeQEvyaPfQXd6Oe X-Received: by 2002:a50:d4d8:: with SMTP id e24mr3965881edj.1.1601486712450; Wed, 30 Sep 2020 10:25:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601486712; cv=none; d=google.com; s=arc-20160816; b=SQPDiCqRV93lvD5zjrkOu3lTQ8IchMzXjtdJrl2fXLFyj1ajAJhfZlCva1oREvYoJz 1o5u7dYXqHMC9+vJCuLvubpW+H3KsSyDBSm5ioBAtGY8IdrBx8wYxo3s3QaIOL56fZ/3 V2lR0BS9byVTNhXSfwIftTV5CcOCnUFw1by6mYURDegAopJIPXYT2pku8wPiNQKWJAvh 1p1ZFAUOZt8mQsapq70x0TYsfg0E2n1SlhWHK667sHEbdXi97fm+Khk++oy/dbMrCi/X yMZw2ACaeypBsF88id78J03abV7qMpXNDIKssJHhmOBimIL2hOkhiFXCnmCTNjQx3YF4 W3mw== 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=oluKj5AJqLyevXmoZgY7DF1kNoSu6BgS2Y8qahzOhXg=; b=NNCEsFyx1fmh8scPE8XkuQUrw8NFozGA7kxOKdYwkALyiVGC+48SecP+yDQMd07JgN A9BgnvHaUuZouvpG1HV9x3BejIJrehv3McXGhX5ZLScy7GnZvs5UTak8cOqloaOVASdO prsCwHTeVDDTFjTUB5er7fDA3Y5Us9YzFRijIwvJWETqNh+N9V2Gs8oadSj8K4YMPJic U/ledAQnlj9WRFRVgeRnuUJsJYcbxWHgKHibSV+2tpZ/AToRbp7GOJJs7yD+XkMVr7/T +Q4YwjzOUWXaRvYGI+LzyNaL3CxiiRmpBUO+arNzLy/RW/v+RlBYJuorbAUfO41aAU/5 5jEw== 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 nz24si1496526ejb.221.2020.09.30.10.24.50; Wed, 30 Sep 2020 10:25:12 -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 S1726335AbgI3RVr convert rfc822-to-8bit (ORCPT + 99 others); Wed, 30 Sep 2020 13:21:47 -0400 Received: from us-smtp-delivery-44.mimecast.com ([207.211.30.44]:21807 "EHLO us-smtp-delivery-44.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725355AbgI3RVr (ORCPT ); Wed, 30 Sep 2020 13:21:47 -0400 X-Greylist: delayed 379 seconds by postgrey-1.27 at vger.kernel.org; Wed, 30 Sep 2020 13:21:46 EDT 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-429-ZSKwlI4uPV2lECOugSCMNA-1; Wed, 30 Sep 2020 13:15:34 -0400 X-MC-Unique: ZSKwlI4uPV2lECOugSCMNA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 47E8E801AB7; Wed, 30 Sep 2020 17:15:32 +0000 (UTC) Received: from krava.redhat.com (unknown [10.40.194.241]) by smtp.corp.redhat.com (Postfix) with ESMTP id 60E77702E7; Wed, 30 Sep 2020 17:15:29 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Namhyung Kim , Alexander Shishkin , Michael Petlan , Ian Rogers , Stephane Eranian Subject: [PATCH 6/9] perf tools: Pass build_id object to dso__set_build_id Date: Wed, 30 Sep 2020 19:15:09 +0200 Message-Id: <20200930171512.3986425-7-jolsa@kernel.org> In-Reply-To: <20200930171512.3986425-1-jolsa@kernel.org> References: <20200930171512.3986425-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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 Passing build_id object to dso__set_build_id, so it's easier to initialize dos's build id object. Signed-off-by: Jiri Olsa --- tools/perf/util/dso.c | 4 ++-- tools/perf/util/dso.h | 2 +- tools/perf/util/header.c | 4 +++- tools/perf/util/symbol-minimal.c | 2 +- tools/perf/util/symbol.c | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c index 2f7f01ead9a1..4415ce83150b 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c @@ -1326,9 +1326,9 @@ void dso__put(struct dso *dso) dso__delete(dso); } -void dso__set_build_id(struct dso *dso, void *build_id) +void dso__set_build_id(struct dso *dso, struct build_id *bid) { - memcpy(dso->bid.data, build_id, sizeof(dso->bid.data)); + dso->bid = *bid; dso->has_build_id = 1; } diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h index eac004210b47..5a5678dbdaa5 100644 --- a/tools/perf/util/dso.h +++ b/tools/perf/util/dso.h @@ -260,7 +260,7 @@ bool dso__sorted_by_name(const struct dso *dso); void dso__set_sorted_by_name(struct dso *dso); void dso__sort_by_name(struct dso *dso); -void dso__set_build_id(struct dso *dso, void *build_id); +void dso__set_build_id(struct dso *dso, struct build_id *bid); bool dso__build_id_equal(const struct dso *dso, u8 *build_id); void dso__read_running_kernel_build_id(struct dso *dso, struct machine *machine); diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index fe220f01fc94..21243adbb9fd 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -2082,8 +2082,10 @@ static int __event_process_build_id(struct perf_record_header_build_id *bev, dso = machine__findnew_dso(machine, filename); if (dso != NULL) { char sbuild_id[SBUILD_ID_SIZE]; + struct build_id bid; - dso__set_build_id(dso, &bev->build_id); + build_id__init(&bid, bev->build_id, BUILD_ID_SIZE); + dso__set_build_id(dso, &bid); if (dso_space != DSO_SPACE__USER) { struct kmod_path m = { .name = NULL, }; diff --git a/tools/perf/util/symbol-minimal.c b/tools/perf/util/symbol-minimal.c index dba6b9e5d64e..f9eb0bee7f15 100644 --- a/tools/perf/util/symbol-minimal.c +++ b/tools/perf/util/symbol-minimal.c @@ -349,7 +349,7 @@ int dso__load_sym(struct dso *dso, struct map *map __maybe_unused, dso->is_64_bit = ret; if (filename__read_build_id(ss->name, &bid) > 0) - dso__set_build_id(dso, bid.data); + dso__set_build_id(dso, &bid); return 0; } diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 369cbad09f0d..976632d0baa0 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -1818,7 +1818,7 @@ int dso__load(struct dso *dso, struct map *map) is_regular_file(dso->long_name)) { __symbol__join_symfs(name, PATH_MAX, dso->long_name); if (filename__read_build_id(name, &bid) > 0) - dso__set_build_id(dso, bid.data); + dso__set_build_id(dso, &bid); } /* -- 2.26.2