]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: domaincaps: Extract formatting of the <features> subelement
authorPeter Krempa <pkrempa@redhat.com>
Wed, 30 Oct 2019 13:58:40 +0000 (14:58 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 14 Nov 2019 14:50:43 +0000 (15:50 +0100)
Extract it to virDomainCapsFormatFeatures so that the main function does
not get so bloated over time.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/conf/domain_capabilities.c

index ec5bef55c64ead979fb68e37ed61bd8fa4bc3337..6fa2e71afbf6cca91c64a6ae792bb5c2c7543200 100644 (file)
@@ -593,6 +593,23 @@ virDomainCapsFeatureSEVFormat(virBufferPtr buf,
 }
 
 
+static void
+virDomainCapsFormatFeatures(const virDomainCaps *caps,
+                            virBufferPtr buf)
+{
+    virBufferAddLit(buf, "<features>\n");
+    virBufferAdjustIndent(buf, 2);
+
+    virDomainCapsFeatureGICFormat(buf, &caps->gic);
+    qemuDomainCapsFeatureFormatSimple(buf, "vmcoreinfo", caps->vmcoreinfo);
+    qemuDomainCapsFeatureFormatSimple(buf, "genid", caps->genid);
+    virDomainCapsFeatureSEVFormat(buf, caps->sev);
+
+    virBufferAdjustIndent(buf, -2);
+    virBufferAddLit(buf, "</features>\n");
+}
+
+
 char *
 virDomainCapsFormat(const virDomainCaps *caps)
 {
@@ -629,16 +646,7 @@ virDomainCapsFormat(const virDomainCaps *caps)
     virBufferAdjustIndent(&buf, -2);
     virBufferAddLit(&buf, "</devices>\n");
 
-    virBufferAddLit(&buf, "<features>\n");
-    virBufferAdjustIndent(&buf, 2);
-
-    virDomainCapsFeatureGICFormat(&buf, &caps->gic);
-    qemuDomainCapsFeatureFormatSimple(&buf, "vmcoreinfo", caps->vmcoreinfo);
-    qemuDomainCapsFeatureFormatSimple(&buf, "genid", caps->genid);
-    virDomainCapsFeatureSEVFormat(&buf, caps->sev);
-
-    virBufferAdjustIndent(&buf, -2);
-    virBufferAddLit(&buf, "</features>\n");
+    virDomainCapsFormatFeatures(caps, &buf);
 
     virBufferAdjustIndent(&buf, -2);
     virBufferAddLit(&buf, "</domainCapabilities>\n");