mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-09 14:35:25 +00:00
virDomainHostdevSubsysUSBDefParseXML: Use virXMLProp*
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
parent
e9c1e68d1f
commit
793e71ee76
@ -6694,28 +6694,23 @@ virDomainHostdevSubsysUSBDefParseXML(xmlNodePtr node,
|
|||||||
virDomainHostdevDef *def)
|
virDomainHostdevDef *def)
|
||||||
{
|
{
|
||||||
virDomainHostdevSubsysUSB *usbsrc = &def->source.subsys.u.usb;
|
virDomainHostdevSubsysUSB *usbsrc = &def->source.subsys.u.usb;
|
||||||
g_autofree char *startupPolicy = NULL;
|
|
||||||
g_autofree char *autoAddress = NULL;
|
|
||||||
xmlNodePtr vendorNode;
|
xmlNodePtr vendorNode;
|
||||||
xmlNodePtr productNode;
|
xmlNodePtr productNode;
|
||||||
xmlNodePtr addressNode;
|
xmlNodePtr addressNode;
|
||||||
|
virTristateBool autoAddress;
|
||||||
VIR_XPATH_NODE_AUTORESTORE(ctxt)
|
VIR_XPATH_NODE_AUTORESTORE(ctxt)
|
||||||
|
|
||||||
ctxt->node = node;
|
ctxt->node = node;
|
||||||
|
|
||||||
if ((startupPolicy = virXMLPropString(node, "startupPolicy"))) {
|
if (virXMLPropEnum(node, "startupPolicy",
|
||||||
int value = virDomainStartupPolicyTypeFromString(startupPolicy);
|
virDomainStartupPolicyTypeFromString,
|
||||||
if (value <= 0) {
|
VIR_XML_PROP_NONZERO, &def->startupPolicy) < 0)
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
return -1;
|
||||||
_("Unknown startup policy '%s'"),
|
|
||||||
startupPolicy);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
def->startupPolicy = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((autoAddress = virXMLPropString(node, "autoAddress")))
|
if (virXMLPropTristateBool(node, "autoAddress", VIR_XML_PROP_NONE,
|
||||||
ignore_value(virStringParseYesNo(autoAddress, &usbsrc->autoAddress));
|
&autoAddress) < 0)
|
||||||
|
return -1;
|
||||||
|
usbsrc->autoAddress = autoAddress == VIR_TRISTATE_BOOL_YES;
|
||||||
|
|
||||||
/* Product can validly be 0, so we need some extra help to determine
|
/* Product can validly be 0, so we need some extra help to determine
|
||||||
* if it is uninitialized */
|
* if it is uninitialized */
|
||||||
|
Loading…
Reference in New Issue
Block a user