Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp72294pxb; Tue, 10 Nov 2020 20:21:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJxhViq4bulnUTfDEcPlx5e+yW8t+tEK3sxuL05AppD7pCsZRPnIMInMKFV2ZMcbyDX715p2 X-Received: by 2002:a17:906:66d2:: with SMTP id k18mr22642185ejp.113.1605068514596; Tue, 10 Nov 2020 20:21:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605068514; cv=none; d=google.com; s=arc-20160816; b=SIDTlefyUAlf2SWNANuDQzLgfnk+USH/WdOI4dlR9zw2TCBa7JyOt3k4dBFwuBXi+c ocUdRA/eoNlHbHp1QPQAW+WQC1wRsflaYySoGt///FeVRdZcBPDDdFvfn7unY02XNM87 7k4cMZmkwW2mWJi4Md1qsMIIfXT6U01kzsm0T/gn32BWf4URcCdU/SaEF0xGbJUP7ehG coPJABNjVeqJcOmCuTvTH5/ggGurGQ9Oz5g4T8PDvTVgXQLHoA3gKUUljIOtdSDeygb/ q4FVsDDBo3JvvqjFKKs2S48ZiefAX/QVPHU96L9cMP+UnlJewDHzsHAFeO9DNwvUzNoI +LOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=AWB1XnVQckH5+rUmx+be8cfhrydsQYCSrkMS7rKMccA=; b=MpKjLZIEXd1jXVu4zKVSVLA+mAoV8l510rqEzEL0UiPPHc5pI7JViiETIINtXX2vH6 ivKAGrErbSEpbTMZVIGd7Yn/LgufDc/XR8KYSVisNNgeatQssc1ImiBnvTftCDDwsqIQ 92VbR3VEf/QxBP3CJYaXsIJbJFjE2vaX6moKCRnf9+QbXmugTNN4U8s+jV14eBg61Zvt CccoGAm1kxLf5hztCVGWotZSzHz6fWe/S6UOD7icIDdC2CXnii4s4DX9PRwQQtNosibD ZNEELqSue8NBVmwI2kEj172gj7s7GlcJqjs9+RO19yqLqjVRA4XQPlQDHPXeRg+J5Ust 0d3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="eYW9mXX/"; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ly22si485825ejb.511.2020.11.10.20.21.30; Tue, 10 Nov 2020 20:21:54 -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=@gmail.com header.s=20161025 header.b="eYW9mXX/"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725945AbgKKET6 (ORCPT + 99 others); Tue, 10 Nov 2020 23:19:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725920AbgKKET5 (ORCPT ); Tue, 10 Nov 2020 23:19:57 -0500 Received: from mail-yb1-xb44.google.com (mail-yb1-xb44.google.com [IPv6:2607:f8b0:4864:20::b44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D844C0613D1; Tue, 10 Nov 2020 20:19:57 -0800 (PST) Received: by mail-yb1-xb44.google.com with SMTP id n142so698446ybf.7; Tue, 10 Nov 2020 20:19:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AWB1XnVQckH5+rUmx+be8cfhrydsQYCSrkMS7rKMccA=; b=eYW9mXX/RHCNJ4ay++cNSSt03NyIQMS8c33qGcdW7ii1KailkiBX5Nvit6/BVajG7x cJdHLtYHR/BHekzpKpMQvIlce20JvrHpMJsloIKjRwBU4uM/itw9SdQtHsl7Gv5WPeFB UR0oZiLAiilzdR99083N7zvHvAts9iu37kn5qHFe/CjeGovru1EuTSuKA4UOs5QF8yIl EkZvJdHWTEDKM3BbLfjNgIusM/1Yz4mN3UgShKoPGceLBZPCvl9ZlrUwjNpN3ywBaibA 4OeLrcZArRQITIXbKwL/ty4gIRMtjZ5lDMcnBXercbVBeB5Zx1zbuHoMSod/G99DU6kY RDXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AWB1XnVQckH5+rUmx+be8cfhrydsQYCSrkMS7rKMccA=; b=IwURyQIyKFt80XBj6K5i56IfnGanAHxWt1qtw4u2nPK9IbzVIdL9DUQXy6eSVK6UJ0 SvHQnxSOWkwGM+/jQMDLZpzDQcXN/IsTFaCu+2Ouk7C5JKKjdJQBFlXamfJw8/Drn/Sj Uy06S244KWd4MpXyV87bnquKMuqWUbcIPJoBhKRPndjr8D8WK32PrA5gXocgMa5flY90 aV6VuI2NeizwsOudsBH9GqHnp18a/H3L4YfxWn5goF8vb/JPVhuNqOfFySk4VEOpPLEV PpDaLOi917GV5L/GnLUyhrN1COEBvC3SGaQjeC8RVHEIP7G06sYdOgq7YsxQTQ0+j2g/ EedA== X-Gm-Message-State: AOAM532SYxyKe0xRJeyq5AImZL28Fz/55yzXHtSpcBzuQ6ah+luaOide q8QQhYJBDr9/4awZY1dTu593CnLDIqz95JWGVkM= X-Received: by 2002:a25:c7c6:: with SMTP id w189mr31716562ybe.403.1605068396905; Tue, 10 Nov 2020 20:19:56 -0800 (PST) MIME-Version: 1.0 References: <20201110011932.3201430-1-andrii@kernel.org> <20201110011932.3201430-6-andrii@kernel.org> <8A2A9182-F22C-4A3B-AF52-6FC56D3057AA@fb.com> In-Reply-To: <8A2A9182-F22C-4A3B-AF52-6FC56D3057AA@fb.com> From: Andrii Nakryiko Date: Tue, 10 Nov 2020 20:19:46 -0800 Message-ID: Subject: Re: [PATCH v4 bpf-next 5/5] tools/bpftool: add support for in-kernel and named BTF in `btf show` To: Song Liu Cc: Andrii Nakryiko , bpf , Networking , Alexei Starovoitov , "daniel@iogearbox.net" , Kernel Team , "linux-kernel@vger.kernel.org" , "rafael@kernel.org" , "jeyu@kernel.org" , Arnaldo Carvalho de Melo , Greg Kroah-Hartman , Alan Maguire Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 10, 2020 at 5:15 PM Song Liu wrote: > > > > > On Nov 9, 2020, at 5:19 PM, Andrii Nakryiko wrote: > > [...] > > > ... > > > > Tested-by: Alan Maguire > > Signed-off-by: Andrii Nakryiko > > Acked-by: Song Liu > > With one nit: > > > --- > > tools/bpf/bpftool/btf.c | 28 +++++++++++++++++++++++++++- > > 1 file changed, 27 insertions(+), 1 deletion(-) > > > > diff --git a/tools/bpf/bpftool/btf.c b/tools/bpf/bpftool/btf.c > > index c96b56e8e3a4..ed5e97157241 100644 > > --- a/tools/bpf/bpftool/btf.c > > +++ b/tools/bpf/bpftool/btf.c > > @@ -742,9 +742,14 @@ show_btf_plain(struct bpf_btf_info *info, int fd, > > struct btf_attach_table *btf_map_table) > > { > > struct btf_attach_point *obj; > > + const char *name = u64_to_ptr(info->name); > > int n; > > > > printf("%u: ", info->id); > > + if (info->kernel_btf) > > + printf("name [%s] ", name); > > + else if (name && name[0]) > > + printf("name %s ", name); > > Maybe explicitly say "name " for btf without a name? I think > it will benefit plain output. This patch set is already landed. But I can do a follow-up patch to add this. > > > printf("size %uB", info->btf_size); > > > > n = 0; > > [...]