diff mbox

[08/10] ss: symmetrical subhandler output extension example

Message ID 1439162006-11421-9-git-send-email-matthias.tafelmeier@gmx.net
State Superseded, archived
Delegated to: stephen hemminger
Headers show

Commit Message

Matthias Tafelmeier Aug. 9, 2015, 11:13 p.m. UTC
This small sized patch shall convey the locations which have to be
changed for a symmetrical output extension. Symmetrical means in this
context all existing semantically related handlers in the diverse
formatters (for hr and json up to now).

Signed-off-by: Matthias Tafelmeier <matthias.tafelmeier@gmx.net>
Suggested-by: Hagen Paul Pfeifer <hagen@jauu.net>
---
 misc/ss_hr_fmt.c   | 2 ++
 misc/ss_json_fmt.c | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

Comments

Sergei Shtylyov Aug. 10, 2015, 12:19 p.m. UTC | #1
On 8/10/2015 2:13 AM, Matthias Tafelmeier wrote:

> This small sized patch shall convey the locations which have to be
> changed for a symmetrical output extension. Symmetrical means in this
> context all existing semantically related handlers in the diverse
> formatters (for hr and json up to now).

> Signed-off-by: Matthias Tafelmeier <matthias.tafelmeier@gmx.net>
> Suggested-by: Hagen Paul Pfeifer <hagen@jauu.net>

[...]

> diff --git a/misc/ss_json_fmt.c b/misc/ss_json_fmt.c
> index f1a53cd..e80f063 100644
> --- a/misc/ss_json_fmt.c
> +++ b/misc/ss_json_fmt.c
> @@ -161,7 +161,9 @@ static void tcp_stats_json_fmt(struct tcpstat *s)
>   	if (s->rcv_rtt) {
>   		printf(",\n%s\"rcv_rtt\": %g", indent1, s->rcv_rtt);
>   	}
> -
> +	if (s->rcv_space) {
> +		printf(",\n%s\"rcv_space\": %d", indent1, s->rcv_space);
> +	}

    {} not needed. I guess you haven't run your patches thru 
scripts/checkpatch.pl?

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Dumazet Aug. 10, 2015, 2:53 p.m. UTC | #2
On Mon, 2015-08-10 at 15:19 +0300, Sergei Shtylyov wrote:

>     {} not needed. I guess you haven't run your patches thru 
> scripts/checkpatch.pl?
> 

Yes, although this is missing from iproute2 sources ;)


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Matthias Tafelmeier Aug. 10, 2015, 5:06 p.m. UTC | #3
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA384


>> {} not needed. I guess you haven't run your patches thru 
>> scripts/checkpatch.pl?
>> 
> 
> Yes, although this is missing from iproute2 sources ;)
> 
> 

Thank you for reviewing so far.

I see there slipped some parts of the patch through according
checkpatch.pl for which I am responsible. I will give a V2 patch for
these asap.

Nevertheless, there are parts of the patch for which I am not liable,
so please bear with me. I only copied those over from the origin
version. Well, I am quite prepared to correct them as well in order to
come up for the "history break".


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBCQAGBQJVyNoMAAoJEOAWT1uK3zQ7jOcH/3WJWNM+gcKDz/Hbj2oQLcli
M3jkIICJFZhSlCUqI0DjmVecy3ryDtxZjM4HuHcqPP8nqmdP7ykiO7p89PLTF2iC
XgA7UMMTByNJD6WSz7kjwWFlPXhvffrhE4yNZe+WkTE+HrJ8GPVydnhnr+Xo4L3g
YYDns9VWAHQgD14bd36FaoZkYmlXM1WQJZm5sgMCYWEq8ZpIHFJhqKRD6Y7e29rK
eI8BQchv30QHQiCzFOIyTqm7ncUb9CE8brBC1IFEFs9Eli5CQCoiriXANR3ntsjB
dU/6P3NuyAkis7CWILgGaKSNi0h/DPhszZQh5Gfjl4FFE5vszCVup6pM1evBWH0=
=mcKX
-----END PGP SIGNATURE-----
Sergei Shtylyov Aug. 10, 2015, 6:19 p.m. UTC | #4
On 08/10/2015 05:53 PM, Eric Dumazet wrote:

>>      {} not needed. I guess you haven't run your patches thru
>> scripts/checkpatch.pl?

> Yes, although this is missing from iproute2 sources ;)

    Oh, sorry, somehow I thought it's a kernel patch. :-)

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/misc/ss_hr_fmt.c b/misc/ss_hr_fmt.c
index 6955ea5..40b6b7c 100644
--- a/misc/ss_hr_fmt.c
+++ b/misc/ss_hr_fmt.c
@@ -82,6 +82,8 @@  static void tcp_stats_hr_fmt(struct tcpstat *s)
 		printf(" reordering:%d", s->reordering);
 	if (s->rcv_rtt)
 		printf(" rcv_rtt:%g", s->rcv_rtt);
+	if (s->rcv_space)
+		printf(" rcv_space:%d", s->rcv_space);
 
 	CHECK_FMT_ADAPT(s->rcv_space, s,
 	hr_handler_must_be_adapted_accordingly_when_json_fmt_is_extended);
diff --git a/misc/ss_json_fmt.c b/misc/ss_json_fmt.c
index f1a53cd..e80f063 100644
--- a/misc/ss_json_fmt.c
+++ b/misc/ss_json_fmt.c
@@ -161,7 +161,9 @@  static void tcp_stats_json_fmt(struct tcpstat *s)
 	if (s->rcv_rtt) {
 		printf(",\n%s\"rcv_rtt\": %g", indent1, s->rcv_rtt);
 	}
-
+	if (s->rcv_space) {
+		printf(",\n%s\"rcv_space\": %d", indent1, s->rcv_space);
+	}
 	/*deal with special case */
 	res_json_fmt_branch(s->ss.state == SS_LISTEN, ' ');