* [PATCH iproute2-next 0/7] unused arguments
@ 2024-04-13 22:04 Stephen Hemminger
2024-04-13 22:04 ` [PATCH iproute2-next 1/7] tc/u32: remove FILE argument Stephen Hemminger
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Stephen Hemminger @ 2024-04-13 22:04 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
While looking at finishing JSON support for TC in all places,
noticed that there was a lot of places with left over unused
arguments.
Stephen Hemminger (7):
tc/u32: remove FILE argument
tc/util: remove unused argument from print_tm
tc/util: remove unused argument from print_action_control
tc/police: remove unused argument to tc_print_police
tc/util: remove unused argument from print_tcstats2_attr
tc/action: remove unused args from tc_print_action
tc/police: remove unused prototype police_print_xstats
tc/f_basic.c | 4 ++--
tc/f_bpf.c | 4 ++--
tc/f_cgroup.c | 4 ++--
tc/f_flow.c | 4 ++--
tc/f_flower.c | 2 +-
tc/f_fw.c | 4 ++--
tc/f_matchall.c | 2 +-
tc/f_route.c | 4 ++--
tc/f_u32.c | 18 +++++++++---------
tc/m_action.c | 30 ++++++++++++++++--------------
tc/m_bpf.c | 4 ++--
tc/m_connmark.c | 4 ++--
tc/m_csum.c | 4 ++--
tc/m_ct.c | 4 ++--
tc/m_ctinfo.c | 4 ++--
tc/m_gact.c | 6 +++---
tc/m_gate.c | 4 ++--
tc/m_ife.c | 4 ++--
tc/m_mirred.c | 4 ++--
tc/m_mpls.c | 4 ++--
tc/m_nat.c | 4 ++--
tc/m_pedit.c | 4 ++--
tc/m_police.c | 12 ++++++------
tc/m_sample.c | 4 ++--
tc/m_simple.c | 2 +-
tc/m_skbedit.c | 4 ++--
tc/m_skbmod.c | 4 ++--
tc/m_tunnel_key.c | 4 ++--
tc/m_vlan.c | 4 ++--
tc/tc_util.c | 10 ++++------
tc/tc_util.h | 13 +++++--------
31 files changed, 90 insertions(+), 93 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH iproute2-next 1/7] tc/u32: remove FILE argument
2024-04-13 22:04 [PATCH iproute2-next 0/7] unused arguments Stephen Hemminger
@ 2024-04-13 22:04 ` Stephen Hemminger
2024-04-13 22:04 ` [PATCH iproute2-next 2/7] tc/util: remove unused argument from print_tm Stephen Hemminger
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Stephen Hemminger @ 2024-04-13 22:04 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
The pretty printing routines no longer use the file handle.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
tc/f_u32.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/tc/f_u32.c b/tc/f_u32.c
index 8a241310..f8e1ff6e 100644
--- a/tc/f_u32.c
+++ b/tc/f_u32.c
@@ -820,7 +820,7 @@ static int parse_hashkey(int *argc_p, char ***argv_p, struct tc_u32_sel *sel)
return 0;
}
-static void print_ipv4(FILE *f, const struct tc_u32_key *key)
+static void print_ipv4(const struct tc_u32_key *key)
{
char abuf[256];
@@ -895,7 +895,7 @@ static void print_ipv4(FILE *f, const struct tc_u32_key *key)
close_json_object();
}
-static void print_ipv6(FILE *f, const struct tc_u32_key *key)
+static void print_ipv6(const struct tc_u32_key *key)
{
char abuf[256];
@@ -971,7 +971,7 @@ static void print_ipv6(FILE *f, const struct tc_u32_key *key)
close_json_object();
}
-static void print_raw(FILE *f, const struct tc_u32_key *key)
+static void print_raw(const struct tc_u32_key *key)
{
open_json_object("match");
print_nl();
@@ -985,14 +985,14 @@ static void print_raw(FILE *f, const struct tc_u32_key *key)
static const struct {
__u16 proto;
__u16 pad;
- void (*pprinter)(FILE *f, const struct tc_u32_key *key);
+ void (*pprinter)(const struct tc_u32_key *key);
} u32_pprinters[] = {
{0, 0, print_raw},
{ETH_P_IP, 0, print_ipv4},
{ETH_P_IPV6, 0, print_ipv6},
};
-static void show_keys(FILE *f, const struct tc_u32_key *key)
+static void show_keys(const struct tc_u32_key *key)
{
int i = 0;
@@ -1002,7 +1002,7 @@ static void show_keys(FILE *f, const struct tc_u32_key *key)
for (i = 0; i < ARRAY_SIZE(u32_pprinters); i++) {
if (u32_pprinters[i].proto == ntohs(f_proto)) {
show_k:
- u32_pprinters[i].pprinter(f, key);
+ u32_pprinters[i].pprinter(key);
return;
}
}
@@ -1333,7 +1333,7 @@ static int u32_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt,
int i;
for (i = 0; i < sel->nkeys; i++) {
- show_keys(f, sel->keys + i);
+ show_keys(sel->keys + i);
if (show_stats && NULL != pf)
print_u64(PRINT_ANY, "success", " (success %llu ) ",
pf->kcnts[i]);
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH iproute2-next 2/7] tc/util: remove unused argument from print_tm
2024-04-13 22:04 [PATCH iproute2-next 0/7] unused arguments Stephen Hemminger
2024-04-13 22:04 ` [PATCH iproute2-next 1/7] tc/u32: remove FILE argument Stephen Hemminger
@ 2024-04-13 22:04 ` Stephen Hemminger
2024-04-13 22:04 ` [PATCH iproute2-next 3/7] tc/util: remove unused argument from print_action_control Stephen Hemminger
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Stephen Hemminger @ 2024-04-13 22:04 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
File argument no longer used.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
tc/m_bpf.c | 2 +-
tc/m_connmark.c | 2 +-
tc/m_csum.c | 2 +-
tc/m_ct.c | 2 +-
tc/m_ctinfo.c | 2 +-
tc/m_gact.c | 2 +-
tc/m_gate.c | 2 +-
tc/m_ife.c | 2 +-
tc/m_mirred.c | 2 +-
tc/m_mpls.c | 2 +-
tc/m_nat.c | 2 +-
tc/m_pedit.c | 2 +-
tc/m_police.c | 2 +-
tc/m_sample.c | 2 +-
tc/m_simple.c | 2 +-
tc/m_skbedit.c | 2 +-
tc/m_skbmod.c | 2 +-
tc/m_tunnel_key.c | 2 +-
tc/m_vlan.c | 2 +-
tc/tc_util.c | 2 +-
tc/tc_util.h | 2 +-
21 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/tc/m_bpf.c b/tc/m_bpf.c
index da50c05e..5cae51ba 100644
--- a/tc/m_bpf.c
+++ b/tc/m_bpf.c
@@ -200,7 +200,7 @@ static int bpf_print_opt(struct action_util *au, FILE *f, struct rtattr *arg)
if (tb[TCA_ACT_BPF_TM]) {
struct tcf_t *tm = RTA_DATA(tb[TCA_ACT_BPF_TM]);
- print_tm(f, tm);
+ print_tm(tm);
}
}
diff --git a/tc/m_connmark.c b/tc/m_connmark.c
index 8506d95a..bd388665 100644
--- a/tc/m_connmark.c
+++ b/tc/m_connmark.c
@@ -123,7 +123,7 @@ static int print_connmark(struct action_util *au, FILE *f, struct rtattr *arg)
if (tb[TCA_CONNMARK_TM]) {
struct tcf_t *tm = RTA_DATA(tb[TCA_CONNMARK_TM]);
- print_tm(f, tm);
+ print_tm(tm);
}
}
print_nl();
diff --git a/tc/m_csum.c b/tc/m_csum.c
index f5fe8f55..966ae18e 100644
--- a/tc/m_csum.c
+++ b/tc/m_csum.c
@@ -213,7 +213,7 @@ print_csum(struct action_util *au, FILE *f, struct rtattr *arg)
if (tb[TCA_CSUM_TM]) {
struct tcf_t *tm = RTA_DATA(tb[TCA_CSUM_TM]);
- print_tm(f, tm);
+ print_tm(tm);
}
}
print_nl();
diff --git a/tc/m_ct.c b/tc/m_ct.c
index 8c471489..95098c88 100644
--- a/tc/m_ct.c
+++ b/tc/m_ct.c
@@ -534,7 +534,7 @@ static int print_ct(struct action_util *au, FILE *f, struct rtattr *arg)
if (tb[TCA_CT_TM]) {
struct tcf_t *tm = RTA_DATA(tb[TCA_CT_TM]);
- print_tm(f, tm);
+ print_tm(tm);
}
}
print_nl();
diff --git a/tc/m_ctinfo.c b/tc/m_ctinfo.c
index 996a3621..606ab280 100644
--- a/tc/m_ctinfo.c
+++ b/tc/m_ctinfo.c
@@ -166,7 +166,7 @@ static void print_ctinfo_stats(FILE *f, struct rtattr *tb[TCA_CTINFO_MAX + 1])
if (tb[TCA_CTINFO_TM]) {
tm = RTA_DATA(tb[TCA_CTINFO_TM]);
- print_tm(f, tm);
+ print_tm(tm);
}
if (tb[TCA_CTINFO_STATS_DSCP_SET])
diff --git a/tc/m_gact.c b/tc/m_gact.c
index 225ffce4..0d90963c 100644
--- a/tc/m_gact.c
+++ b/tc/m_gact.c
@@ -203,7 +203,7 @@ print_gact(struct action_util *au, FILE *f, struct rtattr *arg)
if (tb[TCA_GACT_TM]) {
struct tcf_t *tm = RTA_DATA(tb[TCA_GACT_TM]);
- print_tm(f, tm);
+ print_tm(tm);
}
}
print_nl();
diff --git a/tc/m_gate.c b/tc/m_gate.c
index 37afa426..b2643ad8 100644
--- a/tc/m_gate.c
+++ b/tc/m_gate.c
@@ -527,7 +527,7 @@ static int print_gate(struct action_util *au, FILE *f, struct rtattr *arg)
if (tb[TCA_GATE_TM]) {
struct tcf_t *tm = RTA_DATA(tb[TCA_GATE_TM]);
- print_tm(f, tm);
+ print_tm(tm);
}
}
diff --git a/tc/m_ife.c b/tc/m_ife.c
index 162607ce..f5b2d52d 100644
--- a/tc/m_ife.c
+++ b/tc/m_ife.c
@@ -315,7 +315,7 @@ static int print_ife(struct action_util *au, FILE *f, struct rtattr *arg)
if (tb[TCA_IFE_TM]) {
struct tcf_t *tm = RTA_DATA(tb[TCA_IFE_TM]);
- print_tm(f, tm);
+ print_tm(tm);
}
}
diff --git a/tc/m_mirred.c b/tc/m_mirred.c
index 60bd9045..5e9856e0 100644
--- a/tc/m_mirred.c
+++ b/tc/m_mirred.c
@@ -348,7 +348,7 @@ print_mirred(struct action_util *au, FILE *f, struct rtattr *arg)
if (tb[TCA_MIRRED_TM]) {
struct tcf_t *tm = RTA_DATA(tb[TCA_MIRRED_TM]);
- print_tm(f, tm);
+ print_tm(tm);
}
}
print_nl();
diff --git a/tc/m_mpls.c b/tc/m_mpls.c
index dda46805..a378e35e 100644
--- a/tc/m_mpls.c
+++ b/tc/m_mpls.c
@@ -283,7 +283,7 @@ static int print_mpls(struct action_util *au, FILE *f, struct rtattr *arg)
if (tb[TCA_MPLS_TM]) {
struct tcf_t *tm = RTA_DATA(tb[TCA_MPLS_TM]);
- print_tm(f, tm);
+ print_tm(tm);
}
}
diff --git a/tc/m_nat.c b/tc/m_nat.c
index 95b35584..e4c74b08 100644
--- a/tc/m_nat.c
+++ b/tc/m_nat.c
@@ -179,7 +179,7 @@ print_nat(struct action_util *au, FILE * f, struct rtattr *arg)
if (tb[TCA_NAT_TM]) {
struct tcf_t *tm = RTA_DATA(tb[TCA_NAT_TM]);
- print_tm(f, tm);
+ print_tm(tm);
}
}
diff --git a/tc/m_pedit.c b/tc/m_pedit.c
index 32f03415..fc06d04b 100644
--- a/tc/m_pedit.c
+++ b/tc/m_pedit.c
@@ -801,7 +801,7 @@ static int print_pedit(struct action_util *au, FILE *f, struct rtattr *arg)
if (tb[TCA_PEDIT_TM]) {
struct tcf_t *tm = RTA_DATA(tb[TCA_PEDIT_TM]);
- print_tm(f, tm);
+ print_tm(tm);
}
}
open_json_array(PRINT_JSON, "keys");
diff --git a/tc/m_police.c b/tc/m_police.c
index 46c39a81..d140c1eb 100644
--- a/tc/m_police.c
+++ b/tc/m_police.c
@@ -347,7 +347,7 @@ static int print_police(struct action_util *a, FILE *f, struct rtattr *arg)
if (tb[TCA_POLICE_TM]) {
struct tcf_t *tm = RTA_DATA(tb[TCA_POLICE_TM]);
- print_tm(f, tm);
+ print_tm(tm);
}
}
print_nl();
diff --git a/tc/m_sample.c b/tc/m_sample.c
index 769de144..36e4c1db 100644
--- a/tc/m_sample.c
+++ b/tc/m_sample.c
@@ -171,7 +171,7 @@ static int print_sample(struct action_util *au, FILE *f, struct rtattr *arg)
if (tb[TCA_SAMPLE_TM]) {
struct tcf_t *tm = RTA_DATA(tb[TCA_SAMPLE_TM]);
- print_tm(f, tm);
+ print_tm(tm);
}
}
print_nl();
diff --git a/tc/m_simple.c b/tc/m_simple.c
index fe2bca21..a2366187 100644
--- a/tc/m_simple.c
+++ b/tc/m_simple.c
@@ -187,7 +187,7 @@ static int print_simple(struct action_util *au, FILE *f, struct rtattr *arg)
if (tb[TCA_DEF_TM]) {
struct tcf_t *tm = RTA_DATA(tb[TCA_DEF_TM]);
- print_tm(f, tm);
+ print_tm(tm);
}
}
print_nl();
diff --git a/tc/m_skbedit.c b/tc/m_skbedit.c
index d55a6128..00b245ee 100644
--- a/tc/m_skbedit.c
+++ b/tc/m_skbedit.c
@@ -250,7 +250,7 @@ static int print_skbedit(struct action_util *au, FILE *f, struct rtattr *arg)
if (tb[TCA_SKBEDIT_TM]) {
struct tcf_t *tm = RTA_DATA(tb[TCA_SKBEDIT_TM]);
- print_tm(f, tm);
+ print_tm(tm);
}
}
diff --git a/tc/m_skbmod.c b/tc/m_skbmod.c
index b1c8d00d..c7a2ccd5 100644
--- a/tc/m_skbmod.c
+++ b/tc/m_skbmod.c
@@ -218,7 +218,7 @@ static int print_skbmod(struct action_util *au, FILE *f, struct rtattr *arg)
if (tb[TCA_SKBMOD_TM]) {
struct tcf_t *tm = RTA_DATA(tb[TCA_SKBMOD_TM]);
- print_tm(f, tm);
+ print_tm(tm);
}
}
diff --git a/tc/m_tunnel_key.c b/tc/m_tunnel_key.c
index ff699cc8..e62f9118 100644
--- a/tc/m_tunnel_key.c
+++ b/tc/m_tunnel_key.c
@@ -742,7 +742,7 @@ static int print_tunnel_key(struct action_util *au, FILE *f, struct rtattr *arg)
if (tb[TCA_TUNNEL_KEY_TM]) {
struct tcf_t *tm = RTA_DATA(tb[TCA_TUNNEL_KEY_TM]);
- print_tm(f, tm);
+ print_tm(tm);
}
}
diff --git a/tc/m_vlan.c b/tc/m_vlan.c
index c1dc8b42..31d3b06f 100644
--- a/tc/m_vlan.c
+++ b/tc/m_vlan.c
@@ -293,7 +293,7 @@ static int print_vlan(struct action_util *au, FILE *f, struct rtattr *arg)
if (tb[TCA_VLAN_TM]) {
struct tcf_t *tm = RTA_DATA(tb[TCA_VLAN_TM]);
- print_tm(f, tm);
+ print_tm(tm);
}
}
diff --git a/tc/tc_util.c b/tc/tc_util.c
index aa7cf60f..25c8d6b6 100644
--- a/tc/tc_util.c
+++ b/tc/tc_util.c
@@ -650,7 +650,7 @@ const char *get_clock_name(clockid_t clockid)
return "invalid";
}
-void print_tm(FILE *f, const struct tcf_t *tm)
+void print_tm(const struct tcf_t *tm)
{
int hz = get_user_hz();
diff --git a/tc/tc_util.h b/tc/tc_util.h
index 623d9888..152ef3e6 100644
--- a/tc/tc_util.h
+++ b/tc/tc_util.h
@@ -114,7 +114,7 @@ void print_action_control(FILE *f, const char *prefix,
int police_print_xstats(struct action_util *a, FILE *f, struct rtattr *tb);
int tc_print_action(FILE *f, const struct rtattr *tb, unsigned short tot_acts);
int parse_action(int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n);
-void print_tm(FILE *f, const struct tcf_t *tm);
+void print_tm(const struct tcf_t *tm);
int prio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt);
int cls_names_init(char *path);
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH iproute2-next 3/7] tc/util: remove unused argument from print_action_control
2024-04-13 22:04 [PATCH iproute2-next 0/7] unused arguments Stephen Hemminger
2024-04-13 22:04 ` [PATCH iproute2-next 1/7] tc/u32: remove FILE argument Stephen Hemminger
2024-04-13 22:04 ` [PATCH iproute2-next 2/7] tc/util: remove unused argument from print_tm Stephen Hemminger
@ 2024-04-13 22:04 ` Stephen Hemminger
2024-04-13 22:04 ` [PATCH iproute2-next 4/7] tc/police: remove unused argument to tc_print_police Stephen Hemminger
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Stephen Hemminger @ 2024-04-13 22:04 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
The FILE handle is no longer used.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
tc/m_bpf.c | 2 +-
tc/m_connmark.c | 2 +-
tc/m_csum.c | 2 +-
tc/m_ct.c | 2 +-
tc/m_ctinfo.c | 2 +-
tc/m_gact.c | 4 ++--
tc/m_gate.c | 2 +-
tc/m_ife.c | 2 +-
tc/m_mirred.c | 2 +-
tc/m_mpls.c | 2 +-
tc/m_nat.c | 2 +-
tc/m_pedit.c | 2 +-
tc/m_police.c | 4 ++--
tc/m_sample.c | 2 +-
tc/m_skbedit.c | 2 +-
tc/m_skbmod.c | 2 +-
tc/m_tunnel_key.c | 2 +-
tc/m_vlan.c | 2 +-
tc/tc_util.c | 3 +--
tc/tc_util.h | 3 +--
20 files changed, 22 insertions(+), 24 deletions(-)
diff --git a/tc/m_bpf.c b/tc/m_bpf.c
index 5cae51ba..f0cfd066 100644
--- a/tc/m_bpf.c
+++ b/tc/m_bpf.c
@@ -191,7 +191,7 @@ static int bpf_print_opt(struct action_util *au, FILE *f, struct rtattr *arg)
b, sizeof(b)));
}
- print_action_control(f, "default-action ", parm->action, _SL_);
+ print_action_control("default-action ", parm->action, _SL_);
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);
diff --git a/tc/m_connmark.c b/tc/m_connmark.c
index bd388665..880500fa 100644
--- a/tc/m_connmark.c
+++ b/tc/m_connmark.c
@@ -112,7 +112,7 @@ static int print_connmark(struct action_util *au, FILE *f, struct rtattr *arg)
ci = RTA_DATA(tb[TCA_CONNMARK_PARMS]);
print_uint(PRINT_ANY, "zone", "zone %u", ci->zone);
- print_action_control(f, " ", ci->action, "");
+ print_action_control(" ", ci->action, "");
print_nl();
print_uint(PRINT_ANY, "index", "\t index %u", ci->index);
diff --git a/tc/m_csum.c b/tc/m_csum.c
index 966ae18e..8724bf0d 100644
--- a/tc/m_csum.c
+++ b/tc/m_csum.c
@@ -204,7 +204,7 @@ print_csum(struct action_util *au, FILE *f, struct rtattr *arg)
uflag_4, uflag_5, uflag_6, uflag_7);
print_string(PRINT_ANY, "csum", "(%s) ", buf);
- print_action_control(f, "action ", sel->action, _SL_);
+ print_action_control("action ", sel->action, _SL_);
print_uint(PRINT_ANY, "index", "\tindex %u", sel->index);
print_int(PRINT_ANY, "ref", " ref %d", sel->refcnt);
print_int(PRINT_ANY, "bind", " bind %d", sel->bindcnt);
diff --git a/tc/m_ct.c b/tc/m_ct.c
index 95098c88..3d71d8d4 100644
--- a/tc/m_ct.c
+++ b/tc/m_ct.c
@@ -523,7 +523,7 @@ static int print_ct(struct action_util *au, FILE *f, struct rtattr *arg)
ct_print_helper(tb[TCA_CT_HELPER_FAMILY], tb[TCA_CT_HELPER_PROTO], tb[TCA_CT_HELPER_NAME]);
ct_print_nat(ct_action, tb);
- print_action_control(f, " ", p->action, "");
+ print_action_control(" ", p->action, "");
print_nl();
print_uint(PRINT_ANY, "index", "\t index %u", p->index);
diff --git a/tc/m_ctinfo.c b/tc/m_ctinfo.c
index 606ab280..2021d46d 100644
--- a/tc/m_ctinfo.c
+++ b/tc/m_ctinfo.c
@@ -236,7 +236,7 @@ static int print_ctinfo(struct action_util *au, FILE *f, struct rtattr *arg)
zone = rta_getattr_u16(tb[TCA_CTINFO_ZONE]);
print_hu(PRINT_ANY, "zone", "zone %u", zone);
- print_action_control(f, " ", ci->action, "");
+ print_action_control(" ", ci->action, "");
print_nl();
print_uint(PRINT_ANY, "index", "\t index %u", ci->index);
diff --git a/tc/m_gact.c b/tc/m_gact.c
index 0d90963c..111dff28 100644
--- a/tc/m_gact.c
+++ b/tc/m_gact.c
@@ -178,7 +178,7 @@ print_gact(struct action_util *au, FILE *f, struct rtattr *arg)
}
p = RTA_DATA(tb[TCA_GACT_PARMS]);
- print_action_control(f, "action ", p->action, "");
+ print_action_control("action ", p->action, "");
#ifdef CONFIG_GACT_PROB
if (tb[TCA_GACT_PROB] != NULL) {
pp = RTA_DATA(tb[TCA_GACT_PROB]);
@@ -191,7 +191,7 @@ print_gact(struct action_util *au, FILE *f, struct rtattr *arg)
print_nl();
print_string(PRINT_ANY, "random_type", "\t random type %s",
prob_n2a(pp->ptype));
- print_action_control(f, " ", pp->paction, " ");
+ print_action_control(" ", pp->paction, " ");
print_int(PRINT_ANY, "val", "val %d", pp->pval);
close_json_object();
#endif
diff --git a/tc/m_gate.c b/tc/m_gate.c
index b2643ad8..ea49b09f 100644
--- a/tc/m_gate.c
+++ b/tc/m_gate.c
@@ -517,7 +517,7 @@ static int print_gate(struct action_util *au, FILE *f, struct rtattr *arg)
if (tb[TCA_GATE_ENTRY_LIST])
print_gate_list(tb[TCA_GATE_ENTRY_LIST]);
- print_action_control(f, "\t", parm->action, "");
+ print_action_control("\t", parm->action, "");
print_uint(PRINT_ANY, "index", "\n\t index %u", parm->index);
print_int(PRINT_ANY, "ref", " ref %d", parm->refcnt);
diff --git a/tc/m_ife.c b/tc/m_ife.c
index f5b2d52d..08b9d7de 100644
--- a/tc/m_ife.c
+++ b/tc/m_ife.c
@@ -236,7 +236,7 @@ static int print_ife(struct action_util *au, FILE *f, struct rtattr *arg)
print_string(PRINT_ANY, "mode", "%s ",
p->flags & IFE_ENCODE ? "encode" : "decode");
- print_action_control(f, "action ", p->action, " ");
+ print_action_control("action ", p->action, " ");
if (tb[TCA_IFE_TYPE]) {
ife_type = rta_getattr_u16(tb[TCA_IFE_TYPE]);
diff --git a/tc/m_mirred.c b/tc/m_mirred.c
index 5e9856e0..714f2472 100644
--- a/tc/m_mirred.c
+++ b/tc/m_mirred.c
@@ -337,7 +337,7 @@ print_mirred(struct action_util *au, FILE *f, struct rtattr *arg)
print_string(PRINT_ANY, "to_dev", " to device %s)", dev);
}
- print_action_control(f, " ", p->action, "");
+ print_action_control(" ", p->action, "");
print_nl();
print_uint(PRINT_ANY, "index", "\tindex %u", p->index);
diff --git a/tc/m_mpls.c b/tc/m_mpls.c
index a378e35e..65b7163d 100644
--- a/tc/m_mpls.c
+++ b/tc/m_mpls.c
@@ -272,7 +272,7 @@ static int print_mpls(struct action_util *au, FILE *f, struct rtattr *arg)
}
break;
}
- print_action_control(f, " ", parm->action, "");
+ print_action_control(" ", parm->action, "");
print_nl();
print_uint(PRINT_ANY, "index", "\t index %u", parm->index);
diff --git a/tc/m_nat.c b/tc/m_nat.c
index e4c74b08..ec421cdc 100644
--- a/tc/m_nat.c
+++ b/tc/m_nat.c
@@ -169,7 +169,7 @@ print_nat(struct action_util *au, FILE * f, struct rtattr *arg)
print_string(PRINT_ANY, "new_addr", " %s",
format_host_r(AF_INET, 4, &sel->new_addr, buf1, sizeof(buf1)));
- print_action_control(f, " ", sel->action, "");
+ print_action_control(" ", sel->action, "");
print_nl();
print_uint(PRINT_ANY, "index", "\t index %u", sel->index);
print_int(PRINT_ANY, "ref", " ref %d", sel->refcnt);
diff --git a/tc/m_pedit.c b/tc/m_pedit.c
index fc06d04b..5afa33d9 100644
--- a/tc/m_pedit.c
+++ b/tc/m_pedit.c
@@ -791,7 +791,7 @@ static int print_pedit(struct action_util *au, FILE *f, struct rtattr *arg)
}
}
- print_action_control(f, "action ", sel->action, " ");
+ print_action_control("action ", sel->action, " ");
print_uint(PRINT_ANY, "nkeys", "keys %d\n", sel->nkeys);
print_uint(PRINT_ANY, "index", " \t index %u", sel->index);
print_int(PRINT_ANY, "ref", " ref %d", sel->refcnt);
diff --git a/tc/m_police.c b/tc/m_police.c
index d140c1eb..02e50142 100644
--- a/tc/m_police.c
+++ b/tc/m_police.c
@@ -325,12 +325,12 @@ static int print_police(struct action_util *a, FILE *f, struct rtattr *arg)
print_u64(PRINT_ANY, "pkts_burst", "pkts_burst %llu ", ppsburst64);
}
- print_action_control(f, "action ", p->action, "");
+ print_action_control("action ", p->action, "");
if (tb[TCA_POLICE_RESULT]) {
__u32 action = rta_getattr_u32(tb[TCA_POLICE_RESULT]);
- print_action_control(f, "/", action, " ");
+ print_action_control("/", action, " ");
} else {
print_string(PRINT_FP, NULL, " ", NULL);
}
diff --git a/tc/m_sample.c b/tc/m_sample.c
index 36e4c1db..6e2bca58 100644
--- a/tc/m_sample.c
+++ b/tc/m_sample.c
@@ -160,7 +160,7 @@ static int print_sample(struct action_util *au, FILE *f, struct rtattr *arg)
print_uint(PRINT_ANY, "trunc_size", " trunc_size %u",
rta_getattr_u32(tb[TCA_SAMPLE_TRUNC_SIZE]));
- print_action_control(f, " ", p->action, "");
+ print_action_control(" ", p->action, "");
print_nl();
print_uint(PRINT_ANY, "index", "\t index %u", p->index);
diff --git a/tc/m_skbedit.c b/tc/m_skbedit.c
index 00b245ee..8e25c268 100644
--- a/tc/m_skbedit.c
+++ b/tc/m_skbedit.c
@@ -239,7 +239,7 @@ static int print_skbedit(struct action_util *au, FILE *f, struct rtattr *arg)
"inheritdsfield");
}
- print_action_control(f, " ", p->action, "");
+ print_action_control(" ", p->action, "");
print_nl();
print_uint(PRINT_ANY, "index", "\t index %u", p->index);
diff --git a/tc/m_skbmod.c b/tc/m_skbmod.c
index c7a2ccd5..acb118b5 100644
--- a/tc/m_skbmod.c
+++ b/tc/m_skbmod.c
@@ -178,7 +178,7 @@ static int print_skbmod(struct action_util *au, FILE *f, struct rtattr *arg)
p = RTA_DATA(tb[TCA_SKBMOD_PARMS]);
fprintf(f, "skbmod ");
- print_action_control(f, "", p->action, " ");
+ print_action_control("", p->action, " ");
if (tb[TCA_SKBMOD_ETYPE]) {
skbmod_etype = rta_getattr_u16(tb[TCA_SKBMOD_ETYPE]);
diff --git a/tc/m_tunnel_key.c b/tc/m_tunnel_key.c
index e62f9118..83adb09c 100644
--- a/tc/m_tunnel_key.c
+++ b/tc/m_tunnel_key.c
@@ -731,7 +731,7 @@ static int print_tunnel_key(struct action_util *au, FILE *f, struct rtattr *arg)
tb[TCA_TUNNEL_KEY_ENC_TTL]);
break;
}
- print_action_control(f, " ", parm->action, "");
+ print_action_control(" ", parm->action, "");
print_nl();
print_uint(PRINT_ANY, "index", "\t index %u", parm->index);
diff --git a/tc/m_vlan.c b/tc/m_vlan.c
index 31d3b06f..fb5a0669 100644
--- a/tc/m_vlan.c
+++ b/tc/m_vlan.c
@@ -282,7 +282,7 @@ static int print_vlan(struct action_util *au, FILE *f, struct rtattr *arg)
print_string(PRINT_ANY, "src_mac", " src_mac %s", b1);
}
}
- print_action_control(f, " ", parm->action, "");
+ print_action_control(" ", parm->action, "");
print_nl();
print_uint(PRINT_ANY, "index", "\t index %u", parm->index);
diff --git a/tc/tc_util.c b/tc/tc_util.c
index 25c8d6b6..133fe9f9 100644
--- a/tc/tc_util.c
+++ b/tc/tc_util.c
@@ -539,8 +539,7 @@ int parse_action_control_slash(int *argc_p, char ***argv_p,
return 0;
}
-void print_action_control(FILE *f, const char *prefix,
- int action, const char *suffix)
+void print_action_control(const char *prefix, int action, const char *suffix)
{
print_string(PRINT_FP, NULL, "%s", prefix);
open_json_object("control_action");
diff --git a/tc/tc_util.h b/tc/tc_util.h
index 152ef3e6..851c2092 100644
--- a/tc/tc_util.h
+++ b/tc/tc_util.h
@@ -109,8 +109,7 @@ void parse_action_control_dflt(int *argc_p, char ***argv_p,
int default_result);
int parse_action_control_slash(int *argc_p, char ***argv_p,
int *result1_p, int *result2_p, bool allow_num);
-void print_action_control(FILE *f, const char *prefix,
- int action, const char *suffix);
+void print_action_control(const char *prefix, int action, const char *suffix);
int police_print_xstats(struct action_util *a, FILE *f, struct rtattr *tb);
int tc_print_action(FILE *f, const struct rtattr *tb, unsigned short tot_acts);
int parse_action(int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n);
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH iproute2-next 4/7] tc/police: remove unused argument to tc_print_police
2024-04-13 22:04 [PATCH iproute2-next 0/7] unused arguments Stephen Hemminger
` (2 preceding siblings ...)
2024-04-13 22:04 ` [PATCH iproute2-next 3/7] tc/util: remove unused argument from print_action_control Stephen Hemminger
@ 2024-04-13 22:04 ` Stephen Hemminger
2024-04-13 22:04 ` [PATCH iproute2-next 5/7] tc/util: remove unused argument from print_tcstats2_attr Stephen Hemminger
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Stephen Hemminger @ 2024-04-13 22:04 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
FILE handle no longer used.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
tc/f_basic.c | 2 +-
tc/f_bpf.c | 2 +-
tc/f_cgroup.c | 2 +-
tc/f_flow.c | 2 +-
tc/f_fw.c | 2 +-
tc/f_route.c | 2 +-
tc/f_u32.c | 2 +-
tc/m_police.c | 6 +++---
tc/tc_util.h | 2 +-
9 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/tc/f_basic.c b/tc/f_basic.c
index 1ceb15d4..6b36028f 100644
--- a/tc/f_basic.c
+++ b/tc/f_basic.c
@@ -130,7 +130,7 @@ static int basic_print_opt(struct filter_util *qu, FILE *f,
if (tb[TCA_BASIC_POLICE]) {
print_nl();
- tc_print_police(f, tb[TCA_BASIC_POLICE]);
+ tc_print_police(tb[TCA_BASIC_POLICE]);
}
if (tb[TCA_BASIC_ACT]) {
diff --git a/tc/f_bpf.c b/tc/f_bpf.c
index a6d4875f..f265249d 100644
--- a/tc/f_bpf.c
+++ b/tc/f_bpf.c
@@ -250,7 +250,7 @@ static int bpf_print_opt(struct filter_util *qu, FILE *f,
if (tb[TCA_BPF_POLICE]) {
print_nl();
- tc_print_police(f, tb[TCA_BPF_POLICE]);
+ tc_print_police(tb[TCA_BPF_POLICE]);
}
if (tb[TCA_BPF_ACT])
diff --git a/tc/f_cgroup.c b/tc/f_cgroup.c
index 291d6e7e..d4201b91 100644
--- a/tc/f_cgroup.c
+++ b/tc/f_cgroup.c
@@ -93,7 +93,7 @@ static int cgroup_print_opt(struct filter_util *qu, FILE *f,
if (tb[TCA_CGROUP_POLICE]) {
print_nl();
- tc_print_police(f, tb[TCA_CGROUP_POLICE]);
+ tc_print_police(tb[TCA_CGROUP_POLICE]);
}
if (tb[TCA_CGROUP_ACT])
diff --git a/tc/f_flow.c b/tc/f_flow.c
index 4a29af22..07340f2a 100644
--- a/tc/f_flow.c
+++ b/tc/f_flow.c
@@ -347,7 +347,7 @@ static int flow_print_opt(struct filter_util *fu, FILE *f, struct rtattr *opt,
if (tb[TCA_FLOW_EMATCHES])
print_ematch(f, tb[TCA_FLOW_EMATCHES]);
if (tb[TCA_FLOW_POLICE])
- tc_print_police(f, tb[TCA_FLOW_POLICE]);
+ tc_print_police(tb[TCA_FLOW_POLICE]);
if (tb[TCA_FLOW_ACT]) {
print_nl();
tc_print_action(f, tb[TCA_FLOW_ACT], 0);
diff --git a/tc/f_fw.c b/tc/f_fw.c
index 5e72e526..190f79fc 100644
--- a/tc/f_fw.c
+++ b/tc/f_fw.c
@@ -146,7 +146,7 @@ static int fw_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt, __u
}
if (tb[TCA_FW_POLICE])
- tc_print_police(f, tb[TCA_FW_POLICE]);
+ tc_print_police(tb[TCA_FW_POLICE]);
if (tb[TCA_FW_INDEV]) {
struct rtattr *idev = tb[TCA_FW_INDEV];
diff --git a/tc/f_route.c b/tc/f_route.c
index ca8a8ddd..3b6f5c2f 100644
--- a/tc/f_route.c
+++ b/tc/f_route.c
@@ -165,7 +165,7 @@ static int route_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt,
print_color_string(PRINT_ANY, COLOR_IFNAME, "fromif", "fromif %s",
ll_index_to_name(rta_getattr_u32(tb[TCA_ROUTE4_IIF])));
if (tb[TCA_ROUTE4_POLICE])
- tc_print_police(f, tb[TCA_ROUTE4_POLICE]);
+ tc_print_police(tb[TCA_ROUTE4_POLICE]);
if (tb[TCA_ROUTE4_ACT])
tc_print_action(f, tb[TCA_ROUTE4_ACT], 0);
return 0;
diff --git a/tc/f_u32.c b/tc/f_u32.c
index f8e1ff6e..c04ec02d 100644
--- a/tc/f_u32.c
+++ b/tc/f_u32.c
@@ -1365,7 +1365,7 @@ static int u32_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt,
if (tb[TCA_U32_POLICE]) {
print_nl();
- tc_print_police(f, tb[TCA_U32_POLICE]);
+ tc_print_police(tb[TCA_U32_POLICE]);
}
if (tb[TCA_U32_INDEV]) {
diff --git a/tc/m_police.c b/tc/m_police.c
index 02e50142..d7a396a2 100644
--- a/tc/m_police.c
+++ b/tc/m_police.c
@@ -260,7 +260,7 @@ int parse_police(int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n)
return act_parse_police(NULL, argc_p, argv_p, tca_id, n);
}
-static int print_police(struct action_util *a, FILE *f, struct rtattr *arg)
+static int print_police(struct action_util *a, FILE *funused, struct rtattr *arg)
{
SPRINT_BUF(b2);
struct tc_police *p;
@@ -356,7 +356,7 @@ static int print_police(struct action_util *a, FILE *f, struct rtattr *arg)
return 0;
}
-int tc_print_police(FILE *f, struct rtattr *arg)
+int tc_print_police(struct rtattr *arg)
{
- return print_police(&police_action_util, f, arg);
+ return print_police(&police_action_util, NULL, arg);
}
diff --git a/tc/tc_util.h b/tc/tc_util.h
index 851c2092..de908d5e 100644
--- a/tc/tc_util.h
+++ b/tc/tc_util.h
@@ -98,7 +98,7 @@ int get_tc_classid(__u32 *h, const char *str);
int print_tc_classid(char *buf, int len, __u32 h);
char *sprint_tc_classid(__u32 h, char *buf);
-int tc_print_police(FILE *f, struct rtattr *tb);
+int tc_print_police(struct rtattr *tb);
int parse_percent(double *val, const char *str);
int parse_police(int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n);
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH iproute2-next 5/7] tc/util: remove unused argument from print_tcstats2_attr
2024-04-13 22:04 [PATCH iproute2-next 0/7] unused arguments Stephen Hemminger
` (3 preceding siblings ...)
2024-04-13 22:04 ` [PATCH iproute2-next 4/7] tc/police: remove unused argument to tc_print_police Stephen Hemminger
@ 2024-04-13 22:04 ` Stephen Hemminger
2024-04-13 22:04 ` [PATCH iproute2-next 6/7] tc/action: remove unused args from tc_print_action Stephen Hemminger
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Stephen Hemminger @ 2024-04-13 22:04 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
The function doesn't use the FILE handle.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
tc/m_action.c | 2 +-
tc/tc_util.c | 5 ++---
tc/tc_util.h | 3 +--
3 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/tc/m_action.c b/tc/m_action.c
index 6a361f11..feb869a9 100644
--- a/tc/m_action.c
+++ b/tc/m_action.c
@@ -396,7 +396,7 @@ static int tc_print_one_action(FILE *f, struct rtattr *arg, bool bind)
print_string(PRINT_FP, NULL, "\tAction statistics:", NULL);
print_nl();
open_json_object("stats");
- print_tcstats2_attr(f, tb[TCA_ACT_STATS], "\t", NULL);
+ print_tcstats2_attr(tb[TCA_ACT_STATS], "\t", NULL);
close_json_object();
print_nl();
}
diff --git a/tc/tc_util.c b/tc/tc_util.c
index 133fe9f9..f9151408 100644
--- a/tc/tc_util.c
+++ b/tc/tc_util.c
@@ -708,8 +708,7 @@ static void print_tcstats_basic_hw(struct rtattr **tbs, const char *prefix)
print_uint(PRINT_ANY, "hw_packets", " %u pkt", bs_hw.packets);
}
-void print_tcstats2_attr(FILE *fp, struct rtattr *rta,
- const char *prefix, struct rtattr **xstats)
+void print_tcstats2_attr(struct rtattr *rta, const char *prefix, struct rtattr **xstats)
{
struct rtattr *tbs[TCA_STATS_MAX + 1];
@@ -790,7 +789,7 @@ void print_tcstats_attr(FILE *fp, struct rtattr *tb[], const char *prefix,
struct rtattr **xstats)
{
if (tb[TCA_STATS2]) {
- print_tcstats2_attr(fp, tb[TCA_STATS2], prefix, xstats);
+ print_tcstats2_attr(tb[TCA_STATS2], prefix, xstats);
if (xstats && !*xstats)
goto compat_xstats;
return;
diff --git a/tc/tc_util.h b/tc/tc_util.h
index de908d5e..2d38dd58 100644
--- a/tc/tc_util.h
+++ b/tc/tc_util.h
@@ -91,8 +91,7 @@ char *sprint_linklayer(unsigned int linklayer, char *buf);
void print_tcstats_attr(FILE *fp, struct rtattr *tb[],
const char *prefix, struct rtattr **xstats);
-void print_tcstats2_attr(FILE *fp, struct rtattr *rta,
- const char *prefix, struct rtattr **xstats);
+void print_tcstats2_attr(struct rtattr *rta, const char *prefix, struct rtattr **xstats);
int get_tc_classid(__u32 *h, const char *str);
int print_tc_classid(char *buf, int len, __u32 h);
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH iproute2-next 6/7] tc/action: remove unused args from tc_print_action
2024-04-13 22:04 [PATCH iproute2-next 0/7] unused arguments Stephen Hemminger
` (4 preceding siblings ...)
2024-04-13 22:04 ` [PATCH iproute2-next 5/7] tc/util: remove unused argument from print_tcstats2_attr Stephen Hemminger
@ 2024-04-13 22:04 ` Stephen Hemminger
2024-04-13 22:04 ` [PATCH iproute2-next 7/7] tc/police: remove unused prototype police_print_xstats Stephen Hemminger
2024-04-21 1:51 ` [PATCH iproute2-next 0/7] unused arguments David Ahern
7 siblings, 0 replies; 9+ messages in thread
From: Stephen Hemminger @ 2024-04-13 22:04 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
The file handle is not used, and total actions is always zero.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
tc/f_basic.c | 2 +-
tc/f_bpf.c | 2 +-
tc/f_cgroup.c | 2 +-
tc/f_flow.c | 2 +-
tc/f_flower.c | 2 +-
tc/f_fw.c | 2 +-
tc/f_matchall.c | 2 +-
tc/f_route.c | 2 +-
tc/f_u32.c | 2 +-
tc/m_action.c | 28 +++++++++++++++-------------
tc/tc_util.h | 2 +-
11 files changed, 25 insertions(+), 23 deletions(-)
diff --git a/tc/f_basic.c b/tc/f_basic.c
index 6b36028f..b76092c6 100644
--- a/tc/f_basic.c
+++ b/tc/f_basic.c
@@ -134,7 +134,7 @@ static int basic_print_opt(struct filter_util *qu, FILE *f,
}
if (tb[TCA_BASIC_ACT]) {
- tc_print_action(f, tb[TCA_BASIC_ACT], 0);
+ tc_print_action(tb[TCA_BASIC_ACT]);
}
return 0;
diff --git a/tc/f_bpf.c b/tc/f_bpf.c
index f265249d..ad40bc99 100644
--- a/tc/f_bpf.c
+++ b/tc/f_bpf.c
@@ -254,7 +254,7 @@ static int bpf_print_opt(struct filter_util *qu, FILE *f,
}
if (tb[TCA_BPF_ACT])
- tc_print_action(f, tb[TCA_BPF_ACT], 0);
+ tc_print_action(tb[TCA_BPF_ACT]);
return 0;
}
diff --git a/tc/f_cgroup.c b/tc/f_cgroup.c
index d4201b91..ed7638ed 100644
--- a/tc/f_cgroup.c
+++ b/tc/f_cgroup.c
@@ -97,7 +97,7 @@ static int cgroup_print_opt(struct filter_util *qu, FILE *f,
}
if (tb[TCA_CGROUP_ACT])
- tc_print_action(f, tb[TCA_CGROUP_ACT], 0);
+ tc_print_action(tb[TCA_CGROUP_ACT]);
return 0;
}
diff --git a/tc/f_flow.c b/tc/f_flow.c
index 07340f2a..0e27d216 100644
--- a/tc/f_flow.c
+++ b/tc/f_flow.c
@@ -350,7 +350,7 @@ static int flow_print_opt(struct filter_util *fu, FILE *f, struct rtattr *opt,
tc_print_police(tb[TCA_FLOW_POLICE]);
if (tb[TCA_FLOW_ACT]) {
print_nl();
- tc_print_action(f, tb[TCA_FLOW_ACT], 0);
+ tc_print_action(tb[TCA_FLOW_ACT]);
}
return 0;
}
diff --git a/tc/f_flower.c b/tc/f_flower.c
index 53188f1c..1d2cff46 100644
--- a/tc/f_flower.c
+++ b/tc/f_flower.c
@@ -3178,7 +3178,7 @@ static int flower_print_opt(struct filter_util *qu, FILE *f,
}
if (tb[TCA_FLOWER_ACT])
- tc_print_action(f, tb[TCA_FLOWER_ACT], 0);
+ tc_print_action(tb[TCA_FLOWER_ACT]);
return 0;
}
diff --git a/tc/f_fw.c b/tc/f_fw.c
index 190f79fc..80809f13 100644
--- a/tc/f_fw.c
+++ b/tc/f_fw.c
@@ -156,7 +156,7 @@ static int fw_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt, __u
if (tb[TCA_FW_ACT]) {
print_nl();
- tc_print_action(f, tb[TCA_FW_ACT], 0);
+ tc_print_action(tb[TCA_FW_ACT]);
}
return 0;
}
diff --git a/tc/f_matchall.c b/tc/f_matchall.c
index 38b68d7e..2ecf028b 100644
--- a/tc/f_matchall.c
+++ b/tc/f_matchall.c
@@ -155,7 +155,7 @@ static int matchall_print_opt(struct filter_util *qu, FILE *f,
if (tb[TCA_MATCHALL_ACT])
- tc_print_action(f, tb[TCA_MATCHALL_ACT], 0);
+ tc_print_action(tb[TCA_MATCHALL_ACT]);
return 0;
}
diff --git a/tc/f_route.c b/tc/f_route.c
index 3b6f5c2f..0af2fde1 100644
--- a/tc/f_route.c
+++ b/tc/f_route.c
@@ -167,7 +167,7 @@ static int route_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt,
if (tb[TCA_ROUTE4_POLICE])
tc_print_police(tb[TCA_ROUTE4_POLICE]);
if (tb[TCA_ROUTE4_ACT])
- tc_print_action(f, tb[TCA_ROUTE4_ACT], 0);
+ tc_print_action(tb[TCA_ROUTE4_ACT]);
return 0;
}
diff --git a/tc/f_u32.c b/tc/f_u32.c
index c04ec02d..6e2e00b1 100644
--- a/tc/f_u32.c
+++ b/tc/f_u32.c
@@ -1377,7 +1377,7 @@ static int u32_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt,
}
if (tb[TCA_U32_ACT])
- tc_print_action(f, tb[TCA_U32_ACT], 0);
+ tc_print_action(tb[TCA_U32_ACT]);
return 0;
}
diff --git a/tc/m_action.c b/tc/m_action.c
index feb869a9..6910562e 100644
--- a/tc/m_action.c
+++ b/tc/m_action.c
@@ -41,7 +41,7 @@ static void act_usage(void)
*/
fprintf(stderr,
"usage: tc actions <ACTSPECOP>*\n"
- "Where: ACTSPECOP := ACR | GD | FL\n"
+ "Where: ACTSPECOP := ACR | GD | FL\n"
" ACR := add | change | replace <ACTSPEC>*\n"
" GD := get | delete | <ACTISPEC>*\n"
" FL := ls | list | flush | <ACTNAMESPEC>\n"
@@ -360,7 +360,7 @@ bad_val:
return -1;
}
-static int tc_print_one_action(FILE *f, struct rtattr *arg, bool bind)
+static int tc_print_one_action(struct rtattr *arg, bool bind)
{
struct rtattr *tb[TCA_ACT_MAX + 1];
@@ -382,7 +382,7 @@ static int tc_print_one_action(FILE *f, struct rtattr *arg, bool bind)
if (a == NULL)
return err;
- err = a->print_aopt(a, f, tb[TCA_ACT_OPTIONS]);
+ err = a->print_aopt(a, stdout, tb[TCA_ACT_OPTIONS]);
if (err < 0)
return err;
@@ -466,7 +466,7 @@ static int tc_print_one_action(FILE *f, struct rtattr *arg, bool bind)
}
static int
-tc_print_action_flush(FILE *f, const struct rtattr *arg)
+tc_print_action_flush(const struct rtattr *arg)
{
struct rtattr *tb[TCA_MAX + 1];
@@ -486,16 +486,18 @@ tc_print_action_flush(FILE *f, const struct rtattr *arg)
return err;
delete_count = RTA_DATA(tb[TCA_FCNT]);
- fprintf(f, " %s (%d entries)\n", a->id, *delete_count);
+ print_string(PRINT_FP, NULL, " %s ", a->id);
+ open_json_object(a->id);
+ print_int(PRINT_ANY, "entries", "(%d entries)\n", *delete_count);
+ close_json_object();
+
tab_flush = 0;
return 0;
}
static int
-tc_dump_action(FILE *f, const struct rtattr *arg, unsigned short tot_acts,
- bool bind)
+tc_dump_action(const struct rtattr *arg, unsigned short tot_acts, bool bind)
{
-
int i;
if (arg == NULL)
@@ -509,7 +511,7 @@ tc_dump_action(FILE *f, const struct rtattr *arg, unsigned short tot_acts,
parse_rtattr_nested(tb, tot_acts, arg);
if (tab_flush && tb[0] && !tb[1])
- return tc_print_action_flush(f, tb[0]);
+ return tc_print_action_flush(tb[0]);
open_json_array(PRINT_JSON, "actions");
for (i = 0; i <= tot_acts; i++) {
@@ -518,7 +520,7 @@ tc_dump_action(FILE *f, const struct rtattr *arg, unsigned short tot_acts,
print_nl();
print_uint(PRINT_ANY, "order",
"\taction order %u: ", i);
- if (tc_print_one_action(f, tb[i], bind) < 0)
+ if (tc_print_one_action(tb[i], bind) < 0)
fprintf(stderr, "Error printing action\n");
close_json_object();
}
@@ -530,9 +532,9 @@ tc_dump_action(FILE *f, const struct rtattr *arg, unsigned short tot_acts,
}
int
-tc_print_action(FILE *f, const struct rtattr *arg, unsigned short tot_acts)
+tc_print_action(const struct rtattr *arg)
{
- return tc_dump_action(f, arg, tot_acts, true);
+ return tc_dump_action(arg, 0, true);
}
int print_action(struct nlmsghdr *n, void *arg)
@@ -585,7 +587,7 @@ int print_action(struct nlmsghdr *n, void *arg)
}
open_json_object(NULL);
- tc_dump_action(fp, tb[TCA_ACT_TAB], tot_acts ? *tot_acts:0, false);
+ tc_dump_action(tb[TCA_ACT_TAB], tot_acts ? *tot_acts : 0, false);
if (tb[TCA_ROOT_EXT_WARN_MSG]) {
print_string(PRINT_ANY, "warn", "%s",
diff --git a/tc/tc_util.h b/tc/tc_util.h
index 2d38dd58..a1137bc2 100644
--- a/tc/tc_util.h
+++ b/tc/tc_util.h
@@ -110,7 +110,7 @@ int parse_action_control_slash(int *argc_p, char ***argv_p,
int *result1_p, int *result2_p, bool allow_num);
void print_action_control(const char *prefix, int action, const char *suffix);
int police_print_xstats(struct action_util *a, FILE *f, struct rtattr *tb);
-int tc_print_action(FILE *f, const struct rtattr *tb, unsigned short tot_acts);
+int tc_print_action(const struct rtattr *tb);
int parse_action(int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n);
void print_tm(const struct tcf_t *tm);
int prio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt);
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH iproute2-next 7/7] tc/police: remove unused prototype police_print_xstats
2024-04-13 22:04 [PATCH iproute2-next 0/7] unused arguments Stephen Hemminger
` (5 preceding siblings ...)
2024-04-13 22:04 ` [PATCH iproute2-next 6/7] tc/action: remove unused args from tc_print_action Stephen Hemminger
@ 2024-04-13 22:04 ` Stephen Hemminger
2024-04-21 1:51 ` [PATCH iproute2-next 0/7] unused arguments David Ahern
7 siblings, 0 replies; 9+ messages in thread
From: Stephen Hemminger @ 2024-04-13 22:04 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
tc/tc_util.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/tc/tc_util.h b/tc/tc_util.h
index a1137bc2..86200f1e 100644
--- a/tc/tc_util.h
+++ b/tc/tc_util.h
@@ -109,7 +109,6 @@ void parse_action_control_dflt(int *argc_p, char ***argv_p,
int parse_action_control_slash(int *argc_p, char ***argv_p,
int *result1_p, int *result2_p, bool allow_num);
void print_action_control(const char *prefix, int action, const char *suffix);
-int police_print_xstats(struct action_util *a, FILE *f, struct rtattr *tb);
int tc_print_action(const struct rtattr *tb);
int parse_action(int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n);
void print_tm(const struct tcf_t *tm);
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH iproute2-next 0/7] unused arguments
2024-04-13 22:04 [PATCH iproute2-next 0/7] unused arguments Stephen Hemminger
` (6 preceding siblings ...)
2024-04-13 22:04 ` [PATCH iproute2-next 7/7] tc/police: remove unused prototype police_print_xstats Stephen Hemminger
@ 2024-04-21 1:51 ` David Ahern
7 siblings, 0 replies; 9+ messages in thread
From: David Ahern @ 2024-04-21 1:51 UTC (permalink / raw)
To: Stephen Hemminger, netdev
On 4/13/24 4:04 PM, Stephen Hemminger wrote:
> While looking at finishing JSON support for TC in all places,
> noticed that there was a lot of places with left over unused
> arguments.
>
> Stephen Hemminger (7):
> tc/u32: remove FILE argument
> tc/util: remove unused argument from print_tm
> tc/util: remove unused argument from print_action_control
> tc/police: remove unused argument to tc_print_police
> tc/util: remove unused argument from print_tcstats2_attr
> tc/action: remove unused args from tc_print_action
> tc/police: remove unused prototype police_print_xstats
>
applied the first 5. Patches 6 and 7 required too many adjustments -
easier to respin the patch.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-04-21 1:51 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-13 22:04 [PATCH iproute2-next 0/7] unused arguments Stephen Hemminger
2024-04-13 22:04 ` [PATCH iproute2-next 1/7] tc/u32: remove FILE argument Stephen Hemminger
2024-04-13 22:04 ` [PATCH iproute2-next 2/7] tc/util: remove unused argument from print_tm Stephen Hemminger
2024-04-13 22:04 ` [PATCH iproute2-next 3/7] tc/util: remove unused argument from print_action_control Stephen Hemminger
2024-04-13 22:04 ` [PATCH iproute2-next 4/7] tc/police: remove unused argument to tc_print_police Stephen Hemminger
2024-04-13 22:04 ` [PATCH iproute2-next 5/7] tc/util: remove unused argument from print_tcstats2_attr Stephen Hemminger
2024-04-13 22:04 ` [PATCH iproute2-next 6/7] tc/action: remove unused args from tc_print_action Stephen Hemminger
2024-04-13 22:04 ` [PATCH iproute2-next 7/7] tc/police: remove unused prototype police_print_xstats Stephen Hemminger
2024-04-21 1:51 ` [PATCH iproute2-next 0/7] unused arguments David Ahern
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).