Make adding subelements easier. --- src/conf/domain_conf.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ffc6a68..1245fdd 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -23842,6 +23842,15 @@ virDomainDefIothreadShouldFormat(virDomainDefPtr def) } +static void +virDomainIOMMUDefFormat(virBufferPtr buf, + virDomainIOMMUDefPtr iommu) +{ + virBufferAsprintf(buf, "<iommu model='%s'/>\n", + virDomainIOMMUModelTypeToString(iommu->model)); +} + + /* This internal version appends to an existing buffer * (possibly with auto-indent), rather than flattening * to string. @@ -24595,10 +24604,8 @@ virDomainDefFormatInternal(virDomainDefPtr def, goto error; } - if (def->iommu) { - virBufferAsprintf(buf, "<iommu model='%s'/>\n", - virDomainIOMMUModelTypeToString(def->iommu->model)); - } + if (def->iommu) + virDomainIOMMUDefFormat(buf, def->iommu); virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "</devices>\n"); -- 2.10.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list