Re: [PATCH iproute2 v2] tc/mqprio: json-ify output

Luca Boccassi
2020-12-02T17:10:01Z

[-- Attachment #1: Type: text/plain, Size: 1293 bytes --]

On Wed, 2020-12-02 at 09:42 -0700, David Ahern wrote:
> On 11/28/20 11:30 AM, Luca Boccassi wrote:
> > @@ -287,9 +293,9 @@ static int mqprio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
> > return -1;
> > *(min++) = rta_getattr_u64(r);
> > }
> > - fprintf(f, " min_rate:");
> > + open_json_array(PRINT_ANY, is_json_context() ? "min_rate" : " min_rate:");
> > for (i = 0; i < qopt->num_tc; i++)
> > - fprintf(f, "%s ", sprint_rate(min_rate64[i], b1));
> > + print_string(PRINT_ANY, NULL, "%s ", sprint_rate(min_rate64[i], b1));
>
> close_json_array?
>
> > }
> >
> > if (tb[TCA_MQPRIO_MAX_RATE64]) {
> > @@ -303,9 +309,9 @@ static int mqprio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
> > return -1;
> > *(max++) = rta_getattr_u64(r);
> > }
> > - fprintf(f, " max_rate:");
> > + open_json_array(PRINT_ANY, is_json_context() ? "max_rate" : " max_rate:");
> > for (i = 0; i < qopt->num_tc; i++)
> > - fprintf(f, "%s ", sprint_rate(max_rate64[i], b1));
> > + print_string(PRINT_ANY, NULL, "%s ", sprint_rate(max_rate64[i], b1));
> > }
>
> close_json_array?
>
> > }
> > return 0;
> >

Whops, fixed in v3, thanks.

--
Kind regards,
Luca Boccassi

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]