[PATCH v4 07/10] ss: symmetrical subhandler output extension example
From: Matthias Tafelmeier <hidden>
Date: 2015-08-30 13:25:18
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Matthias Tafelmeier <hidden>
Date: 2015-08-30 13:25:18
Subsystem:
the rest · Maintainer:
Linus Torvalds
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). Suggested-by: Hagen Paul Pfeifer <redacted> Signed-off-by: Matthias Tafelmeier <redacted> --- misc/ss_hr_fmt.c | 2 ++ misc/ss_json_fmt.c | 2 ++ 2 files changed, 4 insertions(+)
diff --git a/misc/ss_hr_fmt.c b/misc/ss_hr_fmt.c
index 2f09838..4046ebf 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 dde09f7..bf51a44 100644
--- a/misc/ss_json_fmt.c
+++ b/misc/ss_json_fmt.c@@ -143,6 +143,8 @@ static void tcp_stats_json_fmt(struct tcpstat *s) jsonw_int_field(json_wr, "reordering", s->reordering); if (s->rcv_rtt) jsonw_float_field(json_wr, "rcv_rtt", s->rcv_rtt); + if (s->rcv_space) + jsonw_int_field(json_wr, "rcv_space", s->rcv_space); /*deal with special case */ res_json_fmt_branch(s->ss.state == SS_LISTEN, ' ');
--
1.9.1