aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/kernel.c
diff options
context:
space:
mode:
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-07-09 14:29:53 +0100
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-07-09 14:29:53 +0100
commit2fcb51bc7a4fcb7534265d7bb155c6ddf03952b8 (patch)
treeefefe6fbccfb30049b8609be53b6ff534418378a /xen/common/kernel.c
parentc2a2f409564ec042c0c982b2de469d65c41a8037 (diff)
downloadxen-2fcb51bc7a4fcb7534265d7bb155c6ddf03952b8.tar.gz
xen-2fcb51bc7a4fcb7534265d7bb155c6ddf03952b8.tar.bz2
xen-2fcb51bc7a4fcb7534265d7bb155c6ddf03952b8.zip
Also allow boolean cmdline params to be inverted in two other ways.
Now, a standard boolean (e.g., watchdog) can be inverted in three ways: 1. no-watchdog 2. watchdog=no 3. watchdog=off Stacked inversions cancel each other: no-watchdog=no turns on the watchdog. Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'xen/common/kernel.c')
-rw-r--r--xen/common/kernel.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index fea3224a76..0e675d3c4b 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -29,7 +29,7 @@ void cmdline_parse(char *cmdline)
char opt[100], *optval, *optkey, *q;
const char *p = cmdline;
struct kernel_param *param;
- int invbool;
+ int bool_assert;
if ( p == NULL )
return;
@@ -66,8 +66,8 @@ void cmdline_parse(char *cmdline)
optval = q; /* default option value is empty string */
/* Boolean parameters can be inverted with 'no-' prefix. */
- invbool = !strncmp("no-", optkey, 3);
- if ( invbool )
+ bool_assert = !!strncmp("no-", optkey, 3);
+ if ( !bool_assert )
optkey += 3;
for ( param = &__setup_start; param <= &__setup_end; param++ )
@@ -85,10 +85,12 @@ void cmdline_parse(char *cmdline)
simple_strtol(optval, (const char **)&optval, 0);
break;
case OPT_BOOL:
- *(int *)param->var = !invbool;
- break;
case OPT_INVBOOL:
- *(int *)param->var = invbool;
+ if ( !strcmp("no", optval) || !strcmp("off", optval) )
+ bool_assert = !bool_assert;
+ if ( param->type == OPT_INVBOOL )
+ bool_assert = !bool_assert;
+ *(int *)param->var = bool_assert;
break;
case OPT_CUSTOM:
((void (*)(const char *))param->var)(optval);