ip: style cleanup

Make code more inline with current kernel style
This commit is contained in:
Stephen Hemminger 2016-11-14 09:28:09 +01:00 committed by Stephen Hemminger
parent ff9463e048
commit 468fa020f1
1 changed files with 28 additions and 28 deletions

View File

@ -424,7 +424,8 @@ static void print_num(FILE *fp, unsigned int width, uint64_t count)
} }
/* increase value by a factor of 1000/1024 and print /* increase value by a factor of 1000/1024 and print
* if result is something a human can read */ * if result is something a human can read
*/
for (;;) { for (;;) {
powi *= base; powi *= base;
if (count / base < powi) if (count / base < powi)
@ -667,9 +668,9 @@ int print_linkinfo_brief(const struct sockaddr_nl *who,
return -1; return -1;
parse_rtattr(tb, IFLA_MAX, IFLA_RTA(ifi), len); parse_rtattr(tb, IFLA_MAX, IFLA_RTA(ifi), len);
if (tb[IFLA_IFNAME] == NULL) { if (tb[IFLA_IFNAME] == NULL)
fprintf(stderr, "BUG: device with ifindex %d has nil ifname\n", ifi->ifi_index); fprintf(stderr, "BUG: device with ifindex %d has nil ifname\n", ifi->ifi_index);
}
if (filter.label && if (filter.label &&
(!filter.family || filter.family == AF_PACKET) && (!filter.family || filter.family == AF_PACKET) &&
fnmatch(filter.label, RTA_DATA(tb[IFLA_IFNAME]), 0)) fnmatch(filter.label, RTA_DATA(tb[IFLA_IFNAME]), 0))
@ -763,9 +764,9 @@ int print_linkinfo(const struct sockaddr_nl *who,
return 0; return 0;
parse_rtattr(tb, IFLA_MAX, IFLA_RTA(ifi), len); parse_rtattr(tb, IFLA_MAX, IFLA_RTA(ifi), len);
if (tb[IFLA_IFNAME] == NULL) { if (tb[IFLA_IFNAME] == NULL)
fprintf(stderr, "BUG: device with ifindex %d has nil ifname\n", ifi->ifi_index); fprintf(stderr, "BUG: device with ifindex %d has nil ifname\n", ifi->ifi_index);
}
if (filter.label && if (filter.label &&
(!filter.family || filter.family == AF_PACKET) && (!filter.family || filter.family == AF_PACKET) &&
fnmatch(filter.label, RTA_DATA(tb[IFLA_IFNAME]), 0)) fnmatch(filter.label, RTA_DATA(tb[IFLA_IFNAME]), 0))
@ -1160,9 +1161,9 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
ifa_flags &= ~IFA_F_MCAUTOJOIN; ifa_flags &= ~IFA_F_MCAUTOJOIN;
fprintf(fp, "autojoin "); fprintf(fp, "autojoin ");
} }
if (!(ifa_flags & IFA_F_PERMANENT)) { if (!(ifa_flags & IFA_F_PERMANENT))
fprintf(fp, "dynamic "); fprintf(fp, "dynamic ");
} else else
ifa_flags &= ~IFA_F_PERMANENT; ifa_flags &= ~IFA_F_PERMANENT;
if (ifa_flags & IFA_F_DADFAILED) { if (ifa_flags & IFA_F_DADFAILED) {
ifa_flags &= ~IFA_F_DADFAILED; ifa_flags &= ~IFA_F_DADFAILED;
@ -1648,9 +1649,9 @@ static int ipaddr_list_flush_or_save(int argc, char **argv, int action)
filter.kind = *argv; filter.kind = *argv;
} }
} else { } else {
if (strcmp(*argv, "dev") == 0) { if (strcmp(*argv, "dev") == 0)
NEXT_ARG(); NEXT_ARG();
} else if (matches(*argv, "help") == 0) else if (matches(*argv, "help") == 0)
usage(); usage();
if (filter_dev) if (filter_dev)
duparg2("dev", *argv); duparg2("dev", *argv);
@ -1955,9 +1956,8 @@ static int ipaddr_modify(int cmd, int flags, int argc, char **argv)
} else if (strcmp(*argv, "autojoin") == 0) { } else if (strcmp(*argv, "autojoin") == 0) {
ifa_flags |= IFA_F_MCAUTOJOIN; ifa_flags |= IFA_F_MCAUTOJOIN;
} else { } else {
if (strcmp(*argv, "local") == 0) { if (strcmp(*argv, "local") == 0)
NEXT_ARG(); NEXT_ARG();
}
if (matches(*argv, "help") == 0) if (matches(*argv, "help") == 0)
usage(); usage();
if (local_len) if (local_len)
@ -1988,9 +1988,9 @@ static int ipaddr_modify(int cmd, int flags, int argc, char **argv)
if (peer_len == 0 && local_len) { if (peer_len == 0 && local_len) {
if (cmd == RTM_DELADDR && lcl.family == AF_INET && !(lcl.flags & PREFIXLEN_SPECIFIED)) { if (cmd == RTM_DELADDR && lcl.family == AF_INET && !(lcl.flags & PREFIXLEN_SPECIFIED)) {
fprintf(stderr, fprintf(stderr,
"Warning: Executing wildcard deletion to stay compatible with old scripts.\n" \ "Warning: Executing wildcard deletion to stay compatible with old scripts.\n"
" Explicitly specify the prefix length (%s/%d) to avoid this warning.\n" \ " Explicitly specify the prefix length (%s/%d) to avoid this warning.\n"
" This special behaviour is likely to disappear in further releases,\n" \ " This special behaviour is likely to disappear in further releases,\n"
" fix your scripts!\n", lcl_arg, local_len*8); " fix your scripts!\n", lcl_arg, local_len*8);
} else { } else {
peer = lcl; peer = lcl;