3e5111
From 8874ecd393f7098376d9c46c34f43d47a697f932 Mon Sep 17 00:00:00 2001
3e5111
Message-Id: <8874ecd393f7098376d9c46c34f43d47a697f932@dist-git>
3e5111
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
3e5111
Date: Fri, 9 Jun 2017 12:48:55 +0200
3e5111
Subject: [PATCH] conf: introduce virDomainControllerDriverFormat
3e5111
MIME-Version: 1.0
3e5111
Content-Type: text/plain; charset=UTF-8
3e5111
Content-Transfer-Encoding: 8bit
3e5111
3e5111
Split out formatting the <driver> subelement of <controller>
3e5111
to make adding new options easier.
3e5111
3e5111
(cherry picked from commit fe262186dccfa5c5cbcfe5ab7eb95195cf3b10f5)
3e5111
Signed-off-by: Ján Tomko <jtomko@redhat.com>
3e5111
3e5111
https://bugzilla.redhat.com/show_bug.cgi?id=1283251
3e5111
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
3e5111
---
3e5111
 src/conf/domain_conf.c | 55 +++++++++++++++++++++++++++++---------------------
3e5111
 1 file changed, 32 insertions(+), 23 deletions(-)
3e5111
3e5111
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
3e5111
index e004559f9f..275145b1ec 100644
3e5111
--- a/src/conf/domain_conf.c
3e5111
+++ b/src/conf/domain_conf.c
3e5111
@@ -21323,6 +21323,37 @@ virDomainDiskDefFormat(virBufferPtr buf,
3e5111
 #undef FORMAT_IOTUNE
3e5111
 
3e5111
 
3e5111
+static void
3e5111
+virDomainControllerDriverFormat(virBufferPtr buf,
3e5111
+                                virDomainControllerDefPtr def)
3e5111
+{
3e5111
+    virBuffer driverBuf = VIR_BUFFER_INITIALIZER;
3e5111
+
3e5111
+    if (def->queues)
3e5111
+        virBufferAsprintf(&driverBuf, " queues='%u'", def->queues);
3e5111
+
3e5111
+    if (def->cmd_per_lun)
3e5111
+        virBufferAsprintf(&driverBuf, " cmd_per_lun='%u'", def->cmd_per_lun);
3e5111
+
3e5111
+    if (def->max_sectors)
3e5111
+        virBufferAsprintf(&driverBuf, " max_sectors='%u'", def->max_sectors);
3e5111
+
3e5111
+    if (def->ioeventfd) {
3e5111
+        virBufferAsprintf(&driverBuf, " ioeventfd='%s'",
3e5111
+                          virTristateSwitchTypeToString(def->ioeventfd));
3e5111
+    }
3e5111
+
3e5111
+    if (def->iothread)
3e5111
+        virBufferAsprintf(&driverBuf, " iothread='%u'", def->iothread);
3e5111
+
3e5111
+    if (virBufferUse(&driverBuf)) {
3e5111
+        virBufferAddLit(buf, "
3e5111
+        virBufferAddBuffer(buf, &driverBuf);
3e5111
+        virBufferAddLit(buf, "/>\n");
3e5111
+    }
3e5111
+}
3e5111
+
3e5111
+
3e5111
 static int
3e5111
 virDomainControllerDefFormat(virBufferPtr buf,
3e5111
                              virDomainControllerDefPtr def,
3e5111
@@ -21332,7 +21363,6 @@ virDomainControllerDefFormat(virBufferPtr buf,
3e5111
     const char *model = NULL;
3e5111
     const char *modelName = NULL;
3e5111
     bool pcihole64 = false, pciModel = false, pciTarget = false;
3e5111
-    virBuffer driverBuf = VIR_BUFFER_INITIALIZER;
3e5111
 
3e5111
     if (!type) {
3e5111
         virReportError(VIR_ERR_INTERNAL_ERROR,
3e5111
@@ -21437,28 +21467,7 @@ virDomainControllerDefFormat(virBufferPtr buf,
3e5111
             }
3e5111
         }
3e5111
 
3e5111
-        if (def->queues)
3e5111
-            virBufferAsprintf(&driverBuf, " queues='%u'", def->queues);
3e5111
-
3e5111
-        if (def->cmd_per_lun)
3e5111
-            virBufferAsprintf(&driverBuf, " cmd_per_lun='%u'", def->cmd_per_lun);
3e5111
-
3e5111
-        if (def->max_sectors)
3e5111
-            virBufferAsprintf(&driverBuf, " max_sectors='%u'", def->max_sectors);
3e5111
-
3e5111
-        if (def->ioeventfd) {
3e5111
-            virBufferAsprintf(&driverBuf, " ioeventfd='%s'",
3e5111
-                              virTristateSwitchTypeToString(def->ioeventfd));
3e5111
-        }
3e5111
-
3e5111
-        if (def->iothread)
3e5111
-            virBufferAsprintf(&driverBuf, " iothread='%u'", def->iothread);
3e5111
-
3e5111
-        if (virBufferUse(&driverBuf)) {
3e5111
-            virBufferAddLit(buf, "
3e5111
-            virBufferAddBuffer(buf, &driverBuf);
3e5111
-            virBufferAddLit(buf, "/>\n");
3e5111
-        }
3e5111
+        virDomainControllerDriverFormat(buf, def);
3e5111
 
3e5111
         if (virDomainDeviceInfoNeedsFormat(&def->info, flags) &&
3e5111
             virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
3e5111
-- 
3e5111
2.13.1
3e5111