busybox/util-linux
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
..
volume_id fix assorted unused code and wrong format specs found by cppchekc (bug 6716) 2013-11-29 16:43:33 +01:00
acpid.c CONFIG_PID_FILE_PATH: new configuration option for pidfile paths 2012-12-19 15:53:33 -05:00
blkid.c blkid: if parameters are given, do not scan /dev 2012-03-03 15:09:07 +01:00
blockdev.c *: remove "Options:" string from help texts 2011-06-05 03:58:28 +02:00
Config.src add discard option -d to swapon 2014-03-23 18:36:23 +01:00
dmesg.c dmesg: handle multi-char log levels 2013-01-05 21:02:14 -05:00
fbset.c fbset: respect rgba configuration lines in fb.modes 2012-07-07 19:58:15 +02:00
fdformat.c Use unsigned printf/scanf conversion where more appropriate 2013-11-29 16:45:45 +01:00
fdisk_aix.c *: make GNU licensing statement forms more regular 2010-08-16 20:14:46 +02:00
fdisk_gpt.c Make smart_ulltoa return pointer to end (allows for code shink in callers) 2013-09-06 12:53:14 +02:00
fdisk_osf.c whitespace cleanup. no code changes 2013-01-14 15:57:44 +01:00
fdisk_sgi.c *: make GNU licensing statement forms more regular 2010-08-16 20:14:46 +02:00
fdisk_sun.c fdisk_sun: fix partition alignment 2013-02-11 00:22:59 +01:00
fdisk.c whitespace fixes. no code changes 2013-01-14 01:34:48 +01:00
findfs.c move remaining help text from include/usage.src.h 2011-04-11 03:29:49 +02:00
flock.c whitespace fixes. no code changes 2013-01-14 01:34:48 +01:00
freeramdisk.c move remaining help text from include/usage.src.h 2011-04-11 03:29:49 +02:00
fsck_minix.c Use unsigned printf/scanf conversion where more appropriate 2013-11-29 16:45:45 +01:00
fstrim.c fstrim: use new-style config/kbuild/applet snippets; trim help text 2013-11-12 12:09:14 +01:00
getopt.c getopt: improve help text; code shrink 2013-01-24 11:36:00 +01:00
hexdump.c Commonalize typical [b,]k,m suffix struct 2013-07-13 23:49:45 +02:00
hwclock.c hwclock: fix setting of tz_minuteswest. Closes 5414 2014-02-25 17:52:10 +01:00
ipcrm.c whitespace fixes. no code changes 2013-01-14 01:34:48 +01:00
ipcs.c Use unsigned printf/scanf conversion where more appropriate 2013-11-29 16:45:45 +01:00
Kbuild.src fstrim: use new-style config/kbuild/applet snippets; trim help text 2013-11-12 12:09:14 +01:00
losetup.c losetup: assorted fixes. Closes 6314 2013-06-27 03:45:16 +02:00
lspci.c whitespace fixes. no code changes 2013-01-14 01:34:48 +01:00
lsusb.c move remaining help text from include/usage.src.h 2011-04-11 03:29:49 +02:00
mdev.c mdev: use $DEVNAME in uevent sysfs file for device node name 2013-05-13 03:55:11 +02:00
minix.h *: more portability fixes by Dan Fandrich 2009-09-23 23:15:43 +02:00
mkfs_ext2_test.sh mkfs_ext2: use compatible inode sizes; add -I <inodesize>. (by Vladimir) 2009-10-22 12:12:17 +02:00
mkfs_ext2.c mount: fix the wrongly stored fs creation time 2012-06-21 16:50:46 +02:00
mkfs_ext2.txt mkfs_ext2: use compatible inode sizes; add -I <inodesize>. (by Vladimir) 2009-10-22 12:12:17 +02:00
mkfs_minix.c Use unsigned printf/scanf conversion where more appropriate 2013-11-29 16:45:45 +01:00
mkfs_reiser.c use [s]rand(), not [s]random() 2014-03-05 18:58:15 +01:00
mkfs_vfat.c *: remove "Options:" string from help texts 2011-06-05 03:58:28 +02:00
mkswap.c *: remove "Options:" string from help texts 2011-06-05 03:58:28 +02:00
more.c *: better comments on termios manipulations. No code changes. 2012-01-15 23:00:13 +01:00
mount.c mount: whitespace fix. no code changes 2013-01-22 11:00:45 +01:00
pivot_root.c move remaining help text from include/usage.src.h 2011-04-11 03:29:49 +02:00
rdate.c rdate: code shrink 2012-06-11 14:57:29 +02:00
rdev.c *: style fixes. no code changes 2011-12-15 12:39:25 +01:00
readprofile.c Use unsigned printf/scanf conversion where more appropriate 2013-11-29 16:45:45 +01:00
rev.c mass removal of underscores from _BB_DIR_foo and _BB_SUID_foo 2011-01-18 13:58:01 +01:00
rtcwake.c move remaining help text from include/usage.src.h 2011-04-11 03:29:49 +02:00
script.c script: make it work even if fd 0 is closed 2014-03-16 12:34:53 +01:00
scriptreplay.c move remaining help text from include/usage.src.h 2011-04-11 03:29:49 +02:00
setarch.c move remaining help text from include/usage.src.h 2011-04-11 03:29:49 +02:00
swaponoff.c swapon/swapoff: size reduction, cleanup, fixes, improvements 2014-03-31 16:39:26 +02:00
switch_root.c libbb: make xchroot do a chdir("/") after chroot 2012-03-08 00:28:24 +01:00
umount.c umount: make -d always active, add -D to suppress it 2012-04-17 13:07:28 +02:00