From: Okash Khawaja <osk@fb.com>
To: Martin KaFai Lau <kafai@fb.com>
Cc: Jakub Kicinski <jakub.kicinski@netronome.com>,
Daniel Borkmann <daniel@iogearbox.net>,
Alexei Starovoitov <ast@kernel.org>, Yonghong Song <yhs@fb.com>,
Quentin Monnet <quentin.monnet@netronome.com>,
"David S. Miller" <davem@davemloft.net>, <netdev@vger.kernel.org>,
<kernel-team@fb.com>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH bpf-next v2 2/3] bpf: btf: add btf print functionality
Date: Sat, 7 Jul 2018 14:30:58 +0100 [thread overview]
Message-ID: <20180707133057.GA1697@w1t1fb> (raw)
In-Reply-To: <20180703233350.aa33jyzrc6hmaelq@kafai-mbp.dhcp.thefacebook.com>
On Tue, Jul 03, 2018 at 04:33:50PM -0700, Martin KaFai Lau wrote:
> On Tue, Jul 03, 2018 at 03:38:43PM -0700, Jakub Kicinski wrote:
> > On Tue, 3 Jul 2018 15:23:31 -0700, Jakub Kicinski wrote:
> > > > > > + else
> > > > > > + jsonw_printf(jw, "%hhd", *((char *)data));
> > > > >
> > > > > ... I think you need to always print a string, and express it as
> > > > > \u00%02hhx for non-printable.
> > > > Okay that makes sense
> > >
> > > Yeah, IDK, char can be used as a byte as well as a string. In eBPF
> > > it may actually be more likely to just be used as a raw byte buffer...
> >
> > Actually, what is the definition/purpose of BTF_INT_CHAR? There seems
> > to be no BTF_INT_SHORT and BTF_INT_SIGNED can simply be of size 8...
> > Is normal int only used for bitfields of size 8 and BTF_INT_CHAR for
> > char variables?
> >
> > The kernel seems to be rejecting combinations of those flags, is
> > unsigned char going to not be marked as char then?
> BTF_INT_ENOCODING (CHAR/SIGNED/BOOL) is for formatting (e.g. pretty
> print). It is mainly how CTF is using it also. Hence, BTF_INT_ENCODINGs
> is not a 1:1 mapping to C integer types.
> The size of an interger is described by BTF_INT_BITS instead.
>
> >
> > > Either way I think it may be nice to keep it consistent, at least for
> > > the JSON output could we do either always ints or always characters?
> >
for !isprint() case, will "\x%02hhx" make more sense?
next prev parent reply other threads:[~2018-07-07 13:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-02 18:39 [PATCH bpf-next v2 0/3] bpf: btf: print bpftool map data with btf Okash Khawaja
2018-07-02 18:39 ` [PATCH bpf-next v2 2/3] bpf: btf: add btf print functionality Okash Khawaja
2018-07-03 5:06 ` Jakub Kicinski
2018-07-03 21:46 ` Okash Khawaja
2018-07-03 22:23 ` Jakub Kicinski
2018-07-03 22:38 ` Jakub Kicinski
2018-07-03 23:33 ` Martin KaFai Lau
2018-07-07 13:30 ` Okash Khawaja [this message]
2018-07-07 18:49 ` Jakub Kicinski
2018-07-04 16:31 ` Okash Khawaja
2018-07-02 18:39 ` [PATCH bpf-next v2 3/3] bpf: btf: print map dump and lookup with btf info Okash Khawaja
2018-07-03 5:29 ` Jakub Kicinski
[not found] ` <20180702191324.476855192@fb.com>
2018-07-03 4:07 ` [PATCH bpf-next v2 1/3] bpf: btf: export btf types and name by offset from lib Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180707133057.GA1697@w1t1fb \
--to=osk@fb.com \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=jakub.kicinski@netronome.com \
--cc=kafai@fb.com \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=quentin.monnet@netronome.com \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.