comparison toys/swapon.c @ 483:26db0cd433f3

Minor tweaks.
author Rob Landley <rob@landley.net>
date Sun, 19 Feb 2012 17:37:49 -0600
parents b4a9fd8773d6
children
comparison
equal deleted inserted replaced
482:b4a9fd8773d6 483:26db0cd433f3
10 10
11 config SWAPON 11 config SWAPON
12 bool "swapon" 12 bool "swapon"
13 default y 13 default y
14 help 14 help
15 usage: swapon swapregion 15 usage: swapon [-p priority] filename
16 16
17 Enable swapping on a given swapregion. 17 Enable swapping on a given device/file.
18 */ 18 */
19 19
20 #include "toys.h" 20 #include "toys.h"
21 21
22 DEFINE_GLOBALS( 22 DEFINE_GLOBALS(
28 void swapon_main(void) 28 void swapon_main(void)
29 { 29 {
30 int flags = 0; 30 int flags = 0;
31 31
32 if (toys.optflags & 1) 32 if (toys.optflags & 1)
33 flags = SWAP_FLAG_PREFER | 33 flags = SWAP_FLAG_PREFER | (TT.priority << SWAP_FLAG_PRIO_SHIFT);
34 ((TT.priority & SWAP_FLAG_PRIO_MASK) << SWAP_FLAG_PRIO_SHIFT);
35 34
36 if (swapon(toys.optargs[0], flags)) 35 if (swapon(*toys.optargs, flags))
37 perror_exit("failed to enable swaparea"); 36 perror_exit("Couldn't swapon '%s'", *toys.optargs);
38 } 37 }