return;
/* Interpret the parameter for use within Xen. */
- if ( !parse_bool(arg) )
+ if ( !parse_bool(arg, NULL) )
param_acpi_off = true;
else if ( !strcmp(arg, "force") ) /* force ACPI to be enabled */
param_acpi_force = true;
{
char *sep, *p = s;
- switch ( parse_bool(s) )
+ switch ( parse_bool(s, NULL) )
{
case 0:
break;
if ( !*s )
opt_mmio_relax = 1;
else
- opt_mmio_relax = parse_bool(s);
+ opt_mmio_relax = parse_bool(s, NULL);
if ( opt_mmio_relax < 0 && strcmp(s, "all") )
opt_mmio_relax = 0;
}
return;
}
- switch ( parse_bool(s) )
+ switch ( parse_bool(s, NULL) )
{
case 0:
opt_watchdog = false;
opt_psr |= mask;
else
{
- int val_int = parse_bool(value);
+ int val_int = parse_bool(value, NULL);
if ( val_int == 0 )
opt_psr &= ~mask;
return;
}
- switch ( parse_bool(s) )
+ switch ( parse_bool(s, NULL) )
{
case 0:
opt_smep = 0;
return;
}
- switch ( parse_bool(s) )
+ switch ( parse_bool(s, NULL) )
{
case 0:
opt_smap = 0;
safe_strcpy(acpi_param, s);
/* Interpret the parameter for use within Xen. */
- if ( !parse_bool(s) )
+ if ( !parse_bool(s, NULL) )
{
disable_acpi();
}
if ( ss )
*ss = '\0';
- if ( !parse_bool(s) )
+ if ( !parse_bool(s, NULL) )
pci_probe &= ~PCI_PROBE_MMCONF;
else if ( !strcmp(s, "amd_fam10") || !strcmp(s, "amd-fam10") )
pci_probe |= PCI_CHECK_ENABLE_AMD_MMCONF;
simple_strtoll(optval, NULL, 0));
break;
case OPT_BOOL:
- if ( !parse_bool(optval) )
+ if ( !parse_bool(optval, NULL) )
bool_assert = !bool_assert;
assign_integer_param(param, bool_assert);
break;
#endif
}
-int __init parse_bool(const char *s)
+int __init parse_bool(const char *s, const char *e)
{
- if ( !strcmp("no", s) ||
- !strcmp("off", s) ||
- !strcmp("false", s) ||
- !strcmp("disable", s) ||
- !strcmp("0", s) )
+ unsigned int len;
+
+ len = e ? ({ ASSERT(e >= s); e - s; }) : strlen(s);
+
+ if ( !strncmp("no", s, len) ||
+ !strncmp("off", s, len) ||
+ !strncmp("false", s, len) ||
+ !strncmp("disable", s, len) ||
+ !strncmp("0", s, len) )
return 0;
- if ( !strcmp("yes", s) ||
- !strcmp("on", s) ||
- !strcmp("true", s) ||
- !strcmp("enable", s) ||
- !strcmp("1", s) )
+ if ( !strncmp("yes", s, len) ||
+ !strncmp("on", s, len) ||
+ !strncmp("true", s, len) ||
+ !strncmp("enable", s, len) ||
+ !strncmp("1", s, len) )
return 1;
return -1;
static void __init parse_console_timestamps(char *s)
{
- switch ( parse_bool(s) )
+ switch ( parse_bool(s, NULL) )
{
case 0:
opt_con_timestamp_mode = TSM_NONE;
if ( arg )
*arg++ = '\0';
- choice = parse_bool(str);
+ choice = parse_bool(str, NULL);
if ( choice < 0 && !strcmp(str, "dom0-kernel") )
{
if ( ss )
*ss = '\0';
- if ( !parse_bool(s) )
+ if ( !parse_bool(s, NULL) )
iommu_enable = 0;
else if ( !strcmp(s, "force") || !strcmp(s, "required") )
force_iommu = val;
{
int t;
- t = parse_bool(s);
+ t = parse_bool(s, NULL);
if ( t < 0 )
{
if ( *s == '\0' )
struct domain;
void cmdline_parse(const char *cmdline);
-int parse_bool(const char *s);
+int parse_bool(const char *s, const char *e);
/*#define DEBUG_TRACE_DUMP*/
#ifdef DEBUG_TRACE_DUMP