bridge: code cleanup
Use checkpatch auto fix to cleanup lingering style issues
This commit is contained in:
parent
56f5daac98
commit
df4b043f08
|
|
@ -39,7 +39,7 @@ static void usage(void)
|
|||
exit(-1);
|
||||
}
|
||||
|
||||
static const char *state_n2a(unsigned s)
|
||||
static const char *state_n2a(unsigned int s)
|
||||
{
|
||||
static char buf[32];
|
||||
|
||||
|
|
@ -119,6 +119,7 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
|
|||
|
||||
if (tb[NDA_VLAN]) {
|
||||
__u16 vid = rta_getattr_u16(tb[NDA_VLAN]);
|
||||
|
||||
fprintf(fp, "vlan %hu ", vid);
|
||||
}
|
||||
|
||||
|
|
@ -200,6 +201,7 @@ static int fdb_show(int argc, char **argv)
|
|||
|
||||
if (br) {
|
||||
int br_ifindex = ll_name_to_index(br);
|
||||
|
||||
if (br_ifindex == 0) {
|
||||
fprintf(stderr, "Cannot find bridge device \"%s\"\n", br);
|
||||
return -1;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ static const char *port_states[] = {
|
|||
|
||||
extern char *if_indextoname(unsigned int __ifindex, char *__ifname);
|
||||
|
||||
static void print_link_flags(FILE *fp, unsigned flags)
|
||||
static void print_link_flags(FILE *fp, unsigned int flags)
|
||||
{
|
||||
fprintf(fp, "<");
|
||||
if (flags & IFF_UP && !(flags & IFF_RUNNING))
|
||||
|
|
@ -69,7 +69,7 @@ static const char *hw_mode[] = {"VEB", "VEPA"};
|
|||
|
||||
static void print_operstate(FILE *f, __u8 state)
|
||||
{
|
||||
if (state >= sizeof(oper_states)/sizeof(oper_states[0]))
|
||||
if (state >= ARRAY_SIZE(oper_states))
|
||||
fprintf(f, "state %#x ", state);
|
||||
else
|
||||
fprintf(f, "state %s ", oper_states[state]);
|
||||
|
|
@ -90,7 +90,7 @@ static void print_onoff(FILE *f, char *flag, __u8 val)
|
|||
|
||||
static void print_hwmode(FILE *f, __u16 mode)
|
||||
{
|
||||
if (mode >= sizeof(hw_mode)/sizeof(hw_mode[0]))
|
||||
if (mode >= ARRAY_SIZE(hw_mode))
|
||||
fprintf(f, "hwmode %#hx ", mode);
|
||||
else
|
||||
fprintf(f, "hwmode %s ", hw_mode[mode]);
|
||||
|
|
@ -136,6 +136,7 @@ int print_linkinfo(const struct sockaddr_nl *who,
|
|||
if (tb[IFLA_LINK]) {
|
||||
SPRINT_BUF(b1);
|
||||
int iflink = rta_getattr_u32(tb[IFLA_LINK]);
|
||||
|
||||
if (iflink == 0)
|
||||
fprintf(fp, "@NONE: ");
|
||||
else
|
||||
|
|
@ -319,6 +320,7 @@ static int brlink_modify(int argc, char **argv)
|
|||
NEXT_ARG();
|
||||
char *endptr;
|
||||
size_t nstates = sizeof(port_states) / sizeof(*port_states);
|
||||
|
||||
state = strtol(*argv, &endptr, 10);
|
||||
if (!(**argv != '\0' && *endptr == '\0')) {
|
||||
for (state = 0; state < nstates; state++)
|
||||
|
|
@ -339,8 +341,7 @@ static int brlink_modify(int argc, char **argv)
|
|||
mode = BRIDGE_MODE_VEB;
|
||||
else {
|
||||
fprintf(stderr,
|
||||
"Mode argument must be \"vepa\" or "
|
||||
"\"veb\".\n");
|
||||
"Mode argument must be \"vepa\" or \"veb\".\n");
|
||||
return -1;
|
||||
}
|
||||
} else if (strcmp(*argv, "self") == 0) {
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ static int accept_msg(const struct sockaddr_nl *who,
|
|||
int do_monitor(int argc, char **argv)
|
||||
{
|
||||
char *file = NULL;
|
||||
unsigned groups = ~RTMGRP_TC;
|
||||
unsigned int groups = ~RTMGRP_TC;
|
||||
int llink = 0;
|
||||
int lneigh = 0;
|
||||
int lmdb = 0;
|
||||
|
|
@ -122,6 +122,7 @@ int do_monitor(int argc, char **argv)
|
|||
if (file) {
|
||||
FILE *fp;
|
||||
int err;
|
||||
|
||||
fp = fopen(file, "r");
|
||||
if (fp == NULL) {
|
||||
perror("Cannot fopen");
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ static int vlan_modify(int cmd, int argc, char **argv)
|
|||
d = *argv;
|
||||
} else if (strcmp(*argv, "vid") == 0) {
|
||||
char *p;
|
||||
|
||||
NEXT_ARG();
|
||||
p = strchr(*argv, '-');
|
||||
if (p) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue