提交 dee01fc5 编写于 作者: P Pavel Hrdina

conf: use virXMLPropString for IOMMU def parsing

XPath is good for random search of elements, not for accessing
attributes of one node.
Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
上级 58bf9d1d
...@@ -14429,6 +14429,7 @@ virDomainIOMMUDefParseXML(xmlNodePtr node, ...@@ -14429,6 +14429,7 @@ virDomainIOMMUDefParseXML(xmlNodePtr node,
{ {
virDomainIOMMUDefPtr iommu = NULL, ret = NULL; virDomainIOMMUDefPtr iommu = NULL, ret = NULL;
xmlNodePtr save = ctxt->node; xmlNodePtr save = ctxt->node;
xmlNodePtr driver;
char *tmp = NULL; char *tmp = NULL;
int val; int val;
...@@ -14450,39 +14451,41 @@ virDomainIOMMUDefParseXML(xmlNodePtr node, ...@@ -14450,39 +14451,41 @@ virDomainIOMMUDefParseXML(xmlNodePtr node,
iommu->model = val; iommu->model = val;
VIR_FREE(tmp); if ((driver = virXPathNode("./driver", ctxt))) {
if ((tmp = virXPathString("string(./driver/@intremap)", ctxt))) { VIR_FREE(tmp);
if ((val = virTristateSwitchTypeFromString(tmp)) < 0) { if ((tmp = virXMLPropString(driver, "intremap"))) {
virReportError(VIR_ERR_XML_ERROR, _("unknown intremap value: %s"), tmp); if ((val = virTristateSwitchTypeFromString(tmp)) < 0) {
goto cleanup; virReportError(VIR_ERR_XML_ERROR, _("unknown intremap value: %s"), tmp);
goto cleanup;
}
iommu->intremap = val;
} }
iommu->intremap = val;
}
VIR_FREE(tmp); VIR_FREE(tmp);
if ((tmp = virXPathString("string(./driver/@caching_mode)", ctxt))) { if ((tmp = virXMLPropString(driver, "caching_mode"))) {
if ((val = virTristateSwitchTypeFromString(tmp)) < 0) { if ((val = virTristateSwitchTypeFromString(tmp)) < 0) {
virReportError(VIR_ERR_XML_ERROR, _("unknown caching_mode value: %s"), tmp); virReportError(VIR_ERR_XML_ERROR, _("unknown caching_mode value: %s"), tmp);
goto cleanup; goto cleanup;
}
iommu->caching_mode = val;
} }
iommu->caching_mode = val; VIR_FREE(tmp);
} if ((tmp = virXMLPropString(driver, "iotlb"))) {
VIR_FREE(tmp); if ((val = virTristateSwitchTypeFromString(tmp)) < 0) {
if ((tmp = virXPathString("string(./driver/@iotlb)", ctxt))) { virReportError(VIR_ERR_XML_ERROR, _("unknown iotlb value: %s"), tmp);
if ((val = virTristateSwitchTypeFromString(tmp)) < 0) { goto cleanup;
virReportError(VIR_ERR_XML_ERROR, _("unknown iotlb value: %s"), tmp); }
goto cleanup; iommu->iotlb = val;
} }
iommu->iotlb = val;
}
VIR_FREE(tmp); VIR_FREE(tmp);
if ((tmp = virXPathString("string(./driver/@eim)", ctxt))) { if ((tmp = virXMLPropString(driver, "eim"))) {
if ((val = virTristateSwitchTypeFromString(tmp)) < 0) { if ((val = virTristateSwitchTypeFromString(tmp)) < 0) {
virReportError(VIR_ERR_XML_ERROR, _("unknown eim value: %s"), tmp); virReportError(VIR_ERR_XML_ERROR, _("unknown eim value: %s"), tmp);
goto cleanup; goto cleanup;
}
iommu->eim = val;
} }
iommu->eim = val;
} }
ret = iommu; ret = iommu;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册