]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
Replace open-coded instances of print_nl()
authorBenjamin Poirier <bpoirier@cumulusnetworks.com>
Fri, 1 May 2020 08:47:20 +0000 (17:47 +0900)
committerStephen Hemminger <stephen@networkplumber.org>
Tue, 5 May 2020 00:13:53 +0000 (17:13 -0700)
Signed-off-by: Benjamin Poirier <bpoirier@cumulusnetworks.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
12 files changed:
bridge/vlan.c
tc/m_action.c
tc/m_connmark.c
tc/m_ctinfo.c
tc/m_ife.c
tc/m_mpls.c
tc/m_nat.c
tc/m_sample.c
tc/m_skbedit.c
tc/m_tunnel_key.c
tc/q_taprio.c
tc/tc_util.c

index 8753d4c327bc12666c21c797d76a9532306165ca..0d142bc9055da1000896ec89df400f5bc7292ab0 100644 (file)
@@ -360,7 +360,7 @@ static void print_vlan_tunnel_info(struct rtattr *tb, int ifindex)
                }
                print_range("tunid", last_tunid_start, tunnel_id);
                close_json_object();
-               print_string(PRINT_FP, NULL, "%s", _SL_);
+               print_nl();
        }
 
        if (opened)
@@ -644,7 +644,7 @@ void print_vlan_info(struct rtattr *tb, int ifindex)
 
                print_vlan_flags(vinfo->flags);
                close_json_object();
-               print_string(PRINT_FP, NULL, "%s", _SL_);
+               print_nl();
        }
 
        if (opened)
index b41782de9a024d11f5011407245e04c222dfd96e..66e672453c25ec527913545735867fcefa4fd954 100644 (file)
@@ -177,7 +177,7 @@ static void print_hw_stats(const struct rtattr *arg, bool print_used)
                        print_string(PRINT_ANY, NULL, " %s", item->str);
        }
        close_json_array(PRINT_JSON, NULL);
-       print_string(PRINT_FP, NULL, "%s", _SL_);
+       print_nl();
 }
 
 static int parse_hw_stats(const char *str, struct nlmsghdr *n)
@@ -376,11 +376,11 @@ static int tc_print_one_action(FILE *f, struct rtattr *arg)
 
        if (show_stats && tb[TCA_ACT_STATS]) {
                print_string(PRINT_FP, NULL, "\tAction statistics:", NULL);
-               print_string(PRINT_FP, NULL, "%s", _SL_);
+               print_nl();
                open_json_object("stats");
                print_tcstats2_attr(f, tb[TCA_ACT_STATS], "\t", NULL);
                close_json_object();
-               print_string(PRINT_FP, NULL, "%s", _SL_);
+               print_nl();
        }
        if (tb[TCA_ACT_COOKIE]) {
                int strsz = RTA_PAYLOAD(tb[TCA_ACT_COOKIE]);
@@ -389,7 +389,7 @@ static int tc_print_one_action(FILE *f, struct rtattr *arg)
                print_string(PRINT_ANY, "cookie", "\tcookie %s",
                             hexstring_n2a(RTA_DATA(tb[TCA_ACT_COOKIE]),
                                           strsz, b1, sizeof(b1)));
-               print_string(PRINT_FP, NULL, "%s", _SL_);
+               print_nl();
        }
        if (tb[TCA_ACT_FLAGS]) {
                struct nla_bitfield32 *flags = RTA_DATA(tb[TCA_ACT_FLAGS]);
@@ -398,7 +398,7 @@ static int tc_print_one_action(FILE *f, struct rtattr *arg)
                        print_bool(PRINT_ANY, "no_percpu", "\tno_percpu",
                                   flags->value &
                                   TCA_ACT_FLAGS_NO_PERCPU_STATS);
-               print_string(PRINT_FP, NULL, "%s", _SL_);
+               print_nl();
        }
        if (tb[TCA_ACT_HW_STATS])
                print_hw_stats(tb[TCA_ACT_HW_STATS], false);
@@ -458,7 +458,7 @@ tc_print_action(FILE *f, const struct rtattr *arg, unsigned short tot_acts)
        for (i = 0; i <= tot_acts; i++) {
                if (tb[i]) {
                        open_json_object(NULL);
-                       print_string(PRINT_FP, NULL, "%s", _SL_);
+                       print_nl();
                        print_uint(PRINT_ANY, "order",
                                   "\taction order %u: ", i);
                        if (tc_print_one_action(f, tb[i]) < 0) {
@@ -497,7 +497,7 @@ int print_action(struct nlmsghdr *n, void *arg)
        open_json_object(NULL);
        print_uint(PRINT_ANY, "total acts", "total acts %u",
                   tot_acts ? *tot_acts : 0);
-       print_string(PRINT_FP, NULL, "%s", _SL_);
+       print_nl();
        close_json_object();
        if (tb[TCA_ACT_TAB] == NULL) {
                if (n->nlmsg_type != RTM_GETACTION)
index eac23489fb4cacf650a02b7b208e5d712e319d6c..4b2dc4e25ef8fad3dab9b68c82afbdb584871f0d 100644 (file)
@@ -125,7 +125,7 @@ static int print_connmark(struct action_util *au, FILE *f, struct rtattr *arg)
        print_uint(PRINT_ANY, "zone", "zone %u", ci->zone);
        print_action_control(f, " ", ci->action, "");
 
-       print_string(PRINT_FP, NULL, "%s", _SL_);
+       print_nl();
        print_uint(PRINT_ANY, "index", "\t index %u", ci->index);
        print_int(PRINT_ANY, "ref", " ref %d", ci->refcnt);
        print_int(PRINT_ANY, "bind", " bind %d", ci->bindcnt);
@@ -137,7 +137,7 @@ static int print_connmark(struct action_util *au, FILE *f, struct rtattr *arg)
                        print_tm(f, tm);
                }
        }
-       print_string(PRINT_FP, NULL, "%s", _SL_);
+       print_nl();
 
        return 0;
 }
index 5e451f8752bf5907eed1affd3c853a2f9f760931..e5c1b43642a7c9acc60ae5945c31566431676a62 100644 (file)
@@ -238,7 +238,7 @@ static int print_ctinfo(struct action_util *au, FILE *f, struct rtattr *arg)
        print_hu(PRINT_ANY, "zone", "zone %u", zone);
        print_action_control(f, " ", ci->action, "");
 
-       print_string(PRINT_FP, NULL, "%s", _SL_);
+       print_nl();
        print_uint(PRINT_ANY, "index", "\t index %u", ci->index);
        print_int(PRINT_ANY, "ref", " ref %d", ci->refcnt);
        print_int(PRINT_ANY, "bind", " bind %d", ci->bindcnt);
@@ -256,7 +256,7 @@ static int print_ctinfo(struct action_util *au, FILE *f, struct rtattr *arg)
        if (show_stats)
                print_ctinfo_stats(f, tb);
 
-       print_string(PRINT_FP, NULL, "%s", _SL_);
+       print_nl();
 
        return 0;
 }
index 7c612c02d0c9c2e0c4965331247d63ae67bd313e..6a85e087ede1cc2c4085d0c51abb54218fc257aa 100644 (file)
@@ -311,7 +311,7 @@ static int print_ife(struct action_util *au, FILE *f, struct rtattr *arg)
                                         sizeof(b2)));
        }
 
-       print_string(PRINT_FP, NULL, "%s", _SL_);
+       print_nl();
        print_uint(PRINT_ANY, "index", "\t index %u", p->index);
        print_int(PRINT_ANY, "ref", " ref %d", p->refcnt);
        print_int(PRINT_ANY, "bind", " bind %d", p->bindcnt);
@@ -324,7 +324,7 @@ static int print_ife(struct action_util *au, FILE *f, struct rtattr *arg)
                }
        }
 
-       print_string(PRINT_FP, NULL, "%s", _SL_);
+       print_nl();
 
        return 0;
 }
index 50eba01cb31d116f51005fd026a219136ed0cee5..3d5d9b25fbf6a0a393d08e059b976e5233886cd9 100644 (file)
@@ -265,7 +265,7 @@ static int print_mpls(struct action_util *au, FILE *f, struct rtattr *arg)
                }
        }
 
-       print_string(PRINT_FP, NULL, "%s", _SL_);
+       print_nl();
 
        return 0;
 }
index c4b02a83c3c729ebd417a61111e723f33ff65daa..56e8f47cdefddf5955e0c40640c187cd7abba1b5 100644 (file)
@@ -172,7 +172,7 @@ print_nat(struct action_util *au, FILE * f, struct rtattr *arg)
                     format_host_r(AF_INET, 4, &sel->new_addr, buf1, sizeof(buf1)));
 
        print_action_control(f, " ", sel->action, "");
-       print_string(PRINT_FP, NULL, "%s", _SL_);
+       print_nl();
        print_uint(PRINT_ANY, "index", "\t index %u", sel->index);
        print_int(PRINT_ANY, "ref", " ref %d", sel->refcnt);
        print_int(PRINT_ANY, "bind", " bind %d", sel->bindcnt);
@@ -185,7 +185,7 @@ print_nat(struct action_util *au, FILE * f, struct rtattr *arg)
                }
        }
 
-       print_string(PRINT_FP, NULL, "%s", _SL_);
+       print_nl();
 
        return 0;
 }
index c068e6323b0cb4f8f58dde8e4e104ffeda8fcb39..4a30513a6247398a194b33f5f23a368a908706d2 100644 (file)
@@ -167,7 +167,7 @@ static int print_sample(struct action_util *au, FILE *f, struct rtattr *arg)
 
        print_action_control(f, " ", p->action, "");
 
-       print_string(PRINT_FP, NULL, "%s", _SL_);
+       print_nl();
        print_uint(PRINT_ANY, "index", "\t index %u", p->index);
        print_int(PRINT_ANY, "ref", " ref %d", p->refcnt);
        print_int(PRINT_ANY, "bind", " bind %d", p->bindcnt);
@@ -179,7 +179,7 @@ static int print_sample(struct action_util *au, FILE *f, struct rtattr *arg)
                        print_tm(f, tm);
                }
        }
-       print_string(PRINT_FP, NULL, "%s", _SL_);
+       print_nl();
        return 0;
 }
 
index 761cad586864b9d2342c5964d3285aeb44d8938a..9afe2f0c049d1a440c655abc0df9cee22eefa50c 100644 (file)
@@ -254,7 +254,7 @@ static int print_skbedit(struct action_util *au, FILE *f, struct rtattr *arg)
 
        print_action_control(f, " ", p->action, "");
 
-       print_string(PRINT_FP, NULL, "%s", _SL_);
+       print_nl();
        print_uint(PRINT_ANY, "index", "\t index %u", p->index);
        print_int(PRINT_ANY, "ref", " ref %d", p->refcnt);
        print_int(PRINT_ANY, "bind", " bind %d", p->bindcnt);
@@ -267,7 +267,7 @@ static int print_skbedit(struct action_util *au, FILE *f, struct rtattr *arg)
                }
        }
 
-       print_string(PRINT_FP, NULL, "%s", _SL_);
+       print_nl();
 
        return 0;
 }
index 8fde689137fd7b784cbefd626271825fa48d4da4..1f6921f33547a75a09881a4a8ffb6f0561c99db6 100644 (file)
@@ -367,7 +367,7 @@ static void tunnel_key_print_ip_addr(FILE *f, const char *name,
        else
                return;
 
-       print_string(PRINT_FP, NULL, "%s", _SL_);
+       print_nl();
        if (matches(name, "src_ip") == 0)
                print_string(PRINT_ANY, "src_ip", "\tsrc_ip %s",
                             rt_addr_n2a_rta(family, attr));
@@ -381,7 +381,7 @@ static void tunnel_key_print_key_id(FILE *f, const char *name,
 {
        if (!attr)
                return;
-       print_string(PRINT_FP, NULL, "%s", _SL_);
+       print_nl();
        print_uint(PRINT_ANY, "key_id", "\tkey_id %u", rta_getattr_be32(attr));
 }
 
@@ -390,7 +390,7 @@ static void tunnel_key_print_dst_port(FILE *f, char *name,
 {
        if (!attr)
                return;
-       print_string(PRINT_FP, NULL, "%s", _SL_);
+       print_nl();
        print_uint(PRINT_ANY, "dst_port", "\tdst_port %u",
                   rta_getattr_be16(attr));
 }
@@ -401,7 +401,7 @@ static void tunnel_key_print_flag(FILE *f, const char *name_on,
 {
        if (!attr)
                return;
-       print_string(PRINT_FP, NULL, "%s", _SL_);
+       print_nl();
        print_string(PRINT_ANY, "flag", "\t%s",
                     rta_getattr_u8(attr) ? name_on : name_off);
 }
@@ -473,11 +473,11 @@ static void tunnel_key_print_tos_ttl(FILE *f, char *name,
                return;
 
        if (matches(name, "tos") == 0 && rta_getattr_u8(attr) != 0) {
-               print_string(PRINT_FP, NULL, "%s", _SL_);
+               print_nl();
                print_uint(PRINT_ANY, "tos", "\ttos 0x%x",
                           rta_getattr_u8(attr));
        } else if (matches(name, "ttl") == 0 && rta_getattr_u8(attr) != 0) {
-               print_string(PRINT_FP, NULL, "%s", _SL_);
+               print_nl();
                print_uint(PRINT_ANY, "ttl", "\tttl %u",
                           rta_getattr_u8(attr));
        }
@@ -531,7 +531,7 @@ static int print_tunnel_key(struct action_util *au, FILE *f, struct rtattr *arg)
        }
        print_action_control(f, " ", parm->action, "");
 
-       print_string(PRINT_FP, NULL, "%s", _SL_);
+       print_nl();
        print_uint(PRINT_ANY, "index", "\t index %u", parm->index);
        print_int(PRINT_ANY, "ref", " ref %d", parm->refcnt);
        print_int(PRINT_ANY, "bind", " bind %d", parm->bindcnt);
@@ -544,7 +544,7 @@ static int print_tunnel_key(struct action_util *au, FILE *f, struct rtattr *arg)
                }
        }
 
-       print_string(PRINT_FP, NULL, "%s", _SL_);
+       print_nl();
 
        return 0;
 }
index b9954436b0f9fd66fbf788559dd10b42673da5d9..e43db9d0e952113732726bda5167bea50debfb80 100644 (file)
@@ -368,7 +368,7 @@ static int print_sched_list(FILE *f, struct rtattr *list)
 
        open_json_array(PRINT_JSON, "schedule");
 
-       print_string(PRINT_FP, NULL, "%s", _SL_);
+       print_nl();
 
        for (item = RTA_DATA(list); RTA_OK(item, rem); item = RTA_NEXT(item, rem)) {
                struct rtattr *tb[TCA_TAPRIO_SCHED_ENTRY_MAX + 1];
@@ -396,7 +396,7 @@ static int print_sched_list(FILE *f, struct rtattr *list)
                print_uint(PRINT_ANY, "interval", " interval %u", interval);
                close_json_object();
 
-               print_string(PRINT_FP, NULL, "%s", _SL_);
+               print_nl();
        }
 
        close_json_array(PRINT_ANY, "");
@@ -454,7 +454,7 @@ static int taprio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
                print_uint(PRINT_ANY, NULL, " %u", qopt->prio_tc_map[i]);
        close_json_array(PRINT_ANY, "");
 
-       print_string(PRINT_FP, NULL, "%s", _SL_);
+       print_nl();
 
        open_json_array(PRINT_ANY, "queues");
        for (i = 0; i < qopt->num_tc; i++) {
@@ -465,7 +465,7 @@ static int taprio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
        }
        close_json_array(PRINT_ANY, "");
 
-       print_string(PRINT_FP, NULL, "%s", _SL_);
+       print_nl();
 
        if (tb[TCA_TAPRIO_ATTR_SCHED_CLOCKID])
                clockid = rta_getattr_s32(tb[TCA_TAPRIO_ATTR_SCHED_CLOCKID]);
index 68938fb0ccddc8c8b9020b358501e7fd58a9b288..12f865cc71bfbc7a2e9140af78703f3cb8c4b84f 100644 (file)
@@ -788,7 +788,7 @@ static void print_tcstats_basic_hw(struct rtattr **tbs, char *prefix)
                           sizeof(bs)));
 
                if (bs.bytes >= bs_hw.bytes && bs.packets >= bs_hw.packets) {
-                       print_string(PRINT_FP, NULL, "%s", _SL_);
+                       print_nl();
                        print_string(PRINT_FP, NULL, "%s", prefix);
                        print_lluint(PRINT_ANY, "sw_bytes",
                                     "Sent software %llu bytes",
@@ -798,7 +798,7 @@ static void print_tcstats_basic_hw(struct rtattr **tbs, char *prefix)
                }
        }
 
-       print_string(PRINT_FP, NULL, "%s", _SL_);
+       print_nl();
        print_string(PRINT_FP, NULL, "%s", prefix);
        print_lluint(PRINT_ANY, "hw_bytes", "Sent hardware %llu bytes",
                     bs_hw.bytes);