Commit Graph

1417 Commits

Author SHA1 Message Date
Denys Vlasenko
e184a88356 df: implement -B n<suff> and -B <suff> formats of -B option
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-12-12 19:56:31 +01:00
Denys Vlasenko
1d3a04a3a4 Code style fixes, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-28 01:22:57 +01:00
Denys Vlasenko
710b6ce9b0 fdisk_gpt: simplify GPT partition name printing
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-27 20:47:01 +01:00
Denys Vlasenko
29516ac0e4 fdisk: sanitize partition name printing; drop "Code" column; get rid of one static var
function                                             old     new   delta
list_table                                          2335    2373     +38
fill_bounds                                          131     128      -3
part_array_len                                         4       -      -4
get_boot                                            1584    1574     -10
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/2 up/down: 38/-17)             Total: 21 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-27 06:13:43 +01:00
Denys Vlasenko
5b966c6180 Make "hd" independently selectable
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-23 11:53:12 +01:00
Denys Vlasenko
dd898c9f33 Convert all util-linux/* applets to "new style" applet definitions
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-23 11:46:32 +01:00
Denys Vlasenko
10880cc20f Make mkfs.vfat and mkdosfs individually selectable
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-16 16:18:50 +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
f417ffd88f Make swapon and swapoff individually selectable.
For example, without swapoff, code shrinks by 277 bytes.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-14 17:30:50 +01:00
Denys Vlasenko
c314ca9016 Make setarch/linux32/linux64 independently selectable
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-13 22:56:04 +01:00
Denys Vlasenko
713b513353 more: accept and ignore a bunch of options
Alpine Linux stumbled over "more -s":
http://bugs.alpinelinux.org/issues/5190

function                                             old     new   delta
more_main                                            857     872     +15

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-11 15:29:38 +02:00
Denys Vlasenko
b09ab448b8 mount: for cifs, dont insert "ip=ADDR" option if user gave it explicitly
This makes it possible to use scoped IPv6 addresses:

mount -t cifs -o ip=<ADDR>%<iface_id> //<ADDR>/test test

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-27 21:02:35 +02:00
Denys Vlasenko
5093c8c4aa mount: tweak "IPv6 scoped addr" commit
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-26 20:36:30 +02:00
Denys Vlasenko
3c18e3051d libbb: make xmalloc_sockaddr2dotted use NI_NUMERICSCOPE
Gives "mount -t cifs //fe80::6a05:caff:fe3e:dbf5%eth0/test test"
a chance to work: mount must pass "ip=numeric_IPv6%numeric_iface_id"
in the omunt option string. Currently, it does not.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-26 19:53:04 +02:00
Denys Vlasenko
b157eb13cb fdisk: fix CONFIG_FEATURE_SUN_LABEL=y build
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-17 21:05:06 +02:00
Denys Vlasenko
20a3262cd7 mdev: create devices from /sys/dev
Currently some new devices that have a bus but no class will
be missed by mdev coldplug device creation after boot. This
happens because mdev recursively searches /sys/class which will
by definition only find class devices.

Some important devices such as iio and gpiochip does not have
a class. But users will need them.

This switches from using /sys/class as the place to look for
devices to create to using /sys/dev where all char and block
devices are listed.

The subsystem lookup code that provide the G.subsystem
environment variable is changed from using the directory
name of the class device to instead dereference the
"subsystem" symlink for the device, and look at the last
element of the path of the symlink for the subsystem, which
will work with class devices and bus devices alike. (The new
bus-only devices only symlink to the /sys/bus/* hierarchy.)

We delete the legacy kernel v2.6.2x /sys/block device path
code as part of this change. It's too old to be kept alive.

Tested on kernel v4.6-rc2 with a bunch of devices, including
some IIO and gpiochip devices.

With a print inserted before make_device() the log looks
like so:

Create device from "/sys/dev/char/1:1", subsystem "mem"
Create device from "/sys/dev/char/1:2", subsystem "mem"
Create device from "/sys/dev/char/1:3", subsystem "mem"
Create device from "/sys/dev/char/1:5", subsystem "mem"
(...)
Create device from "/sys/dev/block/179:56", subsystem "block"
Create device from "/sys/dev/block/179:64", subsystem "block"

function                                             old     new   delta
mdev_main                                           1388    1346     -42
dirAction                                            134      14    -120
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-162)           Total: -162 bytes

Cc: Isaac Dunham <ibid.ag@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-07 14:09:01 +02:00
Serj Kalichev
d42cdc2222 volume_id: Add support for UBIFS
Signed-off-by: Serj Kalichev <serj.kalichev@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-06 18:31:01 +02:00
Denys Vlasenko
29483ffb07 fdisk: tweak some messages
"Total allocated sectors 2021315 greater than the maximum 2020356"

maximum what?

Turns out, that's the CHS size of the disk.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-23 17:18:45 +02:00
Denys Vlasenko
607f2b404e fdisk: print much less cryptic partition table
Before:

   Device Boot      Start         End      Blocks  Id System
/dev/sdb1   *           1         998      255471+  6 FAT16

What are "blocks"? What is that "+"?
How big is this partition?
Is start/end shown came from LBA fields or CHS fields?
Why are we torturing the user??

After:

Device  Boot StartCHS    EndCHS        StartLBA     EndLBA    Sectors  Size Id Type
/dev/sdb1 *  0,1,1       996,15,32           32     510974     510943  249M  6 FAT16

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-23 16:13:33 +02:00
Denys Vlasenko
2cf9fa6e59 unshare: --network should be --net. Closes 9116
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-22 20:19:34 +02: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
ecf25cb5bc randomconfig fixes 5: false positive for tar; mount emits corrupted message
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-06-20 11:04:04 +02:00
Denys Vlasenko
015db5800c randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-06-19 18:15:33 +02:00
Denys Vlasenko
2fbc3123a2 flock: merge spawn_and_wait() code patchs for -c and sans-c uses
function                                             old     new   delta
flock_main                                           334     319     -15

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-24 18:21:32 +02:00
Denys Vlasenko
e1d426fd65 flock: fix -c; improve error handling of fork+exec
function                                             old     new   delta
flock_main                                           254     334     +80

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-24 18:19:49 +02:00
Denys Vlasenko
3e134ebf6a *: slap on a few ALIGN1/2s where appropriate
The result of looking at "grep -F -B2 '*fill*' busybox_unstripped.map"

   text	   data	    bss	    dec	    hex	filename
 829901	   4086	   1904	 835891	  cc133	busybox_before
 829665	   4086	   1904	 835655	  cc047	busybox

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-22 18:09:21 +02:00
Denys Vlasenko
9de2e5a222 *: hopefully all setup_common_bufsiz() are in place
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-21 18:38:51 +02:00
Denys Vlasenko
47cfbf32fd *: add most of the required setup_common_bufsiz() calls
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-21 18:18:48 +02:00
Denys Vlasenko
e6a2f4cc5a libbb: make bb_common_bufsiz1 1 kbyte, add capability to use bss tail for it
The config item is FEATURE_USE_BSS_TAIL. When it is off (default):

function                                             old     new   delta
read_config                                          210     228     +18
doCommands                                          2279    2294     +15
ipneigh_list_or_flush                                763     772      +9
ipaddr_list_or_flush                                1256    1261      +5
display_process_list                                1301    1306      +5
conspy_main                                         1378    1383      +5
do_lzo_compress                                      352     355      +3
do_lzo_decompress                                    565     567      +2
push                                                  46      44      -2
inetd_main                                          2136    2134      -2
uevent_main                                          421     418      -3
addLines                                              97      92      -5
bb_common_bufsiz1                                   8193    1024   -7169
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 8/5 up/down: 62/-7181)        Total: -7119 bytes
   text	   data	    bss	    dec	    hex	filename
 829850	   4086	   9080	 843016	  cdd08	busybox_old
 829901	   4086	   1904	 835891	  cc133	busybox_unstripped

FEATURE_USE_BSS_TAIL=y:

read_config                                          210     228     +18
doCommands                                          2279    2294     +15
ipneigh_list_or_flush                                763     772      +9
ipaddr_list_or_flush                                1256    1261      +5
display_process_list                                1301    1306      +5
conspy_main                                         1378    1383      +5
do_lzo_compress                                      352     355      +3
do_lzo_decompress                                    565     567      +2
inetd_main                                          2136    2134      -2
bb_common_bufsiz1                                   8193       -   -8193
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 8/1 up/down: 62/-8195)        Total: -8133 bytes
   text	   data	    bss	    dec	    hex	filename
 829850	   4086	   9080	 843016	  cdd08	busybox_old
 829911	   4086	    880	 834877	  cbd3d	busybox_unstripped

FIXME: setup_common_bufsiz() calls are missing.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-21 17:39:11 +02:00
Denys Vlasenko
8b0f459af7 nsenter,unshare: work around older header
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-02 19:00:44 +02:00
Denys Vlasenko
8220399173 nsenter,unshare: share common code; fix a bug of not closing all fds
function                                             old     new   delta
xvfork_parent_waits_and_exits                          -      64     +64
exec_prog_or_SHELL                                     -      39     +39
unshare_main                                         873     810     -63
nsenter_main                                         663     596     -67
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 0/2 up/down: 106/-130)          Total: -27 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-02 18:06:24 +02:00
Denys Vlasenko
9f2f96edfa unshare: remove stale comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-02 04:44:39 +02:00
Bartosz Golaszewski
80c934a251 nsenter: new applet
function                                             old     new   delta
nsenter_main                                           -     663    +663
.rodata                                           155147  155612    +465
packed_usage                                       30536   30708    +172
nsenter_longopts                                       -     116    +116
open_by_path_or_target                                 -      58     +58
applet_names                                        2518    2526      +8
applet_main                                         2920    2928      +8
------------------------------------------------------------------------------
(add/remove: 4/0 grow/shrink: 4/0 up/down: 1490/0)           Total: 1490 bytes
   text	   data	    bss	    dec	    hex	filename
 827956	   4078	   9080	 841114	  cd59a	busybox_old
 829214	   4086	   9080	 842380	  cda8c	busybox_unstripped

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-01 22:19:35 +02:00
Denys Vlasenko
c4199f22d0 libbb: two new functions: wait_for_exitstatus(pid), xfchdir(fd)
Bartosz Golaszewski proposed xfchdir()

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-01 22:12:44 +02:00
Bartosz Golaszewski
29b33b63d4 unshare: new applet
function                                             old     new   delta
unshare_main                                           -     873    +873
.rodata                                           154444  155131    +687
packed_usage                                       30329   30520    +191
unshare_longopts                                       -     106    +106
mount_namespaces                                       -      99     +99
mount_or_die                                           -      51     +51
ns_list                                                -      48     +48
wait_for_exitstatus                                    -      41     +41
opt_str                                                -      17     +17
applet_names                                        2510    2518      +8
applet_main                                         2912    2920      +8
applet_suid                                           91      92      +1
applet_install_loc                                   182     183      +1
------------------------------------------------------------------------------
(add/remove: 8/0 grow/shrink: 6/0 up/down: 2131/0)           Total: 2131 bytes
   text	   data	    bss	    dec	    hex	filename
 826110	   4070	   9080	 839260	  cce5c	busybox_old
 827961	   4078	   9080	 841119	  cd59f	busybox_unstripped

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-01 19:44:39 +02:00
Denys Vlasenko
3b757f0798 mkfs_vfat: use bb_error_msg for logging, not bb_info_msg
This affects only a commented-out code section which searches for bad blocks

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-30 16:23:10 +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
31c984dd69 umount: build fix for older glibc
Based on a patch by Veli-Pekka Peltola <veli-pekka.peltola@ray.fi>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-28 22:23:33 +02:00
Denys Vlasenko
23961b2fd3 more bionic fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-14 19:34:15 +01:00
Ari Sundholm
dbf5a6da6a blkdiscard: new applet
function                                             old     new   delta
blkdiscard_main                                        -     264    +264

Signed-off-by: Ari Sundholm <ari@tuxera.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-01-02 01:18:32 +01:00
Denys Vlasenko
911d265faf mount: support "nofail" option. Closes 8551
function                                             old     new   delta
singlemount                                         1045    1060     +15
mount_option_str                                     338     345      +7
mount_it_now                                         355     361      +6
mount_options                                        172     176      +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 32/0)               Total: 32 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-12-30 20:11:34 +01:00
Denys Vlasenko
6c634f7968 swaponoff: fix compile-time warning
CC      util-linux/swaponoff.o
cc1: warnings being treated as errors
util-linux/swaponoff.c: In function 'swap_enable_disable':
util-linux/swaponoff.c💯 warning: passing argument 1 of 'resolve_mount_spec' from incompatible pointer type
make[1]: *** [util-linux/swaponoff.o] Error 1

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-12-18 19:02:31 +01:00
Mike Frysinger
e0942acb9e blkid: add bcache support
URL: https://bugs.gentoo.org/508596
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2015-12-16 14:42:25 -05:00
Mike Frysinger
5f11ec3f6a swapon/swapoff: refine the -e (ifexists) option
The -e option should only apply to swapon, and it should swallow all
errors/warnings when the device does not exist.  So delete the flag
from the swapoff patch and unify the check in the swapoff path.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2015-12-16 12:59:08 -05:00
Denys Vlasenko
f2ccefb946 setarch: add support for '-R' (disable randomization)
This commit adds support for the -R flag of setarch, which disables
randomization of the virtual address space.

function                                             old     new   delta
setarch_main                                         115     150     +35
packed_usage                                       30664   30651     -13

Signed-off-by: Jan Heylen <heyleke@gmail.com>
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-19 23:26:50 +02:00
Denys Vlasenko
526d85831e libbb: get_uidgid() always called with allow_numeric=1
function                                             old     new   delta
xget_uidgid                                           30      25      -5
make_device                                         2188    2183      -5
main                                                 797     792      -5
get_uidgid                                           240     225     -15

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-19 04:27:17 +02:00
Denys Vlasenko
ab3964db4e libbb: introduce kernel-style BUILD_BUG_ON()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-13 14:50:20 +02:00
Denys Vlasenko
bf74fb4497 typo fix in comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-13 12:34:35 +02:00
Denys Vlasenko
7f3a2a2256 join some common strings, -400 bytes
function                                             old     new   delta
print_intel_cstates                                  499     511     +12
file_insert                                          355     364      +9
dpkg_main                                           2944    2940      -4
ifenslave_main                                       645     640      -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 21/-9)              Total: 12 bytes
   text	   data	    bss	    dec	    hex	filename
 937564	    932	  17676	 956172	  e970c	busybox_old
 937164	    932	  17676	 955772	  e957c	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-08 11:24:44 +02:00