unused arguments
Subsystems (2)
cover unused arguments
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(-)
Signature · 1 line
2.43.0
PATCH 1/7 tc/u32: remove FILE argument
The pretty printing routines no longer use the file handle.
--- tc/f_u32.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
tc/f_u32.c +7 -7
@@ -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]);
Signature · 1 line
2.43.0
PATCH 2/7 tc/util: remove unused argument from print_tm
In reply to Stephen HemmingerFile argument no longer used.
--- 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(-)
tc/m_bpf.c +1 -1
@@ -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); } }
tc/m_connmark.c +1 -1
@@ -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 ();
tc/m_csum.c +1 -1
@@ -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 ();
tc/m_ct.c +1 -1
@@ -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 ();
tc/m_ctinfo.c +1 -1
@@ -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 ])
tc/m_gact.c +1 -1
@@ -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 ();
tc/m_gate.c +1 -1
@@ -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); } }
tc/m_ife.c +1 -1
@@ -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); } }
tc/m_mirred.c +1 -1
@@ -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 ();
tc/m_mpls.c +1 -1
@@ -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); } }
tc/m_nat.c +1 -1
@@ -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); } }
tc/m_pedit.c +1 -1
@@ -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" );
tc/m_police.c +1 -1
@@ -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 ();
tc/m_sample.c +1 -1
@@ -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 ();
tc/m_simple.c +1 -1
@@ -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 ();
tc/m_skbedit.c +1 -1
@@ -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); } }
tc/m_skbmod.c +1 -1
@@ -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); } }
tc/m_tunnel_key.c +1 -1
@@ -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); } }
tc/m_vlan.c +1 -1
@@ -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); } }
tc/tc_util.c +1 -1
@@ -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 ();
tc/tc_util.h +1 -1
@@ -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);
Signature · 1 line
2.43.0
PATCH 3/7 tc/util: remove unused argument from print_action_control
In reply to Stephen HemmingerThe FILE handle is no longer used.
--- 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(-)
tc/m_bpf.c +1 -1
@@ -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);
tc/m_connmark.c +1 -1
@@ -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);
tc/m_csum.c +1 -1
@@ -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);
tc/m_ct.c +1 -1
@@ -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);
tc/m_ctinfo.c +1 -1
@@ -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);
tc/m_gact.c +2 -2
@@ -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
tc/m_gate.c +1 -1
@@ -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);
tc/m_ife.c +1 -1
@@ -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 ]);
tc/m_mirred.c +1 -1
@@ -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);
tc/m_mpls.c +1 -1
@@ -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);
tc/m_nat.c +1 -1
@@ -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);
tc/m_pedit.c +1 -1
@@ -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);
tc/m_police.c +2 -2
@@ -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 ); }
tc/m_sample.c +1 -1
@@ -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);
tc/m_skbedit.c +1 -1
@@ -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);
tc/m_skbmod.c +1 -1
@@ -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 ]);
tc/m_tunnel_key.c +1 -1
@@ -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);
tc/m_vlan.c +1 -1
@@ -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);
tc/tc_util.c +1 -2
@@ -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" );
tc/tc_util.h +1 -2
@@ -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);
Signature · 1 line
2.43.0
PATCH 4/7 tc/police: remove unused argument to tc_print_police
In reply to Stephen HemmingerFILE handle no longer used.
--- 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(-)
tc/f_basic.c +1 -1
@@ -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 ]) {
tc/f_bpf.c +1 -1
@@ -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 ])
tc/f_cgroup.c +1 -1
@@ -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 ])
tc/f_flow.c +1 -1
@@ -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 );
tc/f_fw.c +1 -1
@@ -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 ];
tc/f_route.c +1 -1
@@ -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 ;
tc/f_u32.c +1 -1
@@ -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 ]) {
tc/m_police.c +3 -3
@@ -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); }
tc/tc_util.h +1 -1
@@ -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);
Signature · 1 line
2.43.0
PATCH 5/7 tc/util: remove unused argument from print_tcstats2_attr
In reply to Stephen HemmingerThe function doesn't use the FILE handle.
--- tc/m_action.c | 2 +- tc/tc_util.c | 5 ++--- tc/tc_util.h | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-)
tc/m_action.c +1 -1
@@ -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 (); }
tc/tc_util.c +2 -3
@@ -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 ;
tc/tc_util.h +1 -2
@@ -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);
Signature · 1 line
2.43.0
PATCH 6/7 tc/action: remove unused args from tc_print_action
In reply to Stephen HemmingerThe file handle is not used, and total actions is always zero.
--- 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(-)
tc/f_basic.c +1 -1
@@ -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 ;
tc/f_bpf.c +1 -1
@@ -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 ; }
tc/f_cgroup.c +1 -1
@@ -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 ; }
tc/f_flow.c +1 -1
@@ -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 ; }
tc/f_flower.c +1 -1
@@ -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 ; }
tc/f_fw.c +1 -1
@@ -156,7 +156,7 @@ static int fw_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt, __uif (tb[TCA_FW_ACT ]) {print_nl (); -tc_print_action (f, tb[TCA_FW_ACT ],0 ); +tc_print_action (tb[TCA_FW_ACT ]); }return 0 ; }
tc/f_matchall.c +1 -1
@@ -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 ; }
tc/f_route.c +1 -1
@@ -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 ; }
tc/f_u32.c +1 -1
@@ -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 ; }
tc/m_action.c +15 -13
@@ -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",
tc/tc_util.h +1 -1
@@ -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);
Signature · 1 line
2.43.0
PATCH 7/7 tc/police: remove unused prototype police_print_xstats
In reply to Stephen Hemminger--- tc/tc_util.h | 1 - 1 file changed, 1 deletion(-)
tc/tc_util.h +0 -1
@@ -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);
Signature · 1 line
2.43.0
Quoted 4 lines · 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.
Quoted 9 lines
Stephen Hemminger (7):
tc/u32: remove FILE argument
tc/util: remove unused argument fromprint_tmtc/util: remove unused argument fromprint_action_controltc/police: remove unused argument totc_print_policetc/util: remove unused argument fromprint_tcstats2_attrtc/action: remove unused args fromtc_print_actiontc/police: remove unused prototypepolice_print_xstats
applied the first 5. Patches 6 and 7 required too many adjustments - easier to respin the patch.