netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2-next] tc: jsonify output of q_fifo
@ 2018-10-05  0:08 Jakub Kicinski
  2018-10-05  0:10 ` Stephen Hemminger
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2018-10-05  0:08 UTC (permalink / raw)
  To: dsahern; +Cc: netdev, oss-drivers, Jakub Kicinski

Print limits correctly in JSON context.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
---
 tc/q_fifo.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tc/q_fifo.c b/tc/q_fifo.c
index cb86a404d4de..61493fbbc5bc 100644
--- a/tc/q_fifo.c
+++ b/tc/q_fifo.c
@@ -69,9 +69,12 @@ static int fifo_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 	qopt = RTA_DATA(opt);
 	if (strcmp(qu->id, "bfifo") == 0) {
 		SPRINT_BUF(b1);
-		fprintf(f, "limit %s", sprint_size(qopt->limit, b1));
-	} else
-		fprintf(f, "limit %up", qopt->limit);
+		print_uint(PRINT_JSON, "limit", NULL, qopt->limit);
+		print_string(PRINT_FP, NULL, "limit %s",
+			     sprint_size(qopt->limit, b1));
+	} else {
+		print_uint(PRINT_ANY, "limit", "limit %up", qopt->limit);
+	}
 	return 0;
 }
 
-- 
2.17.1

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

* Re: [PATCH iproute2-next] tc: jsonify output of q_fifo
  2018-10-05  0:08 [PATCH iproute2-next] tc: jsonify output of q_fifo Jakub Kicinski
@ 2018-10-05  0:10 ` Stephen Hemminger
  2018-10-05  0:31   ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2018-10-05  0:10 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: dsahern, netdev, oss-drivers

On Thu,  4 Oct 2018 17:08:34 -0700
Jakub Kicinski <jakub.kicinski@netronome.com> wrote:

> Print limits correctly in JSON context.
> 
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
> ---
>  tc/q_fifo.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/tc/q_fifo.c b/tc/q_fifo.c
> index cb86a404d4de..61493fbbc5bc 100644
> --- a/tc/q_fifo.c
> +++ b/tc/q_fifo.c
> @@ -69,9 +69,12 @@ static int fifo_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
>  	qopt = RTA_DATA(opt);
>  	if (strcmp(qu->id, "bfifo") == 0) {
>  		SPRINT_BUF(b1);
> -		fprintf(f, "limit %s", sprint_size(qopt->limit, b1));
> -	} else
> -		fprintf(f, "limit %up", qopt->limit);
> +		print_uint(PRINT_JSON, "limit", NULL, qopt->limit);
> +		print_string(PRINT_FP, NULL, "limit %s",
> +			     sprint_size(qopt->limit, b1));
> +	} else {
> +		print_uint(PRINT_ANY, "limit", "limit %up", qopt->limit);
> +	}
>  	return 0;
>  }
>  

This can go to current not net-next, since it is a bug fix really.

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

* Re: [PATCH iproute2-next] tc: jsonify output of q_fifo
  2018-10-05  0:10 ` Stephen Hemminger
@ 2018-10-05  0:31   ` Jakub Kicinski
  0 siblings, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2018-10-05  0:31 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dsahern, netdev, oss-drivers

On Thu, 4 Oct 2018 17:10:58 -0700, Stephen Hemminger wrote:
> On Thu,  4 Oct 2018 17:08:34 -0700
> Jakub Kicinski <jakub.kicinski@netronome.com> wrote:
> 
> > Print limits correctly in JSON context.
> > 
> > Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
> > ---
> >  tc/q_fifo.c | 9 ++++++---
> >  1 file changed, 6 insertions(+), 3 deletions(-)
> > 
> > diff --git a/tc/q_fifo.c b/tc/q_fifo.c
> > index cb86a404d4de..61493fbbc5bc 100644
> > --- a/tc/q_fifo.c
> > +++ b/tc/q_fifo.c
> > @@ -69,9 +69,12 @@ static int fifo_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
> >  	qopt = RTA_DATA(opt);
> >  	if (strcmp(qu->id, "bfifo") == 0) {
> >  		SPRINT_BUF(b1);
> > -		fprintf(f, "limit %s", sprint_size(qopt->limit, b1));
> > -	} else
> > -		fprintf(f, "limit %up", qopt->limit);
> > +		print_uint(PRINT_JSON, "limit", NULL, qopt->limit);
> > +		print_string(PRINT_FP, NULL, "limit %s",
> > +			     sprint_size(qopt->limit, b1));
> > +	} else {
> > +		print_uint(PRINT_ANY, "limit", "limit %up", qopt->limit);
> > +	}
> >  	return 0;
> >  }
> >    
> 
> This can go to current not net-next, since it is a bug fix really.

No preference on my side, should I resend?  

(Apologies for not CCing you!)

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

end of thread, other threads:[~2018-10-05  7:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-05  0:08 [PATCH iproute2-next] tc: jsonify output of q_fifo Jakub Kicinski
2018-10-05  0:10 ` Stephen Hemminger
2018-10-05  0:31   ` Jakub Kicinski

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