Commit Graph

90 Commits

Author SHA1 Message Date
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
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
8cae43c5d7 swapon: do not use FEATURE_MOUNT_LABEL, have your own FEATURE_SWAPONOFF_LABEL
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-27 10:58:08 +02: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
61f9d76ec5 swapon/swapoff: trim config help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-19 14:39:30 +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
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
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
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
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
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
René Rhéaume
e76957708b swaponoff: add support for -e
Signed-off-by: René Rhéaume <rene.rheaume@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-05 20:35:00 +01:00
Tito Ragusa
c9a67133d6 swapon/swapoff: -a returns 0 on ignored errors
Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-01 09:51:27 +02:00
Tito Ragusa
a3f326cd66 swapon/swapoff: size reduction, cleanup, fixes, improvements
1) real swapon/swapoff handles also devices on the commandline with -a;
2) xstat(device)  in  swap_enable_disable aborts on error when cycling through
   fstab so some devices  are not handled;
3) duplicated code for ENABLE_FEATURE_SWAPON_DISCARD and
   ENABLE_FEATURE_SWAPON_PRI was moved to functions.
4) silence some error messages with -a;
5) minor cleanups and code refactoring reduced the size as per bloat-check:
6) I also added support for /proc/swaps handling to swapoff:
"When the -a flag is given, swapping is disabled on all known  swap  devices
 and  files  (as  found  in  /proc/swaps  or /etc/fstab)."
So now swapoff first cycles through  /proc/swaps and then through fstab
to swapoff all devices.

function                                             old     new   delta
set_discard_flag                                       -     106    +106
swap_enable_disable                                  147     238     +91
set_priority_flag                                      -      79     +79
retrieve_file_data                                   470     467      -3
swap_on_off_main                                     638     418    -220
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 1/2 up/down: 276/-223)           Total: 53 bytes

Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-31 16:39:26 +02:00
Matt Whitlock
0a53b203f9 add discard option -d to swapon
Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-23 18:36:23 +01:00
Matt Whitlock
b9bbd4ddf6 fix interaction of -a and -p options in swapon
Swap entries in /etc/fstab inherit the priority specified on the command line unless they have 'pri' in their mount options.

Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-23 18:36:22 +01:00
Matt Whitlock
c3a27b0bfd avoid calling bb_strtou twice in MIN macro expansion
Also, the maximum allowable value of swap priority is technically SWAP_FLAG_PRIO_MASK >> SWAP_FLAG_PRIO_SHIFT.

Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-23 18:36:22 +01:00
Denys Vlasenko
087843a65b fix "warning: ISO C90 forbids mixed declarations and code"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-12 11:16:30 +01:00
Bernhard Reutner-Fischer
b541d1fcbd swaponoff: shrink
function                                             old     new   delta
.rodata                                           148469  148468      -1
swap_on_off_main                                     381     379      -2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-3)               Total: -3 bytes
   text	   data	    bss	    dec	    hex	filename
 803030	   4090	   9504	 816624	  c75f0	busybox_old
 803027	   4090	   9504	 816621	  c75ed	busybox_unstripped
2013-11-08 09:05:25 +01:00
Tito Ragusa
8c7fcbd752 swapon: support "pri=NNN" in fstab
function                                             old     new   delta
swap_on_off_main                                     244     365    +121

Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-08 10:21:27 +02:00
Denys Vlasenko
a241069004 remove duplicate include <sys/swap.h>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-22 06:39:00 +02:00
Denys Vlasenko
16714245f9 add INIT_G()'s. No code changes.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-21 01:59:15 +02:00
Denys Vlasenko
c21c310e46 swapoff: dont pass "p" in opt_complementary
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-08-13 23:36:36 +02:00
Denys Vlasenko
14bd16ac56 more tweak for bionic
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-08 08:49:40 +02:00
Denys Vlasenko
66426760be *: remove "Options:" string from help texts
function                                             old     new   delta
packed_usage                                       28706   28623     -83

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-05 03:58:28 +02: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
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
Lauri Kasanen
d2844fcb68 swapon: skip noauto entries
Signed-off-by: Lauri Kasanen <curaga@operamail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-29 22:20:57 +02:00
Denys Vlasenko
98a4c7cf3d *: suppress ~60% of "aliased warnings" on gcc-4.4.1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-04 15:00:15 +01:00
Natanael Copa
9aff29997e swaponoff: add uuid/label support. By Natanael Copa
function                                             old     new   delta
swap_enable_disable                                  130     150     +20
resolve_mount_spec                                    76      96     +20
mount_main                                          1152    1154      +2
findfs_main                                          125      80     -45
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/1 up/down: 42/-45)             Total: -3 bytes

Signed-off-by: Natanael Copa <natanael.copa@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-20 04:28:22 +02:00
Denis Vlasenko
a60f84ebf0 *: rename ATTRIBUTE_XXX to just XXX. 2008-07-05 09:18:54 +00:00
Denis Vlasenko
ee56e013cf swapon: optional -p PRIO support (by Francois Barel <frabar666 AT gmail.com>)
function                                             old     new   delta
swap_on_off_main                                     153     216     +63
packed_usage                                       24190   24214     +24
swap_enable_disable                                  127     131      +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 91/0)               Total: 91 bytes
2008-05-18 23:05:34 +00:00
Denis Vlasenko
1d42665b6b *: shrink: use Vladimir's "o+" specifier instead of xatou(opt_param)
function                                             old     new   delta
getopt32                                            1370    1385     +15
sulogin_main                                         490     494      +4
realpath_main                                         84      86      +2
sleep_main                                            76      77      +1
mt_main                                              256     257      +1
printenv_main                                         75      74      -1
fdformat_main                                        546     545      -1
usleep_main                                           44      42      -2
setlogcons_main                                       77      75      -2
ed_main                                             2654    2649      -5
deallocvt_main                                        69      64      -5
addgroup_main                                        373     368      -5
mkfs_minix_main                                     2989    2982      -7
tail_main                                           1221    1213      -8
sv_main                                             1254    1241     -13
du_main                                              348     328     -20
tftp_main                                            325     302     -23
split_main                                           581     558     -23
nc_main                                             1000     977     -23
diff_main                                            891     868     -23
arping_main                                         1797    1770     -27
ls_main                                              893     847     -46
od_main                                             2797    2750     -47
readprofile_main                                    1944    1895     -49
tcpudpsvd_main                                      1973    1922     -51
udhcpc_main                                         2590    2513     -77
grep_main                                            824     722    -102
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/22 up/down: 23/-560)         Total: -537 bytes
   text    data     bss     dec     hex filename
 796973     658    7428  805059   c48c3 busybox_old
 796479     662    7420  804561   c46d1 busybox_unstripped
2008-03-17 09:09:09 +00:00
Denis Vlasenko
f8b21d0933 swaponoff: prevent arithmetic overflow (spotted by Paul Fox <pgf@brightstareng.com>) 2007-11-05 19:33:38 +00:00
Denis Vlasenko
9b49a5ed85 add -fvisibility=hidden to CC flags, mark XXX_main functions
EXTERNALLY_VISIBLE. 5% size reduction of libbusybox.so
2007-10-11 10:05:36 +00:00
Denis Vlasenko
0c97c9d437 'simple' error message functions by Loic Grenie <loic.grenie@gmail.com>.
263 bytes saved.
2007-10-01 11:58:38 +00:00
Denis Vlasenko
fe7cd642b0 don't pass argc in getopt32, it's superfluous
(add/remove: 0/0 grow/shrink: 12/131 up/down: 91/-727) Total: -636 bytes
   text    data     bss     dec     hex filename
 773469    1058   11092  785619   bfcd3 busybox_old
 772644    1058   11092  784794   bf99a busybox_unstripped
2007-08-18 15:32:12 +00:00
Denis Vlasenko
b6adbf1be2 usage.c: remove reference to busybox.h
*: s/include "busybox.h"/include "libbb.h"
2007-05-26 19:00:18 +00:00
Denis Vlasenko
5659407595 swapon: reinstate hole check but reduce it to warning
inode_hash: remove unused variable
2007-03-14 22:55:39 +00:00
Denis Vlasenko
b3f09f4a50 swapon: random shrinkage 2007-03-12 18:16:24 +00:00
Denis Vlasenko
06af216528 suppress warnings about easch <applet>_main() having
no preceding prototype
2007-02-03 17:28:39 +00:00
Denis Vlasenko
8f8f268cfd bb_applet_name -> applet_name 2006-10-03 21:00:43 +00:00
Denis Vlasenko
67b23e6043 getopt_ulflags -> getopt32.
It is impossible to formulate sane ABI based on
size of ulong because it can be 32-bit or 64-bit.
Basically it means that you cannot portably use
more that 32 option chars in one call anyway...
Make it explicit.
2006-10-03 21:00:06 +00:00
Rob Landley
e9a7a6212b Change license statements (and clean up headers) on some of the files that
Erik or I are primary copyright holders on.
2006-09-22 02:52:41 +00:00
Bernhard Reutner-Fischer
7fee0c4357 - fix copy'n paste errors that got introduced when switching to the shorter boilerplate.
No object code changes.
2006-09-13 16:39:19 +00:00
Rob Landley
20cc6d567f Remove pointless "const". Bloatcheck says 0 bytes difference. 2006-09-12 21:42:17 +00:00
Rob Landley
22d26fc6ae Patch from Yann Morin to put BLKGETSIZE64 in platform.h had rather a lot of
fallout due to the #include <sys/mount.h>.  Removed that #include from various
applets and fixed up those that were unhappy when that #include was made
because they'd block copied stuff out of it.  (Sigh.)
2006-06-15 15:49:36 +00:00
Rob Landley
c5b1d4d6b1 Patch from Denis Vlasenko to add xstat() and use it. 2006-03-13 15:45:16 +00:00