Commit Graph

55 Commits

Author SHA1 Message Date
Denys Vlasenko
965b795b87 decrease paddign: gcc-9.3.1 slaps 32-byte alignment on arrays willy-nilly
text	   data	    bss	    dec	    hex	filename
1021988	    559	   5052	1027599	  fae0f	busybox_old
1021236	    559	   5052	1026847	  fab1f	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-30 13:03:03 +01:00
Ron Yorston
5c69ad0ecd build system: drop PLATFORM_LINUX
PLATFORM_LINUX is a hidden configuration option which is disabled by
default and enabled at over a hundred locations for features that are
deemed to be Linux specific.

The only effect of PLATFORM_LINUX is to control compilation of
libbb/match_fstype.c.  This file is only needed by mount and umount.

Remove all references to PLATFORM_LINUX and compile match_fstype.c
if mount or umount is enabled.

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-08-13 17:12:56 +02:00
James Byrne
6937487be7 libbb: reduce the overhead of single parameter bb_error_msg() calls
Back in 2007, commit 0c97c9d437 ("'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>
2019-07-02 11:35:03 +02:00
Denys Vlasenko
b097a84d62 config: update size information
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-28 03:20:17 +01:00
Denys Vlasenko
abfa3ec059 move storage helpers to libbb.h
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-09-28 15:13:04 +02:00
Denys Vlasenko
7398892ac0 mkfs_ext2, mkfs_vfat: fix warnings in STORE_LE on big-endian platforms
"warning: large integer implicitly truncated to unsigned type [-Woverflow]"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-02-15 13:46:34 +01:00
Denys Vlasenko
72089cf6b4 config: deindent all help texts
Those two spaces after tab have no effect, and always a nuisance when editing.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-21 09:50:55 +02:00
Denys Vlasenko
4eed2c6c50 Update menuconfig items with approximate applet sizes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-18 22:01:24 +02:00
Denys Vlasenko
205d48e948 *: add comment about APPLET_ODDNAME format
It confused me more than once

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-29 14:57:33 +01:00
Denys Vlasenko
0581a2f304 Make mke2fs and mkfs.ext2 individually selectable
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-16 16:12:11 +01:00
Denys Vlasenko
237bedd499 getopt32: add new syntax of 'o:+' and 'o:*' for -o NUM and -o LIST
In many cases, this aqllows to drop use of opt_complementary.
Approximately -400 bytes:

function                                             old     new   delta
getopt32                                            1423    1502     +79
opt_string                                            17      18      +1
OPT_STR                                               24      25      +1
uniq_main                                            416     406     -10
timeout_main                                         279     269     -10
sulogin_main                                         270     260     -10
readprofile_main                                    1825    1815     -10
ps_main                                              543     533     -10
pidof_main                                           245     235     -10
pgrep_main                                           611     601     -10
od_main                                             2600    2590     -10
mkfs_minix_main                                     2684    2674     -10
mkfs_ext2_main                                      2603    2593     -10
microcom_main                                        712     702     -10
makemime_main                                        315     305     -10
ionice_main                                          282     272     -10
inetd_main                                          2074    2064     -10
ifplugd_main                                        1144    1134     -10
halt_main                                            353     343     -10
getopt_main                                          636     626     -10
fdisk_main                                          2854    2844     -10
env_main                                             206     196     -10
dmesg_main                                           319     309     -10
conspy_main                                         1214    1204     -10
awk_main                                             981     971     -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/22 up/down: 81/-220)         Total: -139 bytes
   text	   data	    bss	    dec	    hex	filename
 919373	    906	  14060	 934339	  e41c3	busybox_old
 918969	    906	  14060	 933935	  e402f	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-07-06 21:58:02 +02:00
Denys Vlasenko
066e76befe Replace a few more bb_info_msg's by bb_error_msg or printf
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-30 16:20:28 +02:00
Denys Vlasenko
76b680c7a8 Use bb_error_msg instead of bb_info_msg in all commented-out debug printouts
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-30 16:04:37 +02:00
Denys Vlasenko
c9a13116a4 mount: fix the wrongly stored fs creation time
This bug made our ext2 images non-mountable by ext4 driver.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-06-21 16:50:46 +02:00
Denys Vlasenko
176bc34475 Drop include/bb_linux_ext2_fs.h, use existing e2fsprogs/e2fs_defs.h
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-04-17 15:06:55 +02:00
Denys Vlasenko
0b2b0f31a3 Create and use our own copy of linux/ext2_fs.h
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-04-13 16:39:18 +02:00
Denys Vlasenko
caf5768154 work around linux/ext2_fs.h breakage
See https://bugzilla.kernel.org/show_bug.cgi?id=42986

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-04-12 14:01:10 +02:00
Denys Vlasenko
7550201e9a mke2fs: do not zero out first kilobyte. Closes 3247
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-01-11 01:02:31 +01:00
Pere Orga
5bc8c005a8 move remaining help text from include/usage.src.h
Signed-off-by: Pere Orga <gotrunks@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-11 03:29:49 +02:00
Denys Vlasenko
e4dcba1c10 *: whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-28 18:57:19 +02:00
Denys Vlasenko
8d3e225a2d libbb: add xfstat function
function                                             old     new   delta
xfstat                                                 -      25     +25
mkfs_ext2_main                                      2421    2423      +2
mkfs_reiser_main                                    1197    1194      -3
next                                                 312     307      -5
ar_main                                              533     522     -11
mkfs_minix_main                                     2938    2924     -14
mkfs_vfat_main                                      1511    1495     -16
writeTarFile                                         272     255     -17
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/6 up/down: 27/-66)            Total: -39 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-08-31 12:42:06 +02:00
Denys Vlasenko
0ef64bdb40 *: make GNU licensing statement forms more regular
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>
2010-08-16 20:14:46 +02:00
Denys Vlasenko
8f599f9a31 mkfs_ext2: improve comments a bit
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-18 12:40:57 +02:00
Bernhard Reutner-Fischer
5070124763 mkfs_ext2: reuse string
function                                             old     new   delta
mkfs_ext2_main                                      2376    2378      +2
.rodata                                           135872  135848     -24
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 2/-24)             Total: -22 bytes

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-06-18 11:49:44 +02:00
Bernhard Reutner-Fischer
cd5aa5c5da mkfs_ext2: fix handling of -I argument
-I <unsigned int> but was treated as a character

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-06-18 11:47:45 +02:00
Denys Vlasenko
6774386d95 tune2fs: move to e2fsprogs
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-09 00:13:40 +02:00
Denys Vlasenko
baad6d889d mkfs_ext2: fix bad comment. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-02 12:54:19 +01:00
Denys Vlasenko
40e7d25aca mkXXXX: unify [KBYTES] parameter handling (added it to mkswap)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-01 23:48:27 +01:00
Denys Vlasenko
3581c62515 whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-25 13:39:24 +01:00
Denys Vlasenko
4b8b37f981 mkfs_ext2: fix compile error
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-24 17:20:29 +02:00
Denys Vlasenko
46e364dbfe mkfs_ext2: code shrink
function                                             old     new   delta
mkfs_ext2_main                                      2505    2492     -13

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-22 12:41:44 +02:00
Denys Vlasenko
09bbb2892d mkfs_ext2: fix a bug where we don't fully respect -n on files
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-22 12:27:10 +02:00
Denys Vlasenko
149a32a19b mkfs_ext2: use compatible inode sizes; add -I <inodesize>. (by Vladimir)
function                                             old     new   delta
mkfs_ext2_main                                      2385    2495    +110
packed_usage                                       26400   26447     +47
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 157/0)             Total: 157 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-22 12:12:17 +02:00
Denys Vlasenko
481ca9604d mkfs_ext2: 1.41.9 compat
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-22 00:38:52 +02:00
Denys Vlasenko
010fb00708 mkfs_ext2: make sure we extend the image to requested size
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-21 23:23:55 +02:00
Denys Vlasenko
ece01ee8ca mkfs_ext2: e2fsck 1.14.4 compat
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-21 14:01:25 +02:00
Denys Vlasenko
2ee2724a41 mkfs_ext2: explain 256-byte inodes. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-21 11:34:32 +02:00
Denys Vlasenko
2288d86a54 mkfs_ext2: explain why 0.5G+ images are a bit different
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-21 00:34:27 +02:00
Denys Vlasenko
5e1dbd5bc3 mkfs_ext2: another update by Vladimir
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-20 22:12:11 +02:00
Denys Vlasenko
a4e4a65484 clarify in comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-20 17:49:50 +02:00
Denys Vlasenko
c708a6d000 mkfs_ext2: further work on small images
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-20 17:47:23 +02:00
Denys Vlasenko
82d6433abe mkfs_ext2: fixes for small image generation. images up to ~8M are ok now
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-20 17:04:55 +02:00
Denys Vlasenko
cbeb452824 mkfs_ext2: fix 60k image creation
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-20 16:21:29 +02:00
Denys Vlasenko
95484c8706 mkfs_ext2: further work by Vladimir
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-20 13:34:16 +02:00
Denys Vlasenko
69f2e2cdeb mkfs_ext2: small tweak
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-20 00:16:24 +02:00
Denys Vlasenko
05647b5551 mkfs_ext2: compat fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-20 00:06:03 +02:00
Denys Vlasenko
e8405619fa mkfs_ext2: more work. added test script
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-18 20:57:52 +02:00
Denys Vlasenko
f9d3a91a89 mkfs_ext2: fixes for huge filesystems
function                                             old     new   delta
mkfs_ext2_main                                      2145    2617    +472
div_roundup                                           15      35     +20
packed_usage                                       26792   26776     -16

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-18 18:05:27 +02:00
Denys Vlasenko
77da1cae94 mkfs_ext2: make it able to create images larger than 4G
function                                             old     new   delta
mkfs_ext2_main                                      1904    2145    +241
has_super                                             29      23      -6
PUT                                                   52      40     -12
packed_usage                                       26807   26792     -15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 241/-33)           Total: 208 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-18 16:29:30 +02:00
Denys Vlasenko
7673e7fda4 mkfs_ext2: shrink
function                                             old     new   delta
mkfs_ext2_main                                      1924    1904     -20

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-18 09:57:39 +02:00