Skip to content

Commit

Permalink
*: clean up cmd_node initializers
Browse files Browse the repository at this point in the history
... and use named assignments everywhere (so I can change the struct.)

Signed-off-by: David Lamparter <equinox@diac24.net>
  • Loading branch information
eqvinox committed Apr 16, 2020
1 parent 4c749d9 commit 62b346e
Show file tree
Hide file tree
Showing 51 changed files with 604 additions and 249 deletions.
9 changes: 4 additions & 5 deletions babeld/babel_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,10 @@ static void babel_interface_free (babel_interface_nfo *bi);


static vector babel_enable_if; /* enable interfaces (by cmd). */
static struct cmd_node babel_interface_node = /* babeld's interface node. */
{
INTERFACE_NODE,
"%s(config-if)# ",
1 /* VTYSH */
static struct cmd_node babel_interface_node = {
.node = INTERFACE_NODE,
.prompt = "%s(config-if)# ",
.vtysh = 1,
};


Expand Down
12 changes: 6 additions & 6 deletions bfdd/bfdd_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -886,15 +886,15 @@ DEFUN_NOSH(show_debugging_bfd,
}

struct cmd_node bfd_node = {
BFD_NODE,
"%s(config-bfd)# ",
1,
.node = BFD_NODE,
.prompt = "%s(config-bfd)# ",
.vtysh = 1,
};

struct cmd_node bfd_peer_node = {
BFD_PEER_NODE,
"%s(config-bfd-peer)# ",
1,
.node = BFD_PEER_NODE,
.prompt = "%s(config-bfd-peer)# ",
.vtysh = 1,
};

static int bfdd_write_config(struct vty *vty)
Expand Down
5 changes: 4 additions & 1 deletion bgpd/bgp_bmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1772,7 +1772,10 @@ static void bmp_active_setup(struct bmp_active *ba)
}
}

static struct cmd_node bmp_node = {BMP_NODE, "%s(config-bgp-bmp)# "};
static struct cmd_node bmp_node = {
.node = BMP_NODE,
.prompt = "%s(config-bgp-bmp)# "
};

#define BMP_STR "BGP Monitoring Protocol\n"

Expand Down
6 changes: 5 additions & 1 deletion bgpd/bgp_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -2282,7 +2282,11 @@ static int bgp_config_write_debug(struct vty *vty)
return write;
}

static struct cmd_node debug_node = {DEBUG_NODE, "", 1};
static struct cmd_node debug_node = {
.node = DEBUG_NODE,
.prompt = "",
.vtysh = 1,
};

void bgp_debug_init(void)
{
Expand Down
6 changes: 5 additions & 1 deletion bgpd/bgp_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,11 @@ DEFUN (no_dump_bgp_all,
}

/* BGP node structure. */
static struct cmd_node bgp_dump_node = {DUMP_NODE, "", 1};
static struct cmd_node bgp_dump_node = {
.node = DUMP_NODE,
.prompt = "",
.vtysh = 1,
};

#if 0
char *
Expand Down
6 changes: 5 additions & 1 deletion bgpd/bgp_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,11 @@ static int config_write_as_list(struct vty *vty)
return write;
}

static struct cmd_node as_list_node = {AS_LIST_NODE, "", 1};
static struct cmd_node as_list_node = {
.node = AS_LIST_NODE,
.prompt = "",
.vtysh = 1,
};

/* Register functions. */
void bgp_filter_init(void)
Expand Down
6 changes: 5 additions & 1 deletion bgpd/bgp_rpki.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@ static unsigned int retry_interval;
static int rpki_sync_socket_rtr;
static int rpki_sync_socket_bgpd;

static struct cmd_node rpki_node = {RPKI_NODE, "%s(config-rpki)# ", 1};
static struct cmd_node rpki_node = {
.node = RPKI_NODE,
.prompt = "%s(config-rpki)# ",
.vtysh = 1,
};
static const struct route_map_rule_cmd route_match_rpki_cmd = {
"rpki", route_match, route_match_compile, route_match_free};

Expand Down
74 changes: 54 additions & 20 deletions bgpd/bgp_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -15335,50 +15335,82 @@ int bgp_config_write(struct vty *vty)

/* BGP node structure. */
static struct cmd_node bgp_node = {
BGP_NODE, "%s(config-router)# ", 1,
.node = BGP_NODE,
.prompt = "%s(config-router)# ",
.vtysh = 1,
};

static struct cmd_node bgp_ipv4_unicast_node = {
BGP_IPV4_NODE, "%s(config-router-af)# ", 1,
.node = BGP_IPV4_NODE,
.prompt = "%s(config-router-af)# ",
.vtysh = 1,
};

static struct cmd_node bgp_ipv4_multicast_node = {
BGP_IPV4M_NODE, "%s(config-router-af)# ", 1,
.node = BGP_IPV4M_NODE,
.prompt = "%s(config-router-af)# ",
.vtysh = 1,
};

static struct cmd_node bgp_ipv4_labeled_unicast_node = {
BGP_IPV4L_NODE, "%s(config-router-af)# ", 1,
.node = BGP_IPV4L_NODE,
.prompt = "%s(config-router-af)# ",
.vtysh = 1,
};

static struct cmd_node bgp_ipv6_unicast_node = {
BGP_IPV6_NODE, "%s(config-router-af)# ", 1,
.node = BGP_IPV6_NODE,
.prompt = "%s(config-router-af)# ",
.vtysh = 1,
};

static struct cmd_node bgp_ipv6_multicast_node = {
BGP_IPV6M_NODE, "%s(config-router-af)# ", 1,
.node = BGP_IPV6M_NODE,
.prompt = "%s(config-router-af)# ",
.vtysh = 1,
};

static struct cmd_node bgp_ipv6_labeled_unicast_node = {
BGP_IPV6L_NODE, "%s(config-router-af)# ", 1,
.node = BGP_IPV6L_NODE,
.prompt = "%s(config-router-af)# ",
.vtysh = 1,
};

static struct cmd_node bgp_vpnv4_node = {BGP_VPNV4_NODE,
"%s(config-router-af)# ", 1};
static struct cmd_node bgp_vpnv4_node = {
.node = BGP_VPNV4_NODE,
.prompt = "%s(config-router-af)# ",
.vtysh = 1,
};

static struct cmd_node bgp_vpnv6_node = {BGP_VPNV6_NODE,
"%s(config-router-af-vpnv6)# ", 1};
static struct cmd_node bgp_vpnv6_node = {
.node = BGP_VPNV6_NODE,
.prompt = "%s(config-router-af-vpnv6)# ",
.vtysh = 1,
};

static struct cmd_node bgp_evpn_node = {BGP_EVPN_NODE,
"%s(config-router-evpn)# ", 1};
static struct cmd_node bgp_evpn_node = {
.node = BGP_EVPN_NODE,
.prompt = "%s(config-router-evpn)# ",
.vtysh = 1,
};

static struct cmd_node bgp_evpn_vni_node = {BGP_EVPN_VNI_NODE,
"%s(config-router-af-vni)# ", 1};
static struct cmd_node bgp_evpn_vni_node = {
.node = BGP_EVPN_VNI_NODE,
.prompt = "%s(config-router-af-vni)# ",
.vtysh = 1,
};

static struct cmd_node bgp_flowspecv4_node = {BGP_FLOWSPECV4_NODE,
"%s(config-router-af)# ", 1};
static struct cmd_node bgp_flowspecv4_node = {
.node = BGP_FLOWSPECV4_NODE,
.prompt = "%s(config-router-af)# ",
.vtysh = 1,
};

static struct cmd_node bgp_flowspecv6_node = {BGP_FLOWSPECV6_NODE,
"%s(config-router-af-vpnv6)# ", 1};
static struct cmd_node bgp_flowspecv6_node = {
.node = BGP_FLOWSPECV6_NODE,
.prompt = "%s(config-router-af-vpnv6)# ",
.vtysh = 1,
};

static void community_list_vty(void);

Expand Down Expand Up @@ -17859,7 +17891,9 @@ static int community_list_config_write(struct vty *vty)
}

static struct cmd_node community_list_node = {
COMMUNITY_LIST_NODE, "", 1 /* Export to vtysh. */
.node = COMMUNITY_LIST_NODE,
.prompt = "",
.vtysh = 1,
};

static void community_list_vty(void)
Expand Down
20 changes: 16 additions & 4 deletions bgpd/rfapi/bgp_rfapi_cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2965,10 +2965,16 @@ DEFUN_NOSH (exit_vnc,
}

static struct cmd_node bgp_vnc_defaults_node = {
BGP_VNC_DEFAULTS_NODE, "%s(config-router-vnc-defaults)# ", 1};
.node = BGP_VNC_DEFAULTS_NODE,
.prompt = "%s(config-router-vnc-defaults)# ",
.vtysh = 1,
};

static struct cmd_node bgp_vnc_nve_group_node = {
BGP_VNC_NVE_GROUP_NODE, "%s(config-router-vnc-nve-group)# ", 1};
.node = BGP_VNC_NVE_GROUP_NODE,
.prompt = "%s(config-router-vnc-nve-group)# ",
.vtysh = 1,
};

/*-------------------------------------------------------------------------
* VNC nve-group
Expand Down Expand Up @@ -3388,7 +3394,10 @@ DEFUN_NOSH (exit_vrf_policy,
}

static struct cmd_node bgp_vrf_policy_node = {
BGP_VRF_POLICY_NODE, "%s(config-router-vrf-policy)# ", 1};
.node = BGP_VRF_POLICY_NODE,
.prompt = "%s(config-router-vrf-policy)# ",
.vtysh = 1,
};

/*-------------------------------------------------------------------------
* vnc-l2-group
Expand Down Expand Up @@ -3624,7 +3633,10 @@ DEFUN (vnc_l2_group_rt,


static struct cmd_node bgp_vnc_l2_group_node = {
BGP_VNC_L2_GROUP_NODE, "%s(config-router-vnc-l2-group)# ", 1};
.node = BGP_VNC_L2_GROUP_NODE,
.prompt = "%s(config-router-vnc-l2-group)# ",
.vtysh = 1,
};

struct rfapi_l2_group_cfg *
bgp_rfapi_get_group_by_lni_label(struct bgp *bgp, uint32_t logical_net_id,
Expand Down
6 changes: 5 additions & 1 deletion bgpd/rfapi/vnc_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,11 @@ static int bgp_vnc_config_write_debug(struct vty *vty)
return write;
}

static struct cmd_node debug_node = {DEBUG_VNC_NODE, "", 1};
static struct cmd_node debug_node = {
.node = DEBUG_VNC_NODE,
.prompt = "",
.vtysh = 1,
};

void vnc_debug_init(void)
{
Expand Down
13 changes: 10 additions & 3 deletions eigrpd/eigrp_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,11 @@ void eigrp_cli_show_keychain(struct vty *vty, struct lyd_node *dnode,
/*
* CLI installation procedures.
*/
static struct cmd_node eigrp_node = {EIGRP_NODE, "%s(config-router)# ", 1};
static struct cmd_node eigrp_node = {
.node = EIGRP_NODE,
.prompt = "%s(config-router)# ",
.vtysh = 1,
};

static int eigrp_config_write(struct vty *vty)
{
Expand All @@ -854,8 +858,11 @@ static int eigrp_config_write(struct vty *vty)
return written;
}

static struct cmd_node eigrp_interface_node = {INTERFACE_NODE,
"%s(config-if)# ", 1};
static struct cmd_node eigrp_interface_node = {
.node = INTERFACE_NODE,
.prompt = "%s(config-if)# ",
.vtysh = 1,
};


static int eigrp_write_interface(struct vty *vty)
Expand Down
4 changes: 3 additions & 1 deletion eigrpd/eigrp_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,9 @@ DEFUN (no_debug_eigrp_packets,

/* Debug node. */
static struct cmd_node eigrp_debug_node = {
DEBUG_NODE, "", 1 /* VTYSH */
.node = DEBUG_NODE,
.prompt = "",
.vtysh = 1,
};

/* Initialize debug commands. */
Expand Down
4 changes: 3 additions & 1 deletion isisd/isis_circuit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1336,7 +1336,9 @@ ferr_r isis_circuit_passwd_hmac_md5_set(struct isis_circuit *circuit,
}

struct cmd_node interface_node = {
INTERFACE_NODE, "%s(config-if)# ", 1,
.node = INTERFACE_NODE,
.prompt = "%s(config-if)# ",
.vtysh = 1,
};

void isis_circuit_circ_type_set(struct isis_circuit *circuit, int circ_type)
Expand Down
12 changes: 10 additions & 2 deletions isisd/isisd.c
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,11 @@ DEFUN_NOSH (show_debugging,
}

/* Debug node. */
static struct cmd_node debug_node = {DEBUG_NODE, "", 1};
static struct cmd_node debug_node = {
.node = DEBUG_NODE,
.prompt = "",
.vtysh = 1,
};

static int config_write_debug(struct vty *vty)
{
Expand Down Expand Up @@ -2141,7 +2145,11 @@ int isis_config_write(struct vty *vty)
}
#endif /* ifdef FABRICD */

struct cmd_node router_node = {ROUTER_NODE, "%s(config-router)# ", 1};
struct cmd_node router_node = {
.node = ROUTER_NODE,
.prompt = "%s(config-router)# ",
.vtysh = 1,
};

void isis_init(void)
{
Expand Down
9 changes: 4 additions & 5 deletions ldpd/ldp_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ struct ldp_debug conf_ldp_debug;
struct ldp_debug ldp_debug;

/* Debug node. */
struct cmd_node ldp_debug_node =
{
DEBUG_NODE,
"",
1
struct cmd_node ldp_debug_node = {
.node = DEBUG_NODE,
.prompt = "",
.vtysh = 1,
};

int
Expand Down
Loading

0 comments on commit 62b346e

Please sign in to comment.