Age | Commit message (Collapse) | Author |
|
Back in 2007, commit 0c97c9d43707 ("'simple' error message functions by
Loic Grenie") introduced bb_simple_perror_msg() to allow for a lower
overhead call to bb_perror_msg() when only a string was being printed
with no parameters. This saves space for some CPU architectures because
it avoids the overhead of a call to a variadic function. However there
has never been a simple version of bb_error_msg(), and since 2007 many
new calls to bb_perror_msg() have been added that only take a single
parameter and so could have been using bb_simple_perror_message().
This changeset introduces 'simple' versions of bb_info_msg(),
bb_error_msg(), bb_error_msg_and_die(), bb_herror_msg() and
bb_herror_msg_and_die(), and replaces all calls that only take a
single parameter, or use something like ("%s", arg), with calls to the
corresponding 'simple' version.
Since it is likely that single parameter calls to the variadic functions
may be accidentally reintroduced in the future a new debugging config
option WARN_SIMPLE_MSG has been introduced. This uses some macro magic
which will cause any such calls to generate a warning, but this is
turned off by default to avoid use of the unpleasant macros in normal
circumstances.
This is a large changeset due to the number of calls that have been
replaced. The only files that contain changes other than simple
substitution of function calls are libbb.h, libbb/herror_msg.c,
libbb/verror_msg.c and libbb/xfuncs_printf.c. In miscutils/devfsd.c,
networking/udhcp/common.h and util-linux/mdev.c additonal macros have
been added for logging so that single parameter and multiple parameter
logging variants exist.
The amount of space saved varies considerably by architecture, and was
found to be as follows (for 'defconfig' using GCC 7.4):
Arm: -92 bytes
MIPS: -52 bytes
PPC: -1836 bytes
x86_64: -938 bytes
Note that for the MIPS architecture only an exception had to be made
disabling the 'simple' calls for 'udhcp' (in networking/udhcp/common.h)
because it made these files larger on MIPS.
Signed-off-by: James Byrne <james.byrne@origamienergy.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
get_addr_1 258 287 +29
next_arg - 22 +22
print_neigh 885 902 +17
do_iplink 1269 1276 +7
get_unsigned 54 55 +1
get_u32 54 55 +1
get_u16 62 63 +1
rt_addr_n2a 53 52 -1
ipaddr_modify 1229 1226 -3
get_addr32 58 54 -4
invarg_1_to_2 18 12 -6
inet_addr_match 109 103 -6
duparg2 18 12 -6
duparg 18 12 -6
print_addrinfo 1231 1223 -8
ipneigh_list_or_flush 724 714 -10
incomplete_command 10 - -10
iproute_get 847 835 -12
ipaddr_list_or_flush 1265 1253 -12
get_prefix 356 344 -12
do_add_or_delete 1162 1150 -12
get_addr 73 58 -15
iproute_list_or_flush 1210 1191 -19
parse_args 1434 1412 -22
print_rule 634 610 -24
iprule_modify 864 816 -48
print_route 1621 1565 -56
iproute_modify 1221 1164 -57
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 6/20 up/down: 78/-349) Total: -271 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
rt_addr_n2a 56 53 -3
print_addrinfo 1227 1178 -49
print_neigh 933 881 -52
print_rule 689 617 -72
print_tunnel 640 560 -80
print_route 1727 1588 -139
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/6 up/down: 0/-395) Total: -395 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
invarg(a,b) - "invalid argument", but how a and b enter the message?
invarg_1_to_2(a,b) is somewhat easier to read: "invalid argument 'a' to 'b'"
Audit of usage revealed a number of bad uses, with too long messages.
text data bss dec hex filename
938848 932 17448 957228 e9b2c busybox_old
938788 932 17448 957168 e9af0 busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
This patch ports the 'ip neigh' command, originally written by Alexey
Kuznetsov, <kuznet@ms2.inr.ac.ru>, to busybox.
The base of the port is the version of iproute that shipped with
Debian Squeeze, taken from:
http://http.debian.net/debian/pool/main/i/iproute/iproute_20100519.orig.tar.gz
This patch has actively been used by the Open Network Install
Environment (ONIE) project for over 3 years without incident.
function old new delta
print_neigh - 933 +933
ipneigh_list_or_flush - 742 +742
get_hz - 109 +109
do_ipneigh - 62 +62
do_iproute 2112 2153 +41
packed_usage 30647 30667 +20
ipneigh_main - 14 +14
static.ip_neigh_commands - 12 +12
static.nuds - 9 +9
static.ip_func_ptrs 32 36 +4
print_route 1858 1727 -131
------------------------------------------------------------------------------
(add/remove: 8/0 grow/shrink: 3/1 up/down: 1946/-131) Total: 1815 bytes
Signed-off-by: Curt Brune <curt@cumulusnetworks.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
print_route 1613 1813 +200
get_addr_1 209 258 +49
get_prefix 393 356 -37
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 249/-37) Total: 212 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
|
|
text data bss dec hex filename
861980 441 7540 869961 d4649 busybox_old
861914 441 7540 869895 d4607 busybox_unstripped
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
|
|
This change retains "or later" state! No licensing _changes_ here,
only form is adjusted (article, space between "GPL" and "v2" and so on).
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
bb_parse_mode 433 431 -2
rtnl_rtntype_a2n 202 198 -4
ParseField 511 498 -13
bb_init_module_24 4730 4675 -55
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-74) Total: -74 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
and other misc stuff
function old new delta
print_tunnel 660 656 -4
format_host 5 - -5
get_unsigned 70 54 -16
get_u32 70 54 -16
do_iplink 1173 1151 -22
get_prefix 417 393 -24
print_rule 800 771 -29
print_addrinfo 1374 1342 -32
print_route 1745 1709 -36
iprule_modify 905 866 -39
iproute_modify 1105 1048 -57
get_integer 70 - -70
parse_args 1684 1440 -244
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 0/11 up/down: 0/-594) Total: -594 bytes
text data bss dec hex filename
817378 476 7892 825746 c9992 busybox_old
816784 476 7892 825152 c9740 busybox_unstripped
|
|
whereas "any" and "default" would be 0.0.0.0/0. They must be all 0.0.0.0/0.
Closes bug 57.
|
|
- adjust error message for wrong prefix not to mention address
Previously e.g. ip route add 127.0.0.0/255.0.0.0 dev dummy0
was rejected, saying
ip: an inet address is expected rather than "127.0.0.0/255.0.0.0"
function old new delta
get_prefix_1 201 309 +108
get_prefix 55 73 +18
get_addr 55 73 +18
get_addr32 48 58 +10
get_addr_1 249 204 -45
.rodata 114569 114524 -45
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/2 up/down: 154/-90) Total: 64 bytes
|
|
|
|
text data bss dec hex filename
1705 0 0 1705 6a9 networking/libiproute/utils.o.orig
1676 0 0 1676 68c networking/libiproute/utils.o
766 0 0 766 2fe networking/libiproute/rtm_map.o.orig
670 0 0 670 29e networking/libiproute/rtm_map.o
4942 0 0 4942 134e networking/libiproute/iptunnel.o.orig
4687 0 0 4687 124f networking/libiproute/iptunnel.o
|
|
|
|
|
|
|
|
Kill a few statics, made other globals smaller:
oneline is smallint, _SL_ is char
function old new delta
print_tunnel 693 731 +38
print_route 1775 1777 +2
print_addrinfo 1495 1497 +2
ipaddr_list_or_flush 2826 2828 +2
oneline 4 1 -3
_SL_ 4 1 -3
ipaddr_modify 1476 1472 -4
parse_address 124 119 -5
ip_parse_common_args 429 423 -6
on_off 53 46 -7
do_del_ioctl 113 106 -7
do_add_ioctl 120 113 -7
do_show 864 856 -8
iprule_list 157 148 -9
do_iptunnel 310 299 -11
do_add 143 126 -17
get_ctl_fd 95 76 -19
set_address 108 84 -24
ip_main 351 323 -28
static.ifr 32 - -32
parse_args 1992 1949 -43
iproute_list_or_flush 1673 1582 -91
do_iplink 1583 1485 -98
filter 280 - -280
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 4/18 up/down: 44/-702) Total: -658 bytes
|
|
|
|
|
|
move get_hz to the only caller
|
|
|
|
|
|
nothing INET-specific
|
|
introduce index_in_substr_array and use it in
iproute2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- use shorter boilerplate while at it.
|
|
|
|
On machines with only ANSI compliant compilers, not explitily delcaring
an empty parameter list 'void' causes failure.
|
|
|
|
|
|
|
|
|
|
|
|
|