From: Petr Machata <petrm@mellanox.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: David Ahern <dsahern@gmail.com>, netdev@vger.kernel.org
Subject: Re: [PATCH iproute2-next] tc: pedit: Support JSON dumping
Date: Tue, 28 Apr 2020 11:32:17 +0200 [thread overview]
Message-ID: <87368o3qhq.fsf@mellanox.com> (raw)
In-Reply-To: <20200427160938.2cdce301@hermes.lan>
Stephen Hemminger <stephen@networkplumber.org> writes:
> On Sun, 26 Apr 2020 12:23:04 -0600
> David Ahern <dsahern@gmail.com> wrote:
>
>> On 4/23/20 3:59 AM, Petr Machata wrote:
>> >
>> > Stephen Hemminger <stephen@networkplumber.org> writes:
>> >
>> >> On Wed, 22 Apr 2020 20:06:15 +0300
>> >> Petr Machata <petrm@mellanox.com> wrote:
>> >>
>> >>> + print_string(PRINT_FP, NULL, ": %s",
>> >>> + cmd ? "add" : "val");
>> >>> + print_string(PRINT_JSON, "cmd", NULL,
>> >>> + cmd ? "add" : "set");
>> >>
>> >> Having different outputs for JSON and file here. Is that necessary?
>> >> JSON output is new, and could just mirror existing usage.
>> >
>> > This code outputs this bit:
>> >
>> > {
>> > "htype": "udp",
>> > "offset": 0,
>> > "cmd": "set", <----
>> > "val": "3039",
>> > "mask": "ffff0000"
>> > },
>> >
>> > There are currently two commands, set and add. The words used to
>> > configure these actions are set and add as well. The way these commands
>> > are dumped should be the same, too. The only reason why "set" is
>> > reported as "val" in file is that set used to be the implied action.
>> >
>> > JSON doesn't have to be backward compatible, so it should present the
>> > expected words.
>> >
>>
>> Stephen: do you agree?
>
> Sure that is fine, maybe a comment would help?
Something like this?
/* In FP, report the "set" command as "val" to keep
* backward compatibility.
*/
print_string(PRINT_FP, NULL, ": %s",
cmd ? "add" : "val");
print_string(PRINT_JSON, "cmd", NULL,
cmd ? "add" : "set");
next prev parent reply other threads:[~2020-04-28 9:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-22 17:06 [PATCH iproute2-next] tc: pedit: Support JSON dumping Petr Machata
2020-04-22 20:02 ` Stephen Hemminger
2020-04-23 9:59 ` Petr Machata
2020-04-26 18:23 ` David Ahern
2020-04-27 23:09 ` Stephen Hemminger
2020-04-28 9:32 ` Petr Machata [this message]
2020-04-28 11:47 ` Petr Machata
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=87368o3qhq.fsf@mellanox.com \
--to=petrm@mellanox.com \
--cc=dsahern@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).