From 98ee06d3d46aa7f89c204681c7075b53300a6a6e Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Sun, 31 Dec 2006 18:57:37 +0000 Subject: [PATCH] stop using __u32 etc. uint32_t is there for a reason --- coreutils/df.c | 2 +- include/platform.h | 12 +- modutils/insmod.c | 15 +-- networking/libiproute/ipaddress.c | 2 +- networking/libiproute/iplink.c | 28 ++-- networking/libiproute/iproute.c | 11 +- networking/libiproute/iprule.c | 14 +- networking/libiproute/iptunnel.c | 2 +- networking/libiproute/libnetlink.c | 4 +- networking/libiproute/libnetlink.h | 10 +- networking/libiproute/linux/pkt_sched.h | 169 ++++++++++++------------ networking/libiproute/rtm_map.c | 4 +- networking/libiproute/rtm_map.h | 2 +- networking/libiproute/utils.c | 20 +-- networking/libiproute/utils.h | 26 ++-- networking/route.c | 18 +-- 16 files changed, 161 insertions(+), 178 deletions(-) diff --git a/coreutils/df.c b/coreutils/df.c index 6ae3eed33..3b3292590 100644 --- a/coreutils/df.c +++ b/coreutils/df.c @@ -93,7 +93,7 @@ int df_main(int argc, char **argv) mount_entry = find_mount_point(mount_point, bb_path_mtab_file); if (!mount_entry) { bb_error_msg("%s: can't find mount point", mount_point); - SET_ERROR: + SET_ERROR: status = EXIT_FAILURE; continue; } diff --git a/include/platform.h b/include/platform.h index 175440669..9d8df4b7f 100644 --- a/include/platform.h +++ b/include/platform.h @@ -133,12 +133,12 @@ typedef int socklen_t; #endif /* ---- Compiler dependent settings ------------------------- */ -#ifndef __GNUC__ -#if defined __INTEL_COMPILER -__extension__ typedef __signed__ long long __s64; -__extension__ typedef unsigned long long __u64; -#endif /* __INTEL_COMPILER */ -#endif /* ifndef __GNUC__ */ +//#ifndef __GNUC__ +//#if defined __INTEL_COMPILER +//__extension__ typedef __signed__ long long __s64; +//__extension__ typedef unsigned long long __u64; +//#endif /* __INTEL_COMPILER */ +//#endif /* ifndef __GNUC__ */ #if (defined __digital__ && defined __unix__) # undef HAVE_MNTENT_H diff --git a/modutils/insmod.c b/modutils/insmod.c index 866e333ec..a9bf1854c 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c @@ -3765,12 +3765,8 @@ add_ksymoops_symbols(struct obj_file *f, const char *filename, if (realpath(filename, real)) { absolute_filename = xstrdup(real); - } - else { - int save_errno = errno; - bb_error_msg("cannot get realpath for %s", filename); - errno = save_errno; - perror(""); + } else { + bb_perror_msg("cannot get realpath for %s", filename); absolute_filename = xstrdup(filename); } @@ -3783,7 +3779,8 @@ add_ksymoops_symbols(struct obj_file *f, const char *filename, */ use_ksymtab = obj_find_section(f, "__ksymtab") || flag_noexport; - if ((sec = obj_find_section(f, ".this"))) { + sec = obj_find_section(f, ".this"); + if (sec) { /* tag the module header with the object name, last modified * timestamp and module version. worst case for module version * is 0xffffff, decimal 16777215. putting all three fields in @@ -3834,8 +3831,8 @@ add_ksymoops_symbols(struct obj_file *f, const char *filename, /* tag the desired sections if size is non-zero */ for (i = 0; i < sizeof(section_names)/sizeof(section_names[0]); ++i) { - if ((sec = obj_find_section(f, section_names[i])) && - sec->header.sh_size) { + sec = obj_find_section(f, section_names[i]); + if (sec && sec->header.sh_size) { l = sizeof(symprefix)+ /* "__insmod_" */ lm_name+ /* module name */ 2+ /* "_S" */ diff --git a/networking/libiproute/ipaddress.c b/networking/libiproute/ipaddress.c index e6130e4d7..bc9963f1f 100644 --- a/networking/libiproute/ipaddress.c +++ b/networking/libiproute/ipaddress.c @@ -616,7 +616,7 @@ int ipaddr_list_or_flush(int argc, char **argv, int flush) static int default_scope(inet_prefix *lcl) { if (lcl->family == AF_INET) { - if (lcl->bytelen >= 1 && *(__u8*)&lcl->data == 127) + if (lcl->bytelen >= 1 && *(uint8_t*)&lcl->data == 127) return RT_SCOPE_HOST; } return 0; diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c index ea57d60ac..ae41ab308 100644 --- a/networking/libiproute/iplink.c +++ b/networking/libiproute/iplink.c @@ -47,11 +47,11 @@ static int get_ctl_fd(void) if (fd >= 0) return fd; errno = s_errno; - perror("Cannot create control socket"); + bb_perror_msg("cannot create control socket"); return -1; } -static int do_chflags(char *dev, __u32 flags, __u32 mask) +static int do_chflags(char *dev, uint32_t flags, uint32_t mask) { struct ifreq ifr; int fd; @@ -63,7 +63,7 @@ static int do_chflags(char *dev, __u32 flags, __u32 mask) return -1; err = ioctl(fd, SIOCGIFFLAGS, &ifr); if (err) { - perror("SIOCGIFFLAGS"); + bb_perror_msg("SIOCGIFFLAGS"); close(fd); return -1; } @@ -72,7 +72,7 @@ static int do_chflags(char *dev, __u32 flags, __u32 mask) ifr.ifr_flags |= mask&flags; err = ioctl(fd, SIOCSIFFLAGS, &ifr); if (err) - perror("SIOCSIFFLAGS"); + bb_perror_msg("SIOCSIFFLAGS"); } close(fd); return err; @@ -91,7 +91,7 @@ static int do_changename(char *dev, char *newdev) return -1; err = ioctl(fd, SIOCSIFNAME, &ifr); if (err) { - perror("SIOCSIFNAME"); + bb_perror_msg("SIOCSIFNAME"); close(fd); return -1; } @@ -112,7 +112,7 @@ static int set_qlen(char *dev, int qlen) strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name)); ifr.ifr_qlen = qlen; if (ioctl(s, SIOCSIFTXQLEN, &ifr) < 0) { - perror("SIOCSIFXQLEN"); + bb_perror_msg("SIOCSIFXQLEN"); close(s); return -1; } @@ -134,7 +134,7 @@ static int set_mtu(char *dev, int mtu) strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name)); ifr.ifr_mtu = mtu; if (ioctl(s, SIOCSIFMTU, &ifr) < 0) { - perror("SIOCSIFMTU"); + bb_perror_msg("SIOCSIFMTU"); close(s); return -1; } @@ -152,14 +152,14 @@ static int get_address(char *dev, int *htype) s = socket(PF_PACKET, SOCK_DGRAM, 0); if (s < 0) { - perror("socket(PF_PACKET)"); + bb_perror_msg("socket(PF_PACKET)"); return -1; } memset(&ifr, 0, sizeof(ifr)); strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name)); if (ioctl(s, SIOCGIFINDEX, &ifr) < 0) { - perror("SIOCGIFINDEX"); + bb_perror_msg("SIOCGIFINDEX"); close(s); return -1; } @@ -169,14 +169,14 @@ static int get_address(char *dev, int *htype) me.sll_ifindex = ifr.ifr_ifindex; me.sll_protocol = htons(ETH_P_LOOP); if (bind(s, (struct sockaddr*)&me, sizeof(me)) == -1) { - perror("bind"); + bb_perror_msg("bind"); close(s); return -1; } alen = sizeof(me); if (getsockname(s, (struct sockaddr*)&me, &alen) == -1) { - perror("getsockname"); + bb_perror_msg("getsockname"); close(s); return -1; } @@ -210,7 +210,7 @@ static int set_address(struct ifreq *ifr, int brd) if (s < 0) return -1; if (ioctl(s, brd?SIOCSIFHWBROADCAST:SIOCSIFHWADDR, ifr) < 0) { - perror(brd?"SIOCSIFHWBROADCAST":"SIOCSIFHWADDR"); + bb_perror_msg(brd ? "SIOCSIFHWBROADCAST" : "SIOCSIFHWADDR"); close(s); return -1; } @@ -222,8 +222,8 @@ static int set_address(struct ifreq *ifr, int brd) static int do_set(int argc, char **argv) { char *dev = NULL; - __u32 mask = 0; - __u32 flags = 0; + uint32_t mask = 0; + uint32_t flags = 0; int qlen = -1; int mtu = -1; char *newaddr = NULL; diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c index 30d455602..bf6f95f61 100644 --- a/networking/libiproute/iproute.c +++ b/networking/libiproute/iproute.c @@ -15,12 +15,6 @@ #include "libbb.h" -#include - -#include -#include -#include - #include "rt_names.h" #include "utils.h" #include "ip_common.h" @@ -248,7 +242,7 @@ static int print_route(struct sockaddr_nl *who ATTRIBUTE_UNUSED, abuf, sizeof(abuf))); } if (tb[RTA_PRIORITY]) { - fprintf(fp, " metric %d ", *(__u32*)RTA_DATA(tb[RTA_PRIORITY])); + fprintf(fp, " metric %d ", *(uint32_t*)RTA_DATA(tb[RTA_PRIORITY])); } if (r->rtm_family == AF_INET6) { struct rta_cacheinfo *ci = NULL; @@ -405,7 +399,8 @@ static int iproute_modify(int cmd, unsigned flags, int argc, char **argv) ll_init_map(&rth); if (d) { - if ((idx = ll_name_to_index(d)) == 0) { + idx = ll_name_to_index(d); + if (idx == 0) { bb_error_msg("cannot find device \"%s\"", d); return -1; } diff --git a/networking/libiproute/iprule.c b/networking/libiproute/iprule.c index 19338770f..2a1b3746c 100644 --- a/networking/libiproute/iprule.c +++ b/networking/libiproute/iprule.c @@ -119,7 +119,7 @@ static int print_rule(struct sockaddr_nl *who ATTRIBUTE_UNUSED, fprintf(fp, "tos %s ", rtnl_dsfield_n2a(r->rtm_tos, b1, sizeof(b1))); } if (tb[RTA_PROTOINFO]) { - fprintf(fp, "fwmark %#x ", *(__u32*)RTA_DATA(tb[RTA_PROTOINFO])); + fprintf(fp, "fwmark %#x ", *(uint32_t*)RTA_DATA(tb[RTA_PROTOINFO])); } if (tb[RTA_IIF]) { @@ -130,8 +130,8 @@ static int print_rule(struct sockaddr_nl *who ATTRIBUTE_UNUSED, fprintf(fp, "lookup %s ", rtnl_rttable_n2a(r->rtm_table, b1, sizeof(b1))); if (tb[RTA_FLOW]) { - __u32 to = *(__u32*)RTA_DATA(tb[RTA_FLOW]); - __u32 from = to>>16; + uint32_t to = *(uint32_t*)RTA_DATA(tb[RTA_FLOW]); + uint32_t from = to>>16; to &= 0xFFFF; if (from) { fprintf(fp, "realms %s/", @@ -230,25 +230,25 @@ int iprule_modify(int cmd, int argc, char **argv) } else if (matches(*argv, "preference") == 0 || matches(*argv, "order") == 0 || matches(*argv, "priority") == 0) { - __u32 pref; + uint32_t pref; NEXT_ARG(); if (get_u32(&pref, *argv, 0)) invarg("preference value", *argv); addattr32(&req.n, sizeof(req), RTA_PRIORITY, pref); } else if (strcmp(*argv, "tos") == 0) { - __u32 tos; + uint32_t tos; NEXT_ARG(); if (rtnl_dsfield_a2n(&tos, *argv)) invarg("TOS value", *argv); req.r.rtm_tos = tos; } else if (strcmp(*argv, "fwmark") == 0) { - __u32 fwmark; + uint32_t fwmark; NEXT_ARG(); if (get_u32(&fwmark, *argv, 0)) invarg("fwmark value", *argv); addattr32(&req.n, sizeof(req), RTA_PROTOINFO, fwmark); } else if (matches(*argv, "realms") == 0) { - __u32 realm; + uint32_t realm; NEXT_ARG(); if (get_rt_realms(&realm, *argv)) invarg("realms", *argv); diff --git a/networking/libiproute/iptunnel.c b/networking/libiproute/iptunnel.c index 2080324ac..dbde477a0 100644 --- a/networking/libiproute/iptunnel.c +++ b/networking/libiproute/iptunnel.c @@ -267,7 +267,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p) } } else if (strcmp(*argv, "tos") == 0 || matches(*argv, "dsfield") == 0) { - __u32 uval; + uint32_t uval; NEXT_ARG(); if (strcmp(*argv, "inherit") != 0) { if (rtnl_dsfield_a2n(&uval, *argv)) diff --git a/networking/libiproute/libnetlink.c b/networking/libiproute/libnetlink.c index c7e17e1dd..969648067 100644 --- a/networking/libiproute/libnetlink.c +++ b/networking/libiproute/libnetlink.c @@ -319,7 +319,7 @@ int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer, } } -int addattr32(struct nlmsghdr *n, int maxlen, int type, __u32 data) +int addattr32(struct nlmsghdr *n, int maxlen, int type, uint32_t data) { int len = RTA_LENGTH(4); struct rtattr *rta; @@ -348,7 +348,7 @@ int addattr_l(struct nlmsghdr *n, int maxlen, int type, void *data, int alen) return 0; } -int rta_addattr32(struct rtattr *rta, int maxlen, int type, __u32 data) +int rta_addattr32(struct rtattr *rta, int maxlen, int type, uint32_t data) { int len = RTA_LENGTH(4); struct rtattr *subrta; diff --git a/networking/libiproute/libnetlink.h b/networking/libiproute/libnetlink.h index 7cfcd2042..bd1913618 100644 --- a/networking/libiproute/libnetlink.h +++ b/networking/libiproute/libnetlink.h @@ -2,7 +2,7 @@ #ifndef __LIBNETLINK_H__ #define __LIBNETLINK_H__ 1 -#include +//#include #include #include @@ -11,8 +11,8 @@ struct rtnl_handle int fd; struct sockaddr_nl local; struct sockaddr_nl peer; - __u32 seq; - __u32 dump; + uint32_t seq; + uint32_t dump; }; extern int rtnl_open(struct rtnl_handle *rth, unsigned subscriptions); @@ -31,9 +31,9 @@ extern int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer, extern int rtnl_send(struct rtnl_handle *rth, char *buf, int); -extern int addattr32(struct nlmsghdr *n, int maxlen, int type, __u32 data); +extern int addattr32(struct nlmsghdr *n, int maxlen, int type, uint32_t data); extern int addattr_l(struct nlmsghdr *n, int maxlen, int type, void *data, int alen); -extern int rta_addattr32(struct rtattr *rta, int maxlen, int type, __u32 data); +extern int rta_addattr32(struct rtattr *rta, int maxlen, int type, uint32_t data); extern int rta_addattr_l(struct rtattr *rta, int maxlen, int type, void *data, int alen); extern int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len); diff --git a/networking/libiproute/linux/pkt_sched.h b/networking/libiproute/linux/pkt_sched.h index d6cf1fc06..36c0a46e3 100644 --- a/networking/libiproute/linux/pkt_sched.h +++ b/networking/libiproute/linux/pkt_sched.h @@ -15,7 +15,7 @@ filler or even bulk. */ -#include +//#include #define TC_PRIO_BESTEFFORT 0 #define TC_PRIO_FILLER 1 @@ -32,15 +32,15 @@ struct tc_stats { - __u64 bytes; /* NUmber of enqueues bytes */ - __u32 packets; /* Number of enqueued packets */ - __u32 drops; /* Packets dropped because of lack of resources */ - __u32 overlimits; /* Number of throttle events when this + uint64_t bytes; /* Nnmber of enqueued bytes */ + uint32_t packets; /* Number of enqueued packets */ + uint32_t drops; /* Packets dropped because of lack of resources */ + uint32_t overlimits; /* Number of throttle events when this * flow goes out of allocated bandwidth */ - __u32 bps; /* Current flow byte rate */ - __u32 pps; /* Current flow packet rate */ - __u32 qlen; - __u32 backlog; + uint32_t bps; /* Current flow byte rate */ + uint32_t pps; /* Current flow packet rate */ + uint32_t qlen; + uint32_t backlog; #ifdef __KERNEL__ spinlock_t *lock; #endif @@ -86,14 +86,14 @@ struct tc_ratespec unsigned short feature; short addend; unsigned short mpu; - __u32 rate; + uint32_t rate; }; /* FIFO section */ struct tc_fifo_qopt { - __u32 limit; /* Queue length: bytes for bfifo, packets for pfifo */ + uint32_t limit; /* Queue length: bytes for bfifo, packets for pfifo */ }; /* PRIO section */ @@ -103,7 +103,7 @@ struct tc_fifo_qopt struct tc_prio_qopt { int bands; /* Number of bands */ - __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */ + uint8_t priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */ }; /* CSZ section */ @@ -113,7 +113,7 @@ struct tc_csz_qopt int flows; /* Maximal number of guaranteed flows */ unsigned char R_log; /* Fixed point position for round number */ unsigned char delta_log; /* Log of maximal managed time interval */ - __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> CSZ band */ + uint8_t priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> CSZ band */ }; struct tc_csz_copt @@ -121,9 +121,9 @@ struct tc_csz_copt struct tc_ratespec slice; struct tc_ratespec rate; struct tc_ratespec peakrate; - __u32 limit; - __u32 buffer; - __u32 mtu; + uint32_t limit; + uint32_t buffer; + uint32_t mtu; }; enum @@ -140,9 +140,9 @@ struct tc_tbf_qopt { struct tc_ratespec rate; struct tc_ratespec peakrate; - __u32 limit; - __u32 buffer; - __u32 mtu; + uint32_t limit; + uint32_t buffer; + uint32_t mtu; }; enum @@ -164,7 +164,7 @@ struct tc_sfq_qopt { unsigned quantum; /* Bytes per round allocated to flow */ int perturb_period; /* Period of hash perturbation */ - __u32 limit; /* Maximal packets in queue */ + uint32_t limit; /* Maximal packets in queue */ unsigned divisor; /* Hash divisor */ unsigned flows; /* Maximal number of flows */ }; @@ -189,9 +189,9 @@ enum struct tc_red_qopt { - __u32 limit; /* HARD maximal queue length (bytes) */ - __u32 qth_min; /* Min average length threshold (bytes) */ - __u32 qth_max; /* Max average length threshold (bytes) */ + uint32_t limit; /* HARD maximal queue length (bytes) */ + uint32_t qth_min; /* Min average length threshold (bytes) */ + uint32_t qth_max; /* Max average length threshold (bytes) */ unsigned char Wlog; /* log(W) */ unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ unsigned char Scell_log; /* cell size for idle damping */ @@ -201,10 +201,10 @@ struct tc_red_qopt struct tc_red_xstats { - __u32 early; /* Early drops */ - __u32 pdrop; /* Drops due to queue limits */ - __u32 other; /* Drops due to drop() calls */ - __u32 marked; /* Marked packets */ + uint32_t early; /* Early drops */ + uint32_t pdrop; /* Drops due to queue limits */ + uint32_t other; /* Drops due to drop() calls */ + uint32_t marked; /* Marked packets */ }; /* GRED section */ @@ -222,33 +222,30 @@ enum #define TCA_SET_OFF TCA_GRED_PARMS struct tc_gred_qopt { - __u32 limit; /* HARD maximal queue length (bytes) -*/ - __u32 qth_min; /* Min average length threshold (bytes) -*/ - __u32 qth_max; /* Max average length threshold (bytes) -*/ - __u32 DP; /* upto 2^32 DPs */ - __u32 backlog; - __u32 qave; - __u32 forced; - __u32 early; - __u32 other; - __u32 pdrop; - - unsigned char Wlog; /* log(W) */ + uint32_t limit; /* HARD maximal queue length (bytes) */ + uint32_t qth_min; /* Min average length threshold (bytes) */ + uint32_t qth_max; /* Max average length threshold (bytes) */ + uint32_t DP; /* upto 2^32 DPs */ + uint32_t backlog; + uint32_t qave; + uint32_t forced; + uint32_t early; + uint32_t other; + uint32_t pdrop; + + unsigned char Wlog; /* log(W) */ unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ unsigned char Scell_log; /* cell size for idle damping */ - __u8 prio; /* prio of this VQ */ - __u32 packets; - __u32 bytesin; + uint8_t prio; /* prio of this VQ */ + uint32_t packets; + uint32_t bytesin; }; /* gred setup */ struct tc_gred_sopt { - __u32 DPs; - __u32 def_DP; - __u8 grio; + uint32_t DPs; + uint32_t def_DP; + uint8_t grio; }; /* HTB section */ @@ -257,30 +254,30 @@ struct tc_gred_sopt struct tc_htb_opt { - struct tc_ratespec rate; - struct tc_ratespec ceil; - __u32 buffer; - __u32 cbuffer; - __u32 quantum; /* out only */ - __u32 level; /* out only */ - __u8 prio; - __u8 injectd; /* inject class distance */ - __u8 pad[2]; + struct tc_ratespec rate; + struct tc_ratespec ceil; + uint32_t buffer; + uint32_t cbuffer; + uint32_t quantum; /* out only */ + uint32_t level; /* out only */ + uint8_t prio; + uint8_t injectd; /* inject class distance */ + uint8_t pad[2]; }; struct tc_htb_glob { - __u32 rate2quantum; /* bps->quantum divisor */ - __u32 defcls; /* default class number */ - __u32 use_dcache; /* use dequeue cache ? */ - __u32 debug; /* debug flags */ + uint32_t rate2quantum; /* bps->quantum divisor */ + uint32_t defcls; /* default class number */ + uint32_t use_dcache; /* use dequeue cache ? */ + uint32_t debug; /* debug flags */ /* stats */ - __u32 deq_rate; /* dequeue rate */ - __u32 utilz; /* dequeue utilization */ - __u32 trials; /* deq_prio trials per dequeue */ - __u32 dcache_hits; - __u32 direct_pkts; /* count of non shapped packets */ + uint32_t deq_rate; /* dequeue rate */ + uint32_t utilz; /* dequeue utilization */ + uint32_t trials; /* deq_prio trials per dequeue */ + uint32_t dcache_hits; + uint32_t direct_pkts; /* count of non shapped packets */ }; enum { @@ -292,12 +289,12 @@ enum }; struct tc_htb_xstats { - __u32 lends; - __u32 borrows; - __u32 giants; /* too big packets (rate will not be accurate) */ - __u32 injects; /* how many times leaf used injected bw */ - __u32 tokens; - __u32 ctokens; + uint32_t lends; + uint32_t borrows; + uint32_t giants; /* too big packets (rate will not be accurate) */ + uint32_t injects; /* how many times leaf used injected bw */ + uint32_t tokens; + uint32_t ctokens; }; /* CBQ section */ @@ -320,10 +317,10 @@ struct tc_cbq_lssopt #define TCF_CBQ_LSS_MINIDLE 8 #define TCF_CBQ_LSS_OFFTIME 0x10 #define TCF_CBQ_LSS_AVPKT 0x20 - __u32 maxidle; - __u32 minidle; - __u32 offtime; - __u32 avpkt; + uint32_t maxidle; + uint32_t minidle; + uint32_t offtime; + uint32_t avpkt; }; struct tc_cbq_wrropt @@ -332,8 +329,8 @@ struct tc_cbq_wrropt unsigned char priority; unsigned char cpriority; unsigned char __reserved; - __u32 allot; - __u32 weight; + uint32_t allot; + uint32_t weight; }; struct tc_cbq_ovl @@ -345,7 +342,7 @@ struct tc_cbq_ovl #define TC_CBQ_OVL_DROP 3 #define TC_CBQ_OVL_RCLASSIC 4 unsigned char priority2; - __u32 penalty; + uint32_t penalty; }; struct tc_cbq_police @@ -357,17 +354,17 @@ struct tc_cbq_police struct tc_cbq_fopt { - __u32 split; - __u32 defmap; - __u32 defchange; + uint32_t split; + uint32_t defmap; + uint32_t defchange; }; struct tc_cbq_xstats { - __u32 borrows; - __u32 overactions; - __s32 avgidle; - __s32 undertime; + uint32_t borrows; + uint32_t overactions; + int32_t avgidle; + int32_t undertime; }; enum diff --git a/networking/libiproute/rtm_map.c b/networking/libiproute/rtm_map.c index 8aaee4bd7..7eb4c7122 100644 --- a/networking/libiproute/rtm_map.c +++ b/networking/libiproute/rtm_map.c @@ -88,9 +88,9 @@ int rtnl_rtntype_a2n(int *id, char *arg) return 0; } -int get_rt_realms(__u32 *realms, char *arg) +int get_rt_realms(uint32_t *realms, char *arg) { - __u32 realm = 0; + uint32_t realm = 0; char *p = strchr(arg, '/'); *realms = 0; diff --git a/networking/libiproute/rtm_map.h b/networking/libiproute/rtm_map.h index 1ffb940b9..b9c8c503f 100644 --- a/networking/libiproute/rtm_map.h +++ b/networking/libiproute/rtm_map.h @@ -5,7 +5,7 @@ char *rtnl_rtntype_n2a(int id, char *buf, int len); int rtnl_rtntype_a2n(int *id, char *arg); -int get_rt_realms(__u32 *realms, char *arg); +int get_rt_realms(uint32_t *realms, char *arg); #endif /* __RTM_MAP_H__ */ diff --git a/networking/libiproute/utils.c b/networking/libiproute/utils.c index fc6aff1d1..aa60ffd01 100644 --- a/networking/libiproute/utils.c +++ b/networking/libiproute/utils.c @@ -47,7 +47,7 @@ int get_unsigned(unsigned *val, char *arg, int base) return 0; } -int get_u32(__u32 * val, char *arg, int base) +int get_u32(uint32_t * val, char *arg, int base) { unsigned long res; char *ptr; @@ -61,7 +61,7 @@ int get_u32(__u32 * val, char *arg, int base) return 0; } -int get_u16(__u16 * val, char *arg, int base) +int get_u16(uint16_t * val, char *arg, int base) { unsigned long res; char *ptr; @@ -75,7 +75,7 @@ int get_u16(__u16 * val, char *arg, int base) return 0; } -int get_u8(__u8 * val, char *arg, int base) +int get_u8(uint8_t * val, char *arg, int base) { unsigned long res; char *ptr; @@ -89,7 +89,7 @@ int get_u8(__u8 * val, char *arg, int base) return 0; } -int get_s16(__s16 * val, char *arg, int base) +int get_s16(int16_t * val, char *arg, int base) { long res; char *ptr; @@ -103,7 +103,7 @@ int get_s16(__s16 * val, char *arg, int base) return 0; } -int get_s8(__s8 * val, char *arg, int base) +int get_s8(int8_t * val, char *arg, int base) { long res; char *ptr; @@ -225,7 +225,7 @@ int get_prefix(inet_prefix * dst, char *arg, int family) return 0; } -__u32 get_addr32(char *name) +uint32_t get_addr32(char *name) { inet_prefix addr; @@ -268,8 +268,8 @@ int matches(char *cmd, char *pattern) int inet_addr_match(inet_prefix * a, inet_prefix * b, int bits) { - __u32 *a1 = a->data; - __u32 *a2 = b->data; + uint32_t *a1 = a->data; + uint32_t *a2 = b->data; int words = bits >> 0x05; bits &= 0x1f; @@ -279,8 +279,8 @@ int inet_addr_match(inet_prefix * a, inet_prefix * b, int bits) return -1; if (bits) { - __u32 w1, w2; - __u32 mask; + uint32_t w1, w2; + uint32_t mask; w1 = a1[words]; w2 = a2[words]; diff --git a/networking/libiproute/utils.h b/networking/libiproute/utils.h index 98634dde7..3ecbb3abd 100644 --- a/networking/libiproute/utils.h +++ b/networking/libiproute/utils.h @@ -3,8 +3,8 @@ #define __UTILS_H__ 1 #include "libbb.h" -#include -#include +//#include +//#include #include "libnetlink.h" #include "ll_map.h" @@ -34,10 +34,10 @@ extern void incomplete_command(void) ATTRIBUTE_NORETURN; typedef struct { - __u8 family; - __u8 bytelen; - __s16 bitlen; - __u32 data[4]; + uint8_t family; + uint8_t bytelen; + int16_t bitlen; + uint32_t data[4]; } inet_prefix; #define DN_MAXADDL 20 @@ -58,7 +58,7 @@ struct ipx_addr { uint8_t ipx_node[IPX_NODE_LEN]; }; -extern __u32 get_addr32(char *name); +extern uint32_t get_addr32(char *name); extern int get_addr_1(inet_prefix *dst, char *arg, int family); extern int get_prefix_1(inet_prefix *dst, char *arg, int family); extern int get_addr(inet_prefix *dst, char *arg, int family); @@ -69,11 +69,11 @@ extern int get_unsigned(unsigned *val, char *arg, int base); #define get_byte get_u8 #define get_ushort get_u16 #define get_short get_s16 -extern int get_u32(__u32 *val, char *arg, int base); -extern int get_u16(__u16 *val, char *arg, int base); -extern int get_s16(__s16 *val, char *arg, int base); -extern int get_u8(__u8 *val, char *arg, int base); -extern int get_s8(__s8 *val, char *arg, int base); +extern int get_u32(uint32_t *val, char *arg, int base); +extern int get_u16(uint16_t *val, char *arg, int base); +extern int get_s16(int16_t *val, char *arg, int base); +extern int get_u8(uint8_t *val, char *arg, int base); +extern int get_s8(int8_t *val, char *arg, int base); extern const char *format_host(int af, int len, void *addr, char *buf, int buflen); extern const char *rt_addr_n2a(int af, int len, void *addr, char *buf, int buflen); @@ -93,7 +93,7 @@ int ipx_pton(int af, const char *src, void *addr); extern int __iproute2_hz_internal; extern int __get_hz(void); -static __inline__ int get_hz(void) +static inline int get_hz(void) { if (__iproute2_hz_internal == 0) __iproute2_hz_internal = __get_hz(); diff --git a/networking/route.c b/networking/route.c index a8926f44e..d6d9b7dd9 100644 --- a/networking/route.c +++ b/networking/route.c @@ -462,17 +462,13 @@ static const char flagchars[] = /* Must agree with flagvals[]. */ #endif ; -static -#ifndef CONFIG_FEATURE_IPV6 -__inline -#endif -void set_flags(char *flagstr, int flags) +static void set_flags(char *flagstr, int flags) { int i; *flagstr++ = 'U'; - for (i=0 ; (*flagstr = flagchars[i]) != 0 ; i++) { + for (i = 0; (*flagstr = flagchars[i]) != 0; i++) { if (flags & flagvals[i]) { ++flagstr; } @@ -480,7 +476,6 @@ void set_flags(char *flagstr, int flags) } /* also used in netstat */ -void displayroutes(int noresolve, int netstatfmt); void displayroutes(int noresolve, int netstatfmt) { char devname[64], flags[16], sdest[16], sgw[16]; @@ -492,9 +487,8 @@ void displayroutes(int noresolve, int netstatfmt) FILE *fp = xfopen("/proc/net/route", "r"); printf("Kernel IP routing table\n" - "Destination Gateway Genmask" - " Flags %s Iface\n", - netstatfmt ? " MSS Window irtt" : "Metric Ref Use"); + "Destination Gateway Genmask Flags %s Iface\n", + netstatfmt ? " MSS Window irtt" : "Metric Ref Use"); if (fscanf(fp, "%*[^\n]\n") < 0) { /* Skip the first line. */ goto ERROR; /* Empty or missing line, or read error. */ @@ -508,7 +502,7 @@ void displayroutes(int noresolve, int netstatfmt) if ((r < 0) && feof(fp)) { /* EOF with no (nonspace) chars read. */ break; } - ERROR: + ERROR: bb_error_msg_and_die("fscanf"); } @@ -574,7 +568,7 @@ static void INET6_displayroutes(int noresolve) if ((r < 0) && feof(fp)) { /* EOF with no (nonspace) chars read. */ break; } - ERROR: + ERROR: bb_error_msg_and_die("fscanf"); } -- 2.25.1