[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220201042819.322106-2-stephen@networkplumber.org>
Date: Mon, 31 Jan 2022 20:28:19 -0800
From: Stephen Hemminger <stephen@...workplumber.org>
To: dsahern@...il.com
Cc: netdev@...r.kernel.org, Victor Nogueira <victor@...atatu.com>,
Jamal Hadi Salim <jhs@...atatu.com>,
Stephen Hemminger <stephen@...workplumber.org>
Subject: [PATCH iproute2-next 2/2] tc/f_flower: fix indentation
Introduce print_indent_name_value to do the indented style
used in flower.
Signed-off-by: Stephen Hemminger <stephen@...workplumber.org>
---
This was in second version of clang patches but missed during merge.
tc/f_flower.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/tc/f_flower.c b/tc/f_flower.c
index 674e0d0384db..d3f79bdf4252 100644
--- a/tc/f_flower.c
+++ b/tc/f_flower.c
@@ -102,6 +102,13 @@ static void explain(void)
" to specify different mask, he has to use different prio.\n");
}
+/* prints newline, two spaces, name/value */
+static void print_indent_name_value(const char *name, const char *value)
+{
+ print_string(PRINT_FP, NULL, "%s ", _SL_);
+ print_string_name_value(name, value);
+}
+
static int flower_parse_eth_addr(char *str, int addr_type, int mask_type,
struct nlmsghdr *n)
{
@@ -1945,8 +1952,7 @@ static void flower_print_eth_addr(const char *name, struct rtattr *addr_attr,
sprintf(out + done, "/%d", bits);
}
- print_nl();
- print_string_name_value(name, out);
+ print_indent_name_value(name, out);
}
static void flower_print_eth_type(__be16 *p_eth_type,
@@ -2089,8 +2095,7 @@ static void flower_print_ip_addr(char *name, __be16 eth_type,
else if (bits < len * 8)
sprintf(out + done, "/%d", bits);
- print_nl();
- print_string_name_value(name, out);
+ print_indent_name_value(name, out);
}
static void flower_print_ip4_addr(char *name, struct rtattr *addr_attr,
@@ -2123,8 +2128,7 @@ static void flower_print_port_range(char *name, struct rtattr *min_attr,
done = sprintf(out, "%u", rta_getattr_be16(min_attr));
sprintf(out + done, "-%u", rta_getattr_be16(max_attr));
- print_nl();
- print_string_name_value(name, out);
+ print_indent_name_value(name, out);
}
}
@@ -2141,8 +2145,7 @@ static void flower_print_tcp_flags(const char *name, struct rtattr *flags_attr,
if (mask_attr)
sprintf(out + done, "/%x", rta_getattr_be16(mask_attr));
- print_nl();
- print_string_name_value(name, out);
+ print_indent_name_value(name, out);
}
static void flower_print_ct_state(struct rtattr *flags_attr,
@@ -2438,8 +2441,7 @@ static void flower_print_masked_u8(const char *name, struct rtattr *attr,
if (mask != UINT8_MAX)
sprintf(out + done, "/%d", mask);
- print_nl();
- print_string_name_value(name, out);
+ print_indent_name_value(name, out);
}
static void flower_print_u8(const char *name, struct rtattr *attr)
--
2.34.1
Powered by blists - more mailing lists