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
..
2014-03-23 18:36:23 +01:00
2013-01-05 21:02:14 -05:00
2013-02-11 00:22:59 +01:00
2013-01-14 01:34:48 +01:00
2013-01-14 01:34:48 +01:00
2013-01-14 01:34:48 +01:00
2013-06-27 03:45:16 +02:00
2013-01-14 01:34:48 +01:00
2014-03-05 18:58:15 +01:00
2013-01-22 11:00:45 +01:00
2012-06-11 14:57:29 +02:00
2011-12-15 12:39:25 +01:00