mirror of
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git
synced 2024-11-23 09:56:59 +08:00
dcb: fully initialize flag table
And make the flag table const since only used for lookup. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
parent
5e72cc73eb
commit
9ef3210bc7
@ -42,12 +42,12 @@ struct dcb_dcbx_flag {
|
|||||||
const char *key_json;
|
const char *key_json;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct dcb_dcbx_flag dcb_dcbx_flags[] = {
|
static const struct dcb_dcbx_flag dcb_dcbx_flags[] = {
|
||||||
{DCB_CAP_DCBX_HOST, "host"},
|
{DCB_CAP_DCBX_HOST, "host", NULL },
|
||||||
{DCB_CAP_DCBX_LLD_MANAGED, "lld-managed", "lld_managed"},
|
{DCB_CAP_DCBX_LLD_MANAGED, "lld-managed", "lld_managed" },
|
||||||
{DCB_CAP_DCBX_VER_CEE, "cee"},
|
{DCB_CAP_DCBX_VER_CEE, "cee", NULL },
|
||||||
{DCB_CAP_DCBX_VER_IEEE, "ieee"},
|
{DCB_CAP_DCBX_VER_IEEE, "ieee", NULL },
|
||||||
{DCB_CAP_DCBX_STATIC, "static"},
|
{DCB_CAP_DCBX_STATIC, "static", NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
static void dcb_dcbx_print(__u8 dcbx)
|
static void dcb_dcbx_print(__u8 dcbx)
|
||||||
@ -60,7 +60,7 @@ static void dcb_dcbx_print(__u8 dcbx)
|
|||||||
|
|
||||||
bit--;
|
bit--;
|
||||||
for (i = 0; i < ARRAY_SIZE(dcb_dcbx_flags); i++) {
|
for (i = 0; i < ARRAY_SIZE(dcb_dcbx_flags); i++) {
|
||||||
struct dcb_dcbx_flag *flag = &dcb_dcbx_flags[i];
|
const struct dcb_dcbx_flag *flag = &dcb_dcbx_flags[i];
|
||||||
|
|
||||||
if (flag->value == 1 << bit) {
|
if (flag->value == 1 << bit) {
|
||||||
print_bool(PRINT_JSON, flag->key_json ?: flag->key_fp,
|
print_bool(PRINT_JSON, flag->key_json ?: flag->key_fp,
|
||||||
@ -123,7 +123,7 @@ static int dcb_cmd_dcbx_set(struct dcb *dcb, const char *dev, int argc, char **a
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(dcb_dcbx_flags); i++) {
|
for (i = 0; i < ARRAY_SIZE(dcb_dcbx_flags); i++) {
|
||||||
struct dcb_dcbx_flag *flag = &dcb_dcbx_flags[i];
|
const struct dcb_dcbx_flag *flag = &dcb_dcbx_flags[i];
|
||||||
|
|
||||||
if (matches(*argv, flag->key_fp) == 0) {
|
if (matches(*argv, flag->key_fp) == 0) {
|
||||||
dcbx |= flag->value;
|
dcbx |= flag->value;
|
||||||
|
Loading…
Reference in New Issue
Block a user