From mboxrd@z Thu Jan 1 00:00:00 1970 From: Martin KaFai Lau Subject: Re: [PATCH bpf-next 2/3] bpf: btf: add btf json print functionality Date: Fri, 22 Jun 2018 16:58:52 -0700 Message-ID: <20180622235847.ap52ln2wmtggbxr6@kafai-mbp.dhcp.thefacebook.com> References: <20180621160719.2cfb4b58@cakuba.netronome.com> <20180621235746.dfq6kdtkogftw3ws@kafai-mbp.dhcp.thefacebook.com> <20180621172523.6cd00ed1@cakuba.netronome.com> <20180622012052.htkvholi674x6i4f@kafai-mbp.dhcp.thefacebook.com> <20180622114032.162b2a76@cakuba.netronome.com> <20180622205535.c6vjhdwt5er4wc32@kafai-mbp.dhcp.thefacebook.com> <20180622142743.2b890d0f@cakuba.netronome.com> <20180622144952.353d50c0@cakuba.netronome.com> <20180622231940.fvkxfqccvyf5uewk@kafai-mbp.dhcp.thefacebook.com> <20180622164048.6283b469@cakuba.netronome.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Cc: Okash Khawaja , Daniel Borkmann , "Alexei Starovoitov" , Yonghong Song , Quentin Monnet , "David S. Miller" , , , To: Jakub Kicinski Return-path: Content-Disposition: inline In-Reply-To: <20180622164048.6283b469@cakuba.netronome.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On Fri, Jun 22, 2018 at 04:40:48PM -0700, Jakub Kicinski wrote: > On Fri, 22 Jun 2018 16:19:40 -0700, Martin KaFai Lau wrote: > > On Fri, Jun 22, 2018 at 02:49:52PM -0700, Jakub Kicinski wrote: > > > On Fri, 22 Jun 2018 14:27:43 -0700, Jakub Kicinski wrote: > > > > BTF in JSON is very useful, and will help people who writes simple > > > > orchestration/scripts based on bpftool *a* *lot*. I really appreciate > > > > this addition to bpftool and will start using it myself as soon as it > > > > lands. I'm not sure why the reluctance to slightly change the output > > > > format? > > > > > > Ohh, maybe that's the misunderstanding, you only implemented JSON so > > > you wanted it to be as readable and clean as possible. Hence the hex > > > output and cutting out the old cruft! That perspective makes sense! > > > But I think we should keep JSON for machines (but including BTF > > > formatted values) and let's make the plain text output nice and clean, > > > agreed. > > Right, it is what my earlier comment meant on "this ascii output is > > for human". We merely call it json because we are reusing > > the json's meaning on {}, [] and int since it fits nicely > > on what we want to achieve, readability. Other than that, > > it does not have to follow other json's requirements. > > We can call it whatever except json to avoid wrong > > user expectation. Putting it under "-j"/"-p" was a mistake. > > Hence, I said this patch belongs to the 'plaintext" output. > > Yes, that were the confusion came from, right. I'm personally not sold > on JSON as "human readable" but I'm very far from a UI guru so up to > you :) We have thought of a few options but nothing else shine in term of saving the verbosity on spelling out the word like "it is a struct" , "it is an array"... and at the same time trying to use some short form that people are already familiar with. > > I think it may be good to intentionally do non-JSON things, like use > hex integers, don't put quotes around strings, or always add a comma > after value, so people can't use it as JSON even if they try. Good point. > > Basic printer is trivial to write, I'm concerned that the reuse of JSON > writer to create a user-readable output will bite us on the posterior > later on... If we can think of some better way later, we can also provide another plaintext output. I don't want to over design it at this point. Let see how it goes.