Skip to content

Commit

Permalink
lldpad: Fix missing initializers
Browse files Browse the repository at this point in the history
Fix missing initializers warnings produced by -Wextra.

V2: Update for latest repo.

Signed-off-by: Mark Rustad <[email protected]>
Tested-by: Ross Brattain <[email protected]>
Signed-off-by: John Fastabend <[email protected]>
  • Loading branch information
John Fastabend committed Jan 12, 2012
1 parent d9e1645 commit b7cf721
Show file tree
Hide file tree
Showing 20 changed files with 276 additions and 207 deletions.
2 changes: 1 addition & 1 deletion dcb_protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ int dcbx_add_adapter(char *device_name)
u32 EventFlag = 0;
full_dcb_attrib_ptrs attr_ptr;
full_dcb_attribs attribs;
feature_support dcb_support = {0};
feature_support dcb_support = { .pg = 0 };
dcb_result sResult = dcb_success;
dcbx_state state;
int i = 0;
Expand Down
41 changes: 25 additions & 16 deletions lldp_8021qaz_clif.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,31 @@ static const struct lldp_mod_ops ieee8021qaz_ops_clif = {
};

struct type_name_info ieee8021qaz_tlv_names[] = {
{ (OUI_IEEE_8021 << 8),
"IEEE-DCBX Settings", "IEEE-DCBX",
NULL },
{ (OUI_IEEE_8021 << 8) | LLDP_8021QAZ_ETSCFG,
"IEEE 8021QAZ ETS Configuration TLV", "ETS-CFG",
ieee8021qaz_print_etscfg_tlv },
{ (OUI_IEEE_8021 << 8) | LLDP_8021QAZ_ETSREC,
"IEEE 8021QAZ ETS Recommendation TLV", "ETS-REC",
ieee8021qaz_print_etsrec_tlv },
{ (OUI_IEEE_8021 << 8) | LLDP_8021QAZ_PFC,
"IEEE 8021QAZ PFC TLV", "PFC",
ieee8021qaz_print_pfc_tlv },
{ (OUI_IEEE_8021 << 8) | LLDP_8021QAZ_APP,
"IEEE 8021QAZ APP TLV", "APP",
ieee8021qaz_print_app_tlv },
{ INVALID_TLVID, NULL, NULL }
{
.type = (OUI_IEEE_8021 << 8),
.name = "IEEE-DCBX Settings", .key = "IEEE-DCBX",
},
{
.type = (OUI_IEEE_8021 << 8) | LLDP_8021QAZ_ETSCFG,
.name = "IEEE 8021QAZ ETS Configuration TLV", .key = "ETS-CFG",
.print_info = ieee8021qaz_print_etscfg_tlv,
},
{
.type = (OUI_IEEE_8021 << 8) | LLDP_8021QAZ_ETSREC,
.name = "IEEE 8021QAZ ETS Recommendation TLV", .key = "ETS-REC",
.print_info = ieee8021qaz_print_etsrec_tlv,
},
{
.type = (OUI_IEEE_8021 << 8) | LLDP_8021QAZ_PFC,
.name = "IEEE 8021QAZ PFC TLV", .key = "PFC",
.print_info = ieee8021qaz_print_pfc_tlv,
},
{
.type = (OUI_IEEE_8021 << 8) | LLDP_8021QAZ_APP,
.name = "IEEE 8021QAZ APP TLV", .key = "APP",
.print_info = ieee8021qaz_print_app_tlv,
},
{ .type = INVALID_TLVID, }
};

static int ieee8021qaz_print_help(void)
Expand Down
64 changes: 41 additions & 23 deletions lldp_8021qaz_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,29 +84,47 @@ static int set_arg_app(struct cmd *, char *, char *, char *, int);
static int test_arg_app(struct cmd *, char *, char *, char *, int);

static struct arg_handlers arg_handlers[] = {
{ ARG_DCBX_MODE, TLV_ARG,
get_arg_dcbx_mode, set_arg_dcbx_mode,
test_arg_dcbx_mode },
{ ARG_TLVTXENABLE, TLV_ARG,
get_arg_tlvtxenable, set_arg_tlvtxenable,
test_arg_tlvtxenable },
{ ARG_WILLING, TLV_ARG,
get_arg_willing, set_arg_willing, test_arg_willing },
{ ARG_ETS_NUMTCS, TLV_ARG,
get_arg_numtc, NULL, test_arg_numtc },
{ ARG_ETS_UP2TC, TLV_ARG,
get_arg_up2tc, set_arg_up2tc, test_arg_up2tc },
{ ARG_ETS_TCBW, TLV_ARG,
get_arg_tcbw, set_arg_tcbw, test_arg_tcbw },
{ ARG_ETS_TSA, TLV_ARG,
get_arg_tsa, set_arg_tsa, test_arg_tsa },
{ ARG_PFC_ENABLED, TLV_ARG,
get_arg_enabled, set_arg_enabled, test_arg_enabled },
{ ARG_PFC_DELAY, TLV_ARG,
get_arg_delay, set_arg_delay, test_arg_delay },
{ ARG_APP, TLV_ARG,
get_arg_app, set_arg_app, test_arg_app },
{ NULL }
{ .arg = ARG_DCBX_MODE, .arg_class = TLV_ARG,
.handle_get = get_arg_dcbx_mode,
.handle_set = set_arg_dcbx_mode,
.handle_test = test_arg_dcbx_mode, },
{ .arg = ARG_TLVTXENABLE, .arg_class = TLV_ARG,
.handle_get = get_arg_tlvtxenable,
.handle_set = set_arg_tlvtxenable,
.handle_test = test_arg_tlvtxenable, },
{ .arg = ARG_WILLING, .arg_class = TLV_ARG,
.handle_get = get_arg_willing,
.handle_set = set_arg_willing,
.handle_test = test_arg_willing, },
{ .arg = ARG_ETS_NUMTCS, .arg_class = TLV_ARG,
.handle_get = get_arg_numtc,
/* no set */
.handle_test = test_arg_numtc, },
{ .arg = ARG_ETS_UP2TC, .arg_class = TLV_ARG,
.handle_get = get_arg_up2tc,
.handle_set = set_arg_up2tc,
.handle_test = test_arg_up2tc, },
{ .arg = ARG_ETS_TCBW, .arg_class = TLV_ARG,
.handle_get = get_arg_tcbw,
.handle_set = set_arg_tcbw,
.handle_test = test_arg_tcbw, },
{ .arg = ARG_ETS_TSA, .arg_class = TLV_ARG,
.handle_get = get_arg_tsa,
.handle_set = set_arg_tsa,
.handle_test = test_arg_tsa, },
{ .arg = ARG_PFC_ENABLED, .arg_class = TLV_ARG,
.handle_get = get_arg_enabled,
.handle_set = set_arg_enabled,
.handle_test = test_arg_enabled, },
{ .arg = ARG_PFC_DELAY, .arg_class = TLV_ARG,
.handle_get = get_arg_delay,
.handle_set = set_arg_delay,
.handle_test = test_arg_delay, },
{ .arg = ARG_APP, .arg_class = TLV_ARG,
.handle_get = get_arg_app,
.handle_set = set_arg_app,
.handle_test = test_arg_app, },
{ .arg = 0 }
};

static int get_arg_dcbx_mode(struct cmd *cmd, char *args,
Expand Down
30 changes: 13 additions & 17 deletions lldp_8023_clif.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,19 @@ static const struct lldp_mod_ops ieee8023_ops_clif = {
};

struct type_name_info ieee8023_tlv_names[] = {
{ (LLDP_MOD_8023 << 8) | LLDP_8023_MACPHY_CONFIG_STATUS,
"MAC/PHY Configuration Status TLV",
"macPhyCfg", print_mac_phy },

{ (LLDP_MOD_8023 << 8) | LLDP_8023_POWER_VIA_MDI,
"Power via MDI TLV",
"powerMdi", print_power_mdi },

{ (LLDP_MOD_8023 << 8) | LLDP_8023_LINK_AGGREGATION,
"Link Aggregation TLV",
"linkAgg", print_link_agg },

{ (LLDP_MOD_8023 << 8) | LLDP_8023_MAXIMUM_FRAME_SIZE,
"Maximum Frame Size TLV",
"MTU", print_mtu },

{ INVALID_TLVID, NULL, NULL }
{ .type = (LLDP_MOD_8023 << 8) | LLDP_8023_MACPHY_CONFIG_STATUS,
.name = "MAC/PHY Configuration Status TLV", .key = "macPhyCfg",
.print_info = print_mac_phy, },
{ .type = (LLDP_MOD_8023 << 8) | LLDP_8023_POWER_VIA_MDI,
.name = "Power via MDI TLV", .key = "powerMdi",
.print_info = print_power_mdi, },
{ .type = (LLDP_MOD_8023 << 8) | LLDP_8023_LINK_AGGREGATION,
.name = "Link Aggregation TLV", .key = "linkAgg",
.print_info = print_link_agg, },
{ .type = (LLDP_MOD_8023 << 8) | LLDP_8023_MAXIMUM_FRAME_SIZE,
.name = "Maximum Frame Size TLV", .key = "MTU",
.print_info = print_mtu, },
{ .type = INVALID_TLVID, }
};

int ieee8023_print_help()
Expand Down
9 changes: 5 additions & 4 deletions lldp_8023_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ static int set_arg_tlvtxenable(struct cmd *, char *, char *, char *, int);
static int test_arg_tlvtxenable(struct cmd *, char *, char *, char *, int);

static struct arg_handlers arg_handlers[] = {
{ ARG_TLVTXENABLE, TLV_ARG,
get_arg_tlvtxenable, set_arg_tlvtxenable,
test_arg_tlvtxenable },
{ NULL }
{ .arg = ARG_TLVTXENABLE, .arg_class = TLV_ARG,
.handle_get = get_arg_tlvtxenable,
.handle_set = set_arg_tlvtxenable,
.handle_test = test_arg_tlvtxenable, },
{ .arg = 0 }
};

static int get_arg_tlvtxenable(struct cmd *cmd, char *arg, char *argvalue,
Expand Down
27 changes: 16 additions & 11 deletions lldp_basman_clif.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,22 @@ static const struct lldp_mod_ops basman_ops_clif = {
};

struct type_name_info basman_tlv_names[] = {
{ PORT_DESCRIPTION_TLV, "Port Description TLV", "portDesc",
print_string_tlv },
{ SYSTEM_NAME_TLV, "System Name TLV", "sysName",
print_string_tlv },
{ SYSTEM_DESCRIPTION_TLV, "System Description TLV", "sysDesc",
print_string_tlv },
{ SYSTEM_CAPABILITIES_TLV, "System Capabilities TLV", "sysCap",
print_capabilities },
{ MANAGEMENT_ADDRESS_TLV, "Management Address TLV", "mngAddr",
print_mng_addr },
{ INVALID_TLVID, NULL, NULL }
{ .type = PORT_DESCRIPTION_TLV,
.name = "Port Description TLV", .key = "portDesc",
.print_info = print_string_tlv, },
{ .type = SYSTEM_NAME_TLV,
.name = "System Name TLV", .key = "sysName",
.print_info = print_string_tlv, },
{ .type = SYSTEM_DESCRIPTION_TLV,
.name = "System Description TLV", .key = "sysDesc",
.print_info = print_string_tlv, },
{ .type = SYSTEM_CAPABILITIES_TLV,
.name = "System Capabilities TLV", .key = "sysCap",
.print_info = print_capabilities, },
{ .type = MANAGEMENT_ADDRESS_TLV,
.name = "Management Address TLV", .key = "mngAddr",
.print_info = print_mng_addr, },
{ .type = INVALID_TLVID, }
};

int basman_print_help()
Expand Down
21 changes: 13 additions & 8 deletions lldp_basman_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,19 @@ static int set_arg_tlvtxenable(struct cmd *, char *, char *, char *, int);
static int test_arg_tlvtxenable(struct cmd *, char *, char *, char *, int);

static struct arg_handlers arg_handlers[] = {
{ ARG_IPV4_ADDR, TLV_ARG,
get_arg_ipv4, set_arg_ipv4, test_arg_ipv4 },
{ ARG_IPV6_ADDR, TLV_ARG,
get_arg_ipv6, set_arg_ipv6, test_arg_ipv6 },
{ ARG_TLVTXENABLE, TLV_ARG,
get_arg_tlvtxenable, set_arg_tlvtxenable,
test_arg_tlvtxenable },
{ NULL }
{ .arg = ARG_IPV4_ADDR, .arg_class = TLV_ARG,
.handle_get = get_arg_ipv4,
.handle_set = set_arg_ipv4,
.handle_test = test_arg_ipv4, },
{ .arg = ARG_IPV6_ADDR, .arg_class = TLV_ARG,
.handle_get = get_arg_ipv6,
.handle_set = set_arg_ipv6,
.handle_test = test_arg_ipv6, },
{ .arg = ARG_TLVTXENABLE, .arg_class = TLV_ARG,
.handle_get = get_arg_tlvtxenable,
.handle_set = set_arg_tlvtxenable,
.handle_test = test_arg_tlvtxenable },
{ .arg = 0 }
};

static int get_arg_tlvtxenable(struct cmd *cmd, char *arg, char *argvalue,
Expand Down
8 changes: 4 additions & 4 deletions lldp_cisco_clif.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ static const struct lldp_mod_ops cisco_ops_clif = {
};

struct type_name_info cisco_tlv_names[] = {
{ (OUI_CISCO << 8) | 1,
"Cisco 4-wire Power-via-MDI TLV",
"uPoE", cisco_print_upoe_tlv },
{ INVALID_TLVID, NULL, NULL }
{ .type = (OUI_CISCO << 8) | 1,
.name = "Cisco 4-wire Power-via-MDI TLV", .key = "uPoE",
.print_info = cisco_print_upoe_tlv },
{ .type = INVALID_TLVID, }
};

static int cisco_print_help()
Expand Down
12 changes: 7 additions & 5 deletions lldp_dcbx_clif.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,13 @@ static const struct lldp_mod_ops dcbx_ops_clif = {
};

struct type_name_info dcbx_tlv_names[] = {
{ (OUI_CEE_DCBX << 8) | 1, "PRE-CEE DCBX TLV",
"DCBXv1", print_dcbx_v1 },
{ (OUI_CEE_DCBX << 8) | 2, "CEE DCBX TLV",
"DCBX", print_dcbx_v2 },
{ INVALID_TLVID, NULL, NULL }
{ .type = (OUI_CEE_DCBX << 8) | 1,
.name = "PRE-CEE DCBX TLV", .key = "DCBXv1",
.print_info = print_dcbx_v1, },
{ .type = (OUI_CEE_DCBX << 8) | 2,
.name = "CEE DCBX TLV", .key = "DCBX",
.print_info = print_dcbx_v2, },
{ .type = INVALID_TLVID, }
};

int dcbx_print_help()
Expand Down
9 changes: 5 additions & 4 deletions lldp_dcbx_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ static int set_arg_tlvtxenable(struct cmd *, char *, char *, char *, int);
static int test_arg_tlvtxenable(struct cmd *, char *, char *, char *, int);

static struct arg_handlers arg_handlers[] = {
{ ARG_TLVTXENABLE, TLV_ARG,
get_arg_tlvtxenable, set_arg_tlvtxenable,
test_arg_tlvtxenable },
{ NULL }
{ .arg = ARG_TLVTXENABLE, .arg_class = TLV_ARG,
.handle_get = get_arg_tlvtxenable,
.handle_set = set_arg_tlvtxenable,
.handle_test = test_arg_tlvtxenable, },
{ .arg = 0 }
};

static int get_arg_tlvtxenable(struct cmd *cmd, char *arg, char *argvalue,
Expand Down
8 changes: 4 additions & 4 deletions lldp_evb_clif.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ static const struct lldp_mod_ops evb_ops_clif = {
};

struct type_name_info evb_tlv_names[] = {
{ (LLDP_MOD_EVB << 8) | LLDP_EVB_SUBTYPE,
"EVB Configuration TLV",
"evbCfg", evb_print_cfg_tlv },
{ INVALID_TLVID, NULL, NULL }
{ .type = (LLDP_MOD_EVB << 8) | LLDP_EVB_SUBTYPE,
.name = "EVB Configuration TLV", .key = "evbCfg",
.print_info = evb_print_cfg_tlv, },
{ .type = INVALID_TLVID, }
};

int evb_print_help()
Expand Down
34 changes: 21 additions & 13 deletions lldp_evb_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,27 @@ static int set_arg_capabilities(struct cmd *, char *, char *, char *, int);
static int test_arg_capabilities(struct cmd *, char *, char *, char *, int);

static struct arg_handlers arg_handlers[] = {
{ ARG_EVB_FORWARDING_MODE, TLV_ARG,
get_arg_fmode, set_arg_fmode, test_arg_fmode },
{ ARG_EVB_CAPABILITIES, TLV_ARG,
get_arg_capabilities, set_arg_capabilities,
test_arg_capabilities },
{ ARG_EVB_VSIS, TLV_ARG,
get_arg_vsis, set_arg_vsis, test_arg_vsis },
{ ARG_EVB_RTE, TLV_ARG,
get_arg_rte, set_arg_rte, test_arg_rte },
{ ARG_TLVTXENABLE, TLV_ARG,
get_arg_tlvtxenable, set_arg_tlvtxenable,
test_arg_tlvtxenable },
{ NULL }
{ .arg = ARG_EVB_FORWARDING_MODE, .arg_class = TLV_ARG,
.handle_get = get_arg_fmode,
.handle_set = set_arg_fmode,
.handle_test = test_arg_fmode, },
{ .arg = ARG_EVB_CAPABILITIES, .arg_class = TLV_ARG,
.handle_get = get_arg_capabilities,
.handle_set = set_arg_capabilities,
.handle_test = test_arg_capabilities, },
{ .arg = ARG_EVB_VSIS, .arg_class = TLV_ARG,
.handle_get = get_arg_vsis,
.handle_set = set_arg_vsis,
.handle_test = test_arg_vsis, },
{ .arg = ARG_EVB_RTE, .arg_class = TLV_ARG,
.handle_get = get_arg_rte,
.handle_set = set_arg_rte,
.handle_test = test_arg_rte, },
{ .arg = ARG_TLVTXENABLE, .arg_class = TLV_ARG,
.handle_get = get_arg_tlvtxenable,
.handle_set = set_arg_tlvtxenable,
.handle_test = test_arg_tlvtxenable, },
{ .arg = 0 }
};

static int get_arg_tlvtxenable(struct cmd *cmd, char *arg, char *argvalue,
Expand Down
17 changes: 12 additions & 5 deletions lldp_mand_clif.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,18 @@ static const struct lldp_mod_ops mand_ops_clif = {


struct type_name_info mand_tlv_names[] = {
{ END_OF_LLDPDU_TLV, "End of LLDPDU TLV","" },
{ CHASSIS_ID_TLV, "Chassis ID TLV", "chassisID",print_chassis_id },
{ PORT_ID_TLV, "Port ID TLV", "portID", print_port_id },
{ TIME_TO_LIVE_TLV, "Time to Live TLV", "TTL", print_ttl },
{ INVALID_TLVID, NULL, NULL }
{ .type = END_OF_LLDPDU_TLV,
.name = "End of LLDPDU TLV", .key = "", },
{ .type = CHASSIS_ID_TLV,
.name = "Chassis ID TLV", .key = "chassisID",
.print_info = print_chassis_id, },
{ .type = PORT_ID_TLV,
.name = "Port ID TLV", .key = "portID",
.print_info = print_port_id, },
{ .type = TIME_TO_LIVE_TLV,
.name = "Time to Live TLV", .key = "TTL",
.print_info = print_ttl, },
{ .type = INVALID_TLVID, }
};

int mand_print_help()
Expand Down
16 changes: 10 additions & 6 deletions lldp_mand_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,17 @@ static int handle_set_arg(struct cmd *, char *, char *, char *, int);
static int handle_test_arg(struct cmd *, char *, char *, char *, int);

static struct arg_handlers arg_handlers[] = {
{ ARG_ADMINSTATUS, LLDP_ARG,
get_arg_adminstatus, set_arg_adminstatus,
test_arg_adminstatus },
{ ARG_TLVTXENABLE, TLV_ARG,
get_arg_tlvtxenable, set_arg_tlvtxenable, set_arg_tlvtxenable },
{ .arg = ARG_ADMINSTATUS, .arg_class = LLDP_ARG,
.handle_get = get_arg_adminstatus,
.handle_set = set_arg_adminstatus,
.handle_test = test_arg_adminstatus, },
{ .arg = ARG_TLVTXENABLE, .arg_class = TLV_ARG,
.handle_get = get_arg_tlvtxenable,
.handle_set = set_arg_tlvtxenable,
.handle_test = set_arg_tlvtxenable,
},
/* test same as set */
{ NULL }
{ .arg = 0 }
};

struct arg_handlers *mand_get_arg_handlers()
Expand Down
Loading

0 comments on commit b7cf721

Please sign in to comment.