[libvirt] [PATCH 3/9] Split out virDomainIOMMUDefFormat

Ján Tomko jtomko at redhat.com
Thu Mar 23 15:26:15 UTC 2017


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




More information about the libvir-list mailing list