mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 22:55:23 +00:00
conf: use virXMLFormatElement for <iommu>
Simplify the formatting function even further.
This commit is contained in:
parent
e844b6e12c
commit
73c336eb46
@ -25073,6 +25073,7 @@ virDomainIOMMUDefFormat(virBufferPtr buf,
|
|||||||
const virDomainIOMMUDef *iommu)
|
const virDomainIOMMUDef *iommu)
|
||||||
{
|
{
|
||||||
virBuffer childBuf = VIR_BUFFER_INITIALIZER;
|
virBuffer childBuf = VIR_BUFFER_INITIALIZER;
|
||||||
|
virBuffer attrBuf = VIR_BUFFER_INITIALIZER;
|
||||||
virBuffer driverAttrBuf = VIR_BUFFER_INITIALIZER;
|
virBuffer driverAttrBuf = VIR_BUFFER_INITIALIZER;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
@ -25098,16 +25099,11 @@ virDomainIOMMUDefFormat(virBufferPtr buf,
|
|||||||
if (virXMLFormatElement(&childBuf, "driver", &driverAttrBuf, NULL) < 0)
|
if (virXMLFormatElement(&childBuf, "driver", &driverAttrBuf, NULL) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
virBufferAsprintf(buf, "<iommu model='%s'",
|
virBufferAsprintf(&attrBuf, " model='%s'",
|
||||||
virDomainIOMMUModelTypeToString(iommu->model));
|
virDomainIOMMUModelTypeToString(iommu->model));
|
||||||
|
|
||||||
if (virBufferError(&childBuf) != 0 || virBufferUse(&childBuf)) {
|
if (virXMLFormatElement(buf, "iommu", &attrBuf, &childBuf) < 0)
|
||||||
virBufferAddLit(buf, ">\n");
|
goto cleanup;
|
||||||
virBufferAddBuffer(buf, &childBuf);
|
|
||||||
virBufferAddLit(buf, "</iommu>\n");
|
|
||||||
} else {
|
|
||||||
virBufferAddLit(buf, "/>\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user