From: Nikolay Aleksandrov <niko...@nvidia.com>

Rename print_portstate to print_stp_state in preparation for use by vlan
code as well (per-vlan state), and export it. To be in line with the new
naming rename also port_states to stp_states as they'll be used for
vlans, too.

Signed-off-by: Nikolay Aleksandrov <niko...@nvidia.com>
---
 bridge/br_common.h |  1 +
 bridge/link.c      | 14 +++++++-------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/bridge/br_common.h b/bridge/br_common.h
index b5798da300e8..e3f46765ab89 100644
--- a/bridge/br_common.h
+++ b/bridge/br_common.h
@@ -10,6 +10,7 @@ void print_vlan_info(struct rtattr *tb, int ifindex);
 int print_linkinfo(struct nlmsghdr *n, void *arg);
 int print_mdb_mon(struct nlmsghdr *n, void *arg);
 int print_fdb(struct nlmsghdr *n, void *arg);
+void print_stp_state(__u8 state);
 
 int do_fdb(int argc, char **argv);
 int do_mdb(int argc, char **argv);
diff --git a/bridge/link.c b/bridge/link.c
index d88c469db78e..a8cfa1814986 100644
--- a/bridge/link.c
+++ b/bridge/link.c
@@ -19,7 +19,7 @@
 
 static unsigned int filter_index;
 
-static const char *port_states[] = {
+static const char *stp_states[] = {
        [BR_STATE_DISABLED] = "disabled",
        [BR_STATE_LISTENING] = "listening",
        [BR_STATE_LEARNING] = "learning",
@@ -68,11 +68,11 @@ static void print_link_flags(FILE *fp, unsigned int flags, 
unsigned int mdown)
        close_json_array(PRINT_ANY, "> ");
 }
 
-static void print_portstate(__u8 state)
+void print_stp_state(__u8 state)
 {
        if (state <= BR_STATE_BLOCKING)
                print_string(PRINT_ANY, "state",
-                            "state %s ", port_states[state]);
+                            "state %s ", stp_states[state]);
        else
                print_uint(PRINT_ANY, "state",
                             "state (%d) ", state);
@@ -96,7 +96,7 @@ static void print_protinfo(FILE *fp, struct rtattr *attr)
                parse_rtattr_nested(prtb, IFLA_BRPORT_MAX, attr);
 
                if (prtb[IFLA_BRPORT_STATE])
-                       
print_portstate(rta_getattr_u8(prtb[IFLA_BRPORT_STATE]));
+                       
print_stp_state(rta_getattr_u8(prtb[IFLA_BRPORT_STATE]));
 
                if (prtb[IFLA_BRPORT_PRIORITY])
                        print_uint(PRINT_ANY, "priority",
@@ -161,7 +161,7 @@ static void print_protinfo(FILE *fp, struct rtattr *attr)
                        print_on_off(PRINT_ANY, "isolated", "isolated %s ",
                                     
rta_getattr_u8(prtb[IFLA_BRPORT_ISOLATED]));
        } else
-               print_portstate(rta_getattr_u8(attr));
+               print_stp_state(rta_getattr_u8(attr));
 }
 
 
@@ -359,12 +359,12 @@ static int brlink_modify(int argc, char **argv)
                } else if (strcmp(*argv, "state") == 0) {
                        NEXT_ARG();
                        char *endptr;
-                       size_t nstates = ARRAY_SIZE(port_states);
+                       size_t nstates = ARRAY_SIZE(stp_states);
 
                        state = strtol(*argv, &endptr, 10);
                        if (!(**argv != '\0' && *endptr == '\0')) {
                                for (state = 0; state < nstates; state++)
-                                       if (strcasecmp(port_states[state], 
*argv) == 0)
+                                       if (strcasecmp(stp_states[state], 
*argv) == 0)
                                                break;
                                if (state == nstates) {
                                        fprintf(stderr,
-- 
2.30.2

Reply via email to