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>
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>
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>
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>
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>
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>
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.
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.)
The following usage from original user:
$ ./busybox swapon -a
Have typo problem:
swapon: swapon: Operation not permitted
But regular version:
swapon: /dev/hda5: Operation not permitted
Patch attached, reduced 9 bytes and advanced
exit code also.