netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2] etf: make printing of variable JSON friendly
@ 2019-07-19 21:40 Vedang Patel
  2019-07-19 22:26 ` Stephen Hemminger
  2019-07-22 18:21 ` David Ahern
  0 siblings, 2 replies; 7+ messages in thread
From: Vedang Patel @ 2019-07-19 21:40 UTC (permalink / raw)
  To: netdev
  Cc: jhs, xiyou.wangcong, jiri, stephen, vinicius.gomes,
	leandro.maciel.dorileo, dsahern, Vedang Patel

In iproute2 txtime-assist series, it was pointed out that print_bool()
should be used to print binary values. This is to make it JSON friendly.

So, make the corresponding changes in ETF.

Fixes: 8ccd49383cdc ("etf: Add skip_sock_check")
Reported-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Vedang Patel <vedang.patel@intel.com>
---
 tc/q_etf.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tc/q_etf.c b/tc/q_etf.c
index c2090589bc64..307c50eed48b 100644
--- a/tc/q_etf.c
+++ b/tc/q_etf.c
@@ -176,12 +176,12 @@ static int etf_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 		     get_clock_name(qopt->clockid));
 
 	print_uint(PRINT_ANY, "delta", "delta %d ", qopt->delta);
-	print_string(PRINT_ANY, "offload", "offload %s ",
-				(qopt->flags & TC_ETF_OFFLOAD_ON) ? "on" : "off");
-	print_string(PRINT_ANY, "deadline_mode", "deadline_mode %s ",
-				(qopt->flags & TC_ETF_DEADLINE_MODE_ON) ? "on" : "off");
-	print_string(PRINT_ANY, "skip_sock_check", "skip_sock_check %s",
-				(qopt->flags & TC_ETF_SKIP_SOCK_CHECK) ? "on" : "off");
+	if (qopt->flags & TC_ETF_OFFLOAD_ON)
+		print_bool(PRINT_ANY, "offload", "offload ", true);
+	if (qopt->flags & TC_ETF_DEADLINE_MODE_ON)
+		print_bool(PRINT_ANY, "deadline_mode", "deadline_mode ", true);
+	if (qopt->flags & TC_ETF_SKIP_SOCK_CHECK)
+		print_bool(PRINT_ANY, "skip_sock_check", "skip_sock_check", true);
 
 	return 0;
 }
-- 
2.7.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-07-23 23:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-19 21:40 [PATCH iproute2] etf: make printing of variable JSON friendly Vedang Patel
2019-07-19 22:26 ` Stephen Hemminger
2019-07-22 18:21 ` David Ahern
2019-07-22 20:11   ` Patel, Vedang
2019-07-23  0:11     ` David Ahern
2019-07-23 21:34       ` Patel, Vedang
2019-07-23 23:23         ` Stephen Hemminger

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).