[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dc6a17197c3406d877efd98de351e57d7bbe06a5.camel@perches.com>
Date: Wed, 13 May 2020 15:48:17 -0700
From: Joe Perches <joe@...ches.com>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>,
Alan Maguire <alan.maguire@...cle.com>
Cc: ast@...nel.org, daniel@...earbox.net, bpf@...r.kernel.org,
linux@...musvillemoes.dk, arnaldo.melo@...il.com, yhs@...com,
kafai@...com, songliubraving@...com, andriin@...com,
john.fastabend@...il.com, kpsingh@...omium.org,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH v2 bpf-next 0/7] bpf, printk: add BTF-based type printing
On Wed, 2020-05-13 at 15:24 -0700, Alexei Starovoitov wrote:
> On Tue, May 12, 2020 at 06:56:38AM +0100, Alan Maguire wrote:
> > The printk family of functions support printing specific pointer types
> > using %p format specifiers (MAC addresses, IP addresses, etc). For
> > full details see Documentation/core-api/printk-formats.rst.
> >
> > This patchset proposes introducing a "print typed pointer" format
> > specifier "%pT"; the argument associated with the specifier is of
> > form "struct btf_ptr *" which consists of a .ptr value and a .type
> > value specifying a stringified type (e.g. "struct sk_buff") or
> > an .id value specifying a BPF Type Format (BTF) id identifying
> > the appropriate type it points to.
> >
> > pr_info("%pT", BTF_PTR_TYPE(skb, "struct sk_buff"));
> >
> > ...gives us:
> >
> > (struct sk_buff){
> > .transport_header = (__u16)65535,
> > .mac_header = (__u16)65535,
> > .end = (sk_buff_data_t)192,
> > .head = (unsigned char *)000000007524fd8b,
> > .data = (unsigned char *)000000007524fd8b,
>
> could you add "0x" prefix here to make it even more C like
> and unambiguous ?
linux pointers are not emitted with an 0x prefix
(ie: pointers do not use SPECIAL in lib/vsprintf.c)
Powered by blists - more mailing lists