Skip to contentSkip to conversation

police: Small corrections for the output

PATCH Superseded Roi Dayan 1 participant 2 messages Jul 8, 2021

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Roi Dayan

author
#0 lore raw

PATCH 1/1 police: Small corrections for the output

Start a newline right before printing the index.
Print overhead with print_size().

Fixes 0d5cf51e0d6c ("police: Add support for json output")
---
 tc/m_police.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
tc/m_police.c +3 -2
index 2594c08979e0..a17ab64b1ce5 100644
@@ -301,7 +301,8 @@ static int print_police(struct action_util *a, FILE *f, struct rtattr *arg)
 	    RTA_PAYLOAD(tb[TCA_POLICE_RATE64]) >= sizeof(rate64))
 		rate64 = rta_getattr_u64(tb[TCA_POLICE_RATE64]);
 
-	print_uint(PRINT_ANY, "index", "\t index %u ", p->index);
+	print_nl();
+	print_uint(PRINT_ANY, "index", "\tindex %u ", p->index);
 	tc_print_rate(PRINT_FP, NULL, "rate %s ", rate64);
 	buffer = tc_calc_xmitsize(rate64, p->burst);
 	print_size(PRINT_FP, NULL, "burst %s ", buffer);
@@ -342,7 +343,7 @@ static int print_police(struct action_util *a, FILE *f, struct rtattr *arg)
 		print_string(PRINT_FP, NULL, " ", NULL);
 	}
 
-	print_uint(PRINT_ANY, "overhead", "overhead %u ", p->rate.overhead);
+	print_size(PRINT_ANY, "overhead", "overhead %s ", p->rate.overhead);
 	linklayer = (p->rate.linklayer & TC_LINKLAYER_MASK);
 	if (linklayer > TC_LINKLAYER_ETHERNET || show_details)
 		print_string(PRINT_ANY, "linklayer", "linklayer %s ",
Signature · 1 line
2.8.0
author
#1 lore raw
Quoted 25 lines · Roi Dayan

Start a newline right before printing the index.
Print overhead with print_size().

Fixes 0d5cf51e0d6c ("police: Add support for json output")
---
  tc/m_police.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
tc/m_police.c +2 -1
index 2594c08979e0..a17ab64b1ce5 100644
@@ -301,7 +301,8 @@ static int print_police(struct action_util *a, FILE *f, struct rtattr *arg)
  	    RTA_PAYLOAD(tb[TCA_POLICE_RATE64]) >= sizeof(rate64))
  		rate64 = rta_getattr_u64(tb[TCA_POLICE_RATE64]);
 
-	print_uint(PRINT_ANY, "index", "\t index %u ", p->index);
+	print_nl();
+	print_uint(PRINT_ANY, "index", "\tindex %u ", p->index);
  	tc_print_rate(PRINT_FP, NULL, "rate %s ", rate64);
  	buffer = tc_calc_xmitsize(rate64, p->burst);
  	print_size(PRINT_FP, NULL, "burst %s ", buffer);

tc/m_police.c static int print_police(struct action_util *a, FILE *f, struct rtattr *arg) · line 349

Quoted 8 lines
tc/m_police.c +1 -1
@@ -342,7 +343,7 @@ static int print_police(struct action_util *a, FILE *f, struct rtattr *arg)
  		print_string(PRINT_FP, NULL, " ", NULL);
  	}
 
-	print_uint(PRINT_ANY, "overhead", "overhead %u ", p->rate.overhead);
+	print_size(PRINT_ANY, "overhead", "overhead %s ", p->rate.overhead);
  	linklayer = (p->rate.linklayer & TC_LINKLAYER_MASK);
  	if (linklayer > TC_LINKLAYER_ETHERNET || show_details)
  		print_string(PRINT_ANY, "linklayer", "linklayer %s ",

sorry forgot also the newline before ref. as Stephen Hemminger pointed out. will send v2.