[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87y2qf3k7s.fsf@mellanox.com>
Date: Tue, 28 Apr 2020 13:47:51 +0200
From: Petr Machata <petrm@...lanox.com>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: David Ahern <dsahern@...il.com>, netdev@...r.kernel.org
Subject: Re: [PATCH iproute2-next] tc: pedit: Support JSON dumping
Petr Machata <petrm@...lanox.com> writes:
> Stephen Hemminger <stephen@...workplumber.org> writes:
>
>> On Sun, 26 Apr 2020 12:23:04 -0600
>> David Ahern <dsahern@...il.com> wrote:
>>
>>> On 4/23/20 3:59 AM, Petr Machata wrote:
>>> >
>>> > Stephen Hemminger <stephen@...workplumber.org> writes:
>>> >
>>> >> On Wed, 22 Apr 2020 20:06:15 +0300
>>> >> Petr Machata <petrm@...lanox.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");
I just sent it as a v2 of the patch, we can discuss there.
Powered by blists - more mailing lists