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);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *state_n2a(unsigned s)
|
static const char *state_n2a(unsigned int s)
|
||||||
{
|
{
|
||||||
static char buf[32];
|
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]) {
|
if (tb[NDA_VLAN]) {
|
||||||
__u16 vid = rta_getattr_u16(tb[NDA_VLAN]);
|
__u16 vid = rta_getattr_u16(tb[NDA_VLAN]);
|
||||||
|
|
||||||
fprintf(fp, "vlan %hu ", vid);
|
fprintf(fp, "vlan %hu ", vid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -200,6 +201,7 @@ static int fdb_show(int argc, char **argv)
|
||||||
|
|
||||||
if (br) {
|
if (br) {
|
||||||
int br_ifindex = ll_name_to_index(br);
|
int br_ifindex = ll_name_to_index(br);
|
||||||
|
|
||||||
if (br_ifindex == 0) {
|
if (br_ifindex == 0) {
|
||||||
fprintf(stderr, "Cannot find bridge device \"%s\"\n", br);
|
fprintf(stderr, "Cannot find bridge device \"%s\"\n", br);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ static const char *port_states[] = {
|
||||||
|
|
||||||
extern char *if_indextoname(unsigned int __ifindex, char *__ifname);
|
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, "<");
|
fprintf(fp, "<");
|
||||||
if (flags & IFF_UP && !(flags & IFF_RUNNING))
|
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)
|
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);
|
fprintf(f, "state %#x ", state);
|
||||||
else
|
else
|
||||||
fprintf(f, "state %s ", oper_states[state]);
|
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)
|
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);
|
fprintf(f, "hwmode %#hx ", mode);
|
||||||
else
|
else
|
||||||
fprintf(f, "hwmode %s ", hw_mode[mode]);
|
fprintf(f, "hwmode %s ", hw_mode[mode]);
|
||||||
|
|
@ -136,6 +136,7 @@ int print_linkinfo(const struct sockaddr_nl *who,
|
||||||
if (tb[IFLA_LINK]) {
|
if (tb[IFLA_LINK]) {
|
||||||
SPRINT_BUF(b1);
|
SPRINT_BUF(b1);
|
||||||
int iflink = rta_getattr_u32(tb[IFLA_LINK]);
|
int iflink = rta_getattr_u32(tb[IFLA_LINK]);
|
||||||
|
|
||||||
if (iflink == 0)
|
if (iflink == 0)
|
||||||
fprintf(fp, "@NONE: ");
|
fprintf(fp, "@NONE: ");
|
||||||
else
|
else
|
||||||
|
|
@ -319,6 +320,7 @@ static int brlink_modify(int argc, char **argv)
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
char *endptr;
|
char *endptr;
|
||||||
size_t nstates = sizeof(port_states) / sizeof(*port_states);
|
size_t nstates = sizeof(port_states) / sizeof(*port_states);
|
||||||
|
|
||||||
state = strtol(*argv, &endptr, 10);
|
state = strtol(*argv, &endptr, 10);
|
||||||
if (!(**argv != '\0' && *endptr == '\0')) {
|
if (!(**argv != '\0' && *endptr == '\0')) {
|
||||||
for (state = 0; state < nstates; state++)
|
for (state = 0; state < nstates; state++)
|
||||||
|
|
@ -339,8 +341,7 @@ static int brlink_modify(int argc, char **argv)
|
||||||
mode = BRIDGE_MODE_VEB;
|
mode = BRIDGE_MODE_VEB;
|
||||||
else {
|
else {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Mode argument must be \"vepa\" or "
|
"Mode argument must be \"vepa\" or \"veb\".\n");
|
||||||
"\"veb\".\n");
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else if (strcmp(*argv, "self") == 0) {
|
} 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)
|
int do_monitor(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char *file = NULL;
|
char *file = NULL;
|
||||||
unsigned groups = ~RTMGRP_TC;
|
unsigned int groups = ~RTMGRP_TC;
|
||||||
int llink = 0;
|
int llink = 0;
|
||||||
int lneigh = 0;
|
int lneigh = 0;
|
||||||
int lmdb = 0;
|
int lmdb = 0;
|
||||||
|
|
@ -122,6 +122,7 @@ int do_monitor(int argc, char **argv)
|
||||||
if (file) {
|
if (file) {
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
fp = fopen(file, "r");
|
fp = fopen(file, "r");
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
perror("Cannot fopen");
|
perror("Cannot fopen");
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ static int vlan_modify(int cmd, int argc, char **argv)
|
||||||
d = *argv;
|
d = *argv;
|
||||||
} else if (strcmp(*argv, "vid") == 0) {
|
} else if (strcmp(*argv, "vid") == 0) {
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
p = strchr(*argv, '-');
|
p = strchr(*argv, '-');
|
||||||
if (p) {
|
if (p) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue