diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 7044701fac..734fa584a4 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6704,14 +6704,14 @@ virDomainHostdevSubsysUSBDefParseXML(xmlNodePtr node, ctxt->node = node; if ((startupPolicy = virXMLPropString(node, "startupPolicy"))) { - def->startupPolicy = - virDomainStartupPolicyTypeFromString(startupPolicy); - if (def->startupPolicy <= 0) { + int value = virDomainStartupPolicyTypeFromString(startupPolicy); + if (value <= 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Unknown startup policy '%s'"), startupPolicy); return -1; } + def->startupPolicy = value; } if ((autoAddress = virXMLPropString(node, "autoAddress"))) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 2d5462bb55..41e570765e 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -332,6 +332,15 @@ struct _virDomainHostdevCaps { }; +typedef enum { + VIR_DOMAIN_STARTUP_POLICY_DEFAULT = 0, + VIR_DOMAIN_STARTUP_POLICY_MANDATORY, + VIR_DOMAIN_STARTUP_POLICY_REQUISITE, + VIR_DOMAIN_STARTUP_POLICY_OPTIONAL, + + VIR_DOMAIN_STARTUP_POLICY_LAST +} virDomainStartupPolicy; + /* basic device for direct passthrough */ struct _virDomainHostdevDef { /* If 'parentnet' is non-NULL it means this host dev was @@ -343,7 +352,7 @@ struct _virDomainHostdevDef { virDomainNetDef *parentnet; int mode; /* enum virDomainHostdevMode */ - int startupPolicy; /* enum virDomainStartupPolicy */ + virDomainStartupPolicy startupPolicy; bool managed; bool missing; bool readonly; @@ -432,16 +441,6 @@ typedef enum { VIR_DOMAIN_DISK_IO_LAST } virDomainDiskIo; -typedef enum { - VIR_DOMAIN_STARTUP_POLICY_DEFAULT = 0, - VIR_DOMAIN_STARTUP_POLICY_MANDATORY, - VIR_DOMAIN_STARTUP_POLICY_REQUISITE, - VIR_DOMAIN_STARTUP_POLICY_OPTIONAL, - - VIR_DOMAIN_STARTUP_POLICY_LAST -} virDomainStartupPolicy; - - typedef enum { VIR_DOMAIN_DEVICE_SGIO_DEFAULT = 0, VIR_DOMAIN_DEVICE_SGIO_FILTERED,