netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: "YU, Xiangning" <xiangning.yu@alibaba-inc.com>
Cc: Linux Kernel Network Developers <netdev@vger.kernel.org>
Subject: Re: [PATCH iproute2-next v2] iproute2 Support lockless token bucket (ltb)
Date: Wed, 8 Jul 2020 23:33:05 -0700	[thread overview]
Message-ID: <20200708233305.07b53f8a@hermes.lan> (raw)
In-Reply-To: <2a2b2cc9-eeba-4176-198f-fab74ebe4a33@alibaba-inc.com>

On Thu, 09 Jul 2020 00:38:27 +0800
"YU, Xiangning" <xiangning.yu@alibaba-inc.com> wrote:

> +static int ltb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv,
> +			       struct nlmsghdr *n, const char *dev)
> +{
> +	struct tc_ltb_opt opt;

If you use empty initializer in C it will make everything 0 and save you some pain.

	struct tc_ltb_opt opt = { };


> +		fprintf(f, "rate %s ", sprint_rate(rate64, b1));
> +		fprintf(f, "ceil %s ", sprint_rate(ceil64, b1));
> +		if (show_details) {
> +			fprintf(f, "measured %llu allocated %llu highwater %llu",
> +				lopt->measured, lopt->allocated,
> +				lopt->high_water);


All output has to be in JSON. Any use of fprintf(f, ...) directly
is a indication to me of code that is not supporting JSON correctly.

  reply	other threads:[~2020-07-09  6:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-08 16:38 [PATCH iproute2-next v2] iproute2 Support lockless token bucket (ltb) YU, Xiangning
2020-07-09  6:33 ` Stephen Hemminger [this message]
2020-07-09 17:10   ` YU, Xiangning

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=20200708233305.07b53f8a@hermes.lan \
    --to=stephen@networkplumber.org \
    --cc=netdev@vger.kernel.org \
    --cc=xiangning.yu@alibaba-inc.com \
    /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).