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

David Ahern
2020-12-02T16:43:06Z

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;
>