[PATCH 02/23] conf: Use virXMLFormatElement in virDomainControllerDriverFormat

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Refactor adding of the controller <driver> element.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d84cc2d482..e7c71bb43d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -24255,7 +24255,7 @@ virDomainDiskDefFormat(virBufferPtr buf,
 }


-static void
+static int
 virDomainControllerDriverFormat(virBufferPtr buf,
                                 virDomainControllerDefPtr def)
 {
@@ -24280,11 +24280,7 @@ virDomainControllerDriverFormat(virBufferPtr buf,

     virDomainVirtioOptionsFormat(&driverBuf, def->virtio);

-    if (virBufferError(&driverBuf) != 0 || virBufferUse(&driverBuf)) {
-        virBufferAddLit(buf, "<driver");
-        virBufferAddBuffer(buf, &driverBuf);
-        virBufferAddLit(buf, "/>\n");
-    }
+    return virXMLFormatElement(buf, "driver", &driverBuf, NULL);
 }


@@ -24417,7 +24413,8 @@ virDomainControllerDefFormat(virBufferPtr buf,
         }
     }

-    virDomainControllerDriverFormat(&childBuf, def);
+    if (virDomainControllerDriverFormat(&childBuf, def) < 0)
+        goto cleanup;

     if (virDomainDeviceInfoFormat(&childBuf, &def->info, flags) < 0)
         goto cleanup;
-- 
2.20.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux