All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Nicolas Escande" <nico.escande@gmail.com>
To: "Johannes Berg" <johannes@sipsolutions.net>,
	"Isaev Ruslan" <legale.legale@gmail.com>,
	<linux-wireless@vger.kernel.org>
Subject: Re: [PATCH v5] Add JSON output options to 'iw' for scan results
Date: Tue, 05 Mar 2024 11:17:53 +0100	[thread overview]
Message-ID: <CZLQMMSSUWBF.1NPJJYDRIXGIR@gmail.com> (raw)
In-Reply-To: <12f91b008d6f2b4e6241794d2852c1c84fe6c12c.camel@sipsolutions.net>

On Tue Mar 5, 2024 at 10:41 AM CET, Johannes Berg wrote:
[...]
>
> I'm generally not going to look into these files for now, but including
> them internally means we have to maintain them. I'd almost prefer a
> library that can be used.

For what it's worth jansson has been very good to me. It has printf() like
object creation which usually integrates well with c programs.

>
> However, with that said,
>
> > +/*
> > + * json_print.c		"print regular or json output, based on json_writer".
> > + *
> > + *             This program is free software; you can redistribute it and/or
> > + *             modify it under the terms of the GNU General Public License
> > + *             as published by the Free Software Foundation; either version
> > + *             2 of the License, or (at your option) any later version.
>
>
> This doesn't work well with the ISC license of iw. Which is another
> reason to prefer an existing library, I suppose.

With MIT license https://github.com/akheron/jansson/blob/master/LICENSE

[...]

>
> So ... Like I wrote above, generally I'm not against doing this. But
> like I also tried to explain above, I think it needs to be less
> "duplicative". I'm happy to change the code in major ways to make JSON
> output easier, I'm also happy to let that change the output in some ways
> (maybe the default should be YAML-compatible ;-) ).

>
> But I'd really want to see this done in a way that doesn't end up with
> having to duplicate everything all the time.
>

For me, having a "good" json representation means, as you pointed out, using the
right json underlying type and most of the time I'm afraid that means a complete
different code path because of the underlying type/container. It's always a
blurry line obviously but duplicating in a complete seperate function that only
does the right thing for json output may end up being cleaner codewise.

> We'll also need to figure out the licensing situation, and perhaps
> ideally find a way to not add ~1.5k LOC to support it, but link against
> something that exists already.

+1 for not reimplementing the wheel.

>
> johannes


  reply	other threads:[~2024-03-05 10:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5c5be485dcfceb44fc731e47758d6be3.legale.legale@gmail.com>
2024-03-05  9:41 ` [PATCH v5] Add JSON output options to 'iw' for scan results Johannes Berg
2024-03-05 10:17   ` Nicolas Escande [this message]
2024-03-05 10:31     ` Johannes Berg
2024-03-05 11:32       ` Isaev Ruslan
2024-03-05 13:29         ` Johannes Berg
2024-03-05 11:19     ` Isaev Ruslan
2024-03-05 15:55   ` Jeff Johnson
2024-03-05 16:35     ` Aditya Kumar Singh
2024-03-05 16:40       ` Johannes Berg
2024-03-05 17:47       ` Jeff Johnson
2024-03-04 20:01 Isaev Ruslan

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=CZLQMMSSUWBF.1NPJJYDRIXGIR@gmail.com \
    --to=nico.escande@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=legale.legale@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    /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.