[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] Also allow boolean cmdline params to be inverted in two other ways.
# HG changeset patch # User kfraser@xxxxxxxxxxxxxxxxxxxxx # Date 1183987793 -3600 # Node ID 5e8eb0cf2dafc5d0e990cbd5ba18342193f2f604 # Parent 646ec1f2b41f717646d6d9f6bfd4e7ea11c9fb74 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@xxxxxxxxxxxxx> --- xen/common/kernel.c | 14 ++++++++------ xen/include/xen/init.h | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff -r 646ec1f2b41f -r 5e8eb0cf2daf xen/common/kernel.c --- a/xen/common/kernel.c Mon Jul 09 14:13:56 2007 +0100 +++ b/xen/common/kernel.c Mon Jul 09 14:29:53 2007 +0100 @@ -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); diff -r 646ec1f2b41f -r 5e8eb0cf2daf xen/include/xen/init.h --- a/xen/include/xen/init.h Mon Jul 09 14:13:56 2007 +0100 +++ b/xen/include/xen/init.h Mon Jul 09 14:29:53 2007 +0100 @@ -93,7 +93,7 @@ extern struct kernel_param __setup_start static char __setup_str_##_var[] __initdata = _name; \ static struct kernel_param __setup_##_var __attribute_used__ \ __initsetup = { __setup_str_##_var, OPT_BOOL, &_var, sizeof(_var) } -#define invboolean_param(_name, _var) \ +#define invbool_param(_name, _var) \ static char __setup_str_##_var[] __initdata = _name; \ static struct kernel_param __setup_##_var __attribute_used__ \ __initsetup = { __setup_str_##_var, OPT_INVBOOL, &_var, sizeof(_var) } _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |