From nobody Mon Apr 6 01:42:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6D51C6FA83 for ; Mon, 12 Sep 2022 16:43:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229767AbiILQnS (ORCPT ); Mon, 12 Sep 2022 12:43:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbiILQnQ (ORCPT ); Mon, 12 Sep 2022 12:43:16 -0400 Received: from out30-57.freemail.mail.aliyun.com (out30-57.freemail.mail.aliyun.com [115.124.30.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F6E527FF7; Mon, 12 Sep 2022 09:43:14 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=chentao.kernel@linux.alibaba.com;NM=1;PH=DS;RN=12;SR=0;TI=SMTPD_---0VPYHjKD_1663000981; Received: from VM20210331-5.tbsite.net(mailfrom:chentao.kernel@linux.alibaba.com fp:SMTPD_---0VPYHjKD_1663000981) by smtp.aliyun-inc.com; Tue, 13 Sep 2022 00:43:10 +0800 From: Tao Chen To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Yonghong Song , Song Liu , John Fastabend , KP Singh Cc: netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Tao Chen Subject: [PATCH v2] libbpf: Support raw btf placed in the default path Date: Tue, 13 Sep 2022 00:43:00 +0800 Message-Id: <3f59fb5a345d2e4f10e16fe9e35fbc4c03ecaa3e.1662999860.git.chentao.kernel@linux.alibaba.com> X-Mailer: git-send-email 2.2.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Now only elf btf can be placed in the default path(/boot), raw btf should also can be there. Signed-off-by: Tao Chen Acked-by: Yonghong Song --- v2->v1: Remove the locations[i].raw_btf check --- tools/lib/bpf/btf.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c index bb1e06e..46ec244 100644 --- a/tools/lib/bpf/btf.c +++ b/tools/lib/bpf/btf.c @@ -4657,11 +4657,10 @@ struct btf *btf__load_vmlinux_btf(void) { struct { const char *path_fmt; - bool raw_btf; } locations[] =3D { /* try canonical vmlinux BTF through sysfs first */ - { "/sys/kernel/btf/vmlinux", true /* raw BTF */ }, - /* fall back to trying to find vmlinux ELF on disk otherwise */ + { "/sys/kernel/btf/vmlinux" }, + /* fall back to trying to find vmlinux on disk otherwise */ { "/boot/vmlinux-%1$s" }, { "/lib/modules/%1$s/vmlinux-%1$s" }, { "/lib/modules/%1$s/build/vmlinux" }, @@ -4683,10 +4682,7 @@ struct btf *btf__load_vmlinux_btf(void) if (access(path, R_OK)) continue; =20 - if (locations[i].raw_btf) - btf =3D btf__parse_raw(path); - else - btf =3D btf__parse_elf(path, NULL); + btf =3D btf__parse(path, NULL); err =3D libbpf_get_error(btf); pr_debug("loading kernel BTF '%s': %d\n", path, err); if (err) --=20 2.2.1