mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 14:15:28 +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)
|
||||
{
|
||||
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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user