direct-io.hg

changeset 15510:5e8eb0cf2daf

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>
author kfraser@localhost.localdomain
date Mon Jul 09 14:29:53 2007 +0100 (2007-07-09)
parents 646ec1f2b41f
children 83fd4ad219cd
files xen/common/kernel.c xen/include/xen/init.h
line diff
     1.1 --- a/xen/common/kernel.c	Mon Jul 09 14:13:56 2007 +0100
     1.2 +++ b/xen/common/kernel.c	Mon Jul 09 14:29:53 2007 +0100
     1.3 @@ -29,7 +29,7 @@ void cmdline_parse(char *cmdline)
     1.4      char opt[100], *optval, *optkey, *q;
     1.5      const char *p = cmdline;
     1.6      struct kernel_param *param;
     1.7 -    int invbool;
     1.8 +    int bool_assert;
     1.9  
    1.10      if ( p == NULL )
    1.11          return;
    1.12 @@ -66,8 +66,8 @@ void cmdline_parse(char *cmdline)
    1.13              optval = q;       /* default option value is empty string */
    1.14  
    1.15          /* Boolean parameters can be inverted with 'no-' prefix. */
    1.16 -        invbool = !strncmp("no-", optkey, 3);
    1.17 -        if ( invbool )
    1.18 +        bool_assert = !!strncmp("no-", optkey, 3);
    1.19 +        if ( !bool_assert )
    1.20              optkey += 3;
    1.21  
    1.22          for ( param = &__setup_start; param <= &__setup_end; param++ )
    1.23 @@ -85,10 +85,12 @@ void cmdline_parse(char *cmdline)
    1.24                      simple_strtol(optval, (const char **)&optval, 0);
    1.25                  break;
    1.26              case OPT_BOOL:
    1.27 -                *(int *)param->var = !invbool;
    1.28 -                break;
    1.29              case OPT_INVBOOL:
    1.30 -                *(int *)param->var = invbool;
    1.31 +                if ( !strcmp("no", optval) || !strcmp("off", optval) )
    1.32 +                    bool_assert = !bool_assert;
    1.33 +                if ( param->type == OPT_INVBOOL )
    1.34 +                    bool_assert = !bool_assert;
    1.35 +                *(int *)param->var = bool_assert;
    1.36                  break;
    1.37              case OPT_CUSTOM:
    1.38                  ((void (*)(const char *))param->var)(optval);
     2.1 --- a/xen/include/xen/init.h	Mon Jul 09 14:13:56 2007 +0100
     2.2 +++ b/xen/include/xen/init.h	Mon Jul 09 14:29:53 2007 +0100
     2.3 @@ -93,7 +93,7 @@ extern struct kernel_param __setup_start
     2.4      static char __setup_str_##_var[] __initdata = _name; \
     2.5      static struct kernel_param __setup_##_var __attribute_used__ \
     2.6          __initsetup = { __setup_str_##_var, OPT_BOOL, &_var, sizeof(_var) }
     2.7 -#define invboolean_param(_name, _var) \
     2.8 +#define invbool_param(_name, _var) \
     2.9      static char __setup_str_##_var[] __initdata = _name; \
    2.10      static struct kernel_param __setup_##_var __attribute_used__ \
    2.11          __initsetup = { __setup_str_##_var, OPT_INVBOOL, &_var, sizeof(_var) }