From: Petr Machata <petrm@mellanox.com>
To: Briana Oursler <briana.oursler@gmail.com>
Cc: netdev@vger.kernel.org,
Stephen Hemminger <stephen@networkplumber.org>,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
Davide Caratti <dcaratti@redhat.com>,
Stefano Brivio <sbrivio@redhat.com>,
Jiri Pirko <jiri@mellanox.com>
Subject: Re: Question Print Formatting iproute2
Date: Mon, 27 Jul 2020 21:31:36 +0200 [thread overview]
Message-ID: <87wo2ohi07.fsf@mellanox.com> (raw)
In-Reply-To: <20200727044616.735-1-briana.oursler@gmail.com>
Briana Oursler <briana.oursler@gmail.com> writes:
> I git bisected and found d0e450438571("tc: q_red: Add support for
> qevents "mark" and "early_drop"), the commit that introduced the
> formatting change causing the break.
>
> - print_string(PRINT_FP, NULL, "max %s ", sprint_size(qopt->qth_max, b3));
> + print_string(PRINT_FP, NULL, "max %s", sprint_size(qopt->qth_max, b3));
>
> I made a patch that adds a space after the format specifier in the
> iproute2 tc/q_red.c and tested it using: tdc.py -c qdisc. After the
> change, all the broken tdc qdisc red tests return ok. I'm including the
> patch under the scissors line.
>
> I wanted to ask the ML if adding the space after the specifier is preferred usage.
> The commit also had:
> - print_uint(PRINT_ANY, "ewma", "ewma %u ", qopt->Wlog);
> + print_uint(PRINT_ANY, "ewma", " ewma %u ", qopt->Wlog);
>
> so I wanted to check with everyone.
Yeah, I outsmarted myself with those space changes. Those two chunks
need reversing, and qevents need to have the space changed. This should
work:
modified tc/q_red.c
@@ -222,12 +222,12 @@ static int red_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
print_uint(PRINT_JSON, "min", NULL, qopt->qth_min);
print_string(PRINT_FP, NULL, "min %s ", sprint_size(qopt->qth_min, b2));
print_uint(PRINT_JSON, "max", NULL, qopt->qth_max);
- print_string(PRINT_FP, NULL, "max %s", sprint_size(qopt->qth_max, b3));
+ print_string(PRINT_FP, NULL, "max %s ", sprint_size(qopt->qth_max, b3));
tc_red_print_flags(qopt->flags);
if (show_details) {
- print_uint(PRINT_ANY, "ewma", " ewma %u ", qopt->Wlog);
+ print_uint(PRINT_ANY, "ewma", "ewma %u ", qopt->Wlog);
if (max_P)
print_float(PRINT_ANY, "probability",
"probability %lg ", max_P / pow(2, 32));
modified tc/tc_qevent.c
@@ -82,8 +82,9 @@ void qevents_print(struct qevent_util *qevents, FILE *f)
}
open_json_object(NULL);
- print_string(PRINT_ANY, "kind", " qevent %s", qevents->id);
+ print_string(PRINT_ANY, "kind", "qevent %s", qevents->id);
qevents->print_qevent(qevents, f);
+ print_string(PRINT_FP, NULL, "%s", " ");
close_json_object();
}
}
Are you going to take care of this, or should I?
next prev parent reply other threads:[~2020-07-27 19:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-27 4:46 Question Print Formatting iproute2 Briana Oursler
2020-07-27 19:31 ` Petr Machata [this message]
2020-07-27 20:37 ` Stephen Hemminger
2020-07-28 4:12 ` Briana Oursler
2020-07-27 23:47 ` Stephen Hemminger
2020-07-28 4:14 ` Briana Oursler
2020-07-28 5:20 ` [PATCH iproute2] tc: Add space after format specifier Briana Oursler
2020-07-28 5:53 ` Briana Oursler
2020-07-29 15:24 ` David Ahern
2020-07-28 13:24 ` Petr Machata
2020-07-29 17:07 ` David Ahern
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=87wo2ohi07.fsf@mellanox.com \
--to=petrm@mellanox.com \
--cc=briana.oursler@gmail.com \
--cc=dcaratti@redhat.com \
--cc=jiri@mellanox.com \
--cc=kuznet@ms2.inr.ac.ru \
--cc=netdev@vger.kernel.org \
--cc=sbrivio@redhat.com \
--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).