提交 73c336eb 编写于 作者: J Ján Tomko

conf: use virXMLFormatElement for <iommu>

Simplify the formatting function even further.
上级 e844b6e1
......@@ -25073,6 +25073,7 @@ virDomainIOMMUDefFormat(virBufferPtr buf,
const virDomainIOMMUDef *iommu)
{
virBuffer childBuf = VIR_BUFFER_INITIALIZER;
virBuffer attrBuf = VIR_BUFFER_INITIALIZER;
virBuffer driverAttrBuf = VIR_BUFFER_INITIALIZER;
int ret = -1;
......@@ -25098,16 +25099,11 @@ virDomainIOMMUDefFormat(virBufferPtr buf,
if (virXMLFormatElement(&childBuf, "driver", &driverAttrBuf, NULL) < 0)
goto cleanup;
virBufferAsprintf(buf, "<iommu model='%s'",
virBufferAsprintf(&attrBuf, " model='%s'",
virDomainIOMMUModelTypeToString(iommu->model));
if (virBufferError(&childBuf) != 0 || virBufferUse(&childBuf)) {
virBufferAddLit(buf, ">\n");
virBufferAddBuffer(buf, &childBuf);
virBufferAddLit(buf, "</iommu>\n");
} else {
virBufferAddLit(buf, "/>\n");
}
if (virXMLFormatElement(buf, "iommu", &attrBuf, &childBuf) < 0)
goto cleanup;
ret = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册