[PATCH 4/6] qemu: pass virDomainDeviceInfo by reference

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

 



The virDomainDeviceInfo parameter is a large struct so it is preferrable
to pass it by reference instead of by value.

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
 src/qemu/qemu_command.c        |  4 ++--
 src/qemu/qemu_domain.c         | 10 +++++-----
 src/qemu/qemu_domain.h         |  9 +++++----
 src/qemu/qemu_domain_address.c |  2 +-
 4 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 3e46f3ced3..a59583fb75 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1894,7 +1894,7 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
     if (qemuCheckDiskConfig(disk, qemuCaps) < 0)
         goto error;
 
-    if (!qemuDomainCheckCCWS390AddressSupport(def, disk->info, qemuCaps, disk->dst))
+    if (!qemuDomainCheckCCWS390AddressSupport(def, &disk->info, qemuCaps, disk->dst))
         goto error;
 
     if (disk->iothread && !qemuCheckIOThreads(def, disk))
@@ -5961,7 +5961,7 @@ qemuBuildRNGDevStr(const virDomainDef *def,
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
 
-    if (!qemuDomainCheckCCWS390AddressSupport(def, dev->info, qemuCaps,
+    if (!qemuDomainCheckCCWS390AddressSupport(def, &dev->info, qemuCaps,
                                               dev->source.file))
         goto error;
 
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 63879e3e4c..6a78c023c8 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -5807,7 +5807,7 @@ qemuDomainDeviceDefValidateController(const virDomainControllerDef *controller,
 {
     int ret = 0;
 
-    if (!qemuDomainCheckCCWS390AddressSupport(def, controller->info, qemuCaps,
+    if (!qemuDomainCheckCCWS390AddressSupport(def, &controller->info, qemuCaps,
                                               "controller"))
         return -1;
 
@@ -5861,7 +5861,7 @@ qemuDomainDeviceDefValidateVsock(const virDomainVsockDef *vsock,
         return -1;
     }
 
-    if (!qemuDomainCheckCCWS390AddressSupport(def, vsock->info, qemuCaps,
+    if (!qemuDomainCheckCCWS390AddressSupport(def, &vsock->info, qemuCaps,
                                               "vsock"))
         return -1;
 
@@ -13474,11 +13474,11 @@ qemuDomainGetMachineName(virDomainObjPtr vm)
  */
 bool
 qemuDomainCheckCCWS390AddressSupport(const virDomainDef *def,
-                                     virDomainDeviceInfo info,
+                                     const virDomainDeviceInfo *info,
                                      virQEMUCapsPtr qemuCaps,
                                      const char *devicename)
 {
-    if (info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
+    if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
         if (!qemuDomainIsS390CCW(def)) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("cannot use CCW address type for device "
@@ -13491,7 +13491,7 @@ qemuDomainCheckCCWS390AddressSupport(const virDomainDef *def,
                              "this QEMU"));
             return false;
         }
-    } else if (info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) {
+    } else if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) {
         if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390)) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("virtio S390 address type is not supported by "
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index defbffbf94..462da8224d 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -1064,10 +1064,11 @@ int
 qemuDomainObjPrivateXMLParseAllowReboot(xmlXPathContextPtr ctxt,
                                         virTristateBool *allowReboot);
 
-bool qemuDomainCheckCCWS390AddressSupport(const virDomainDef *def,
-                                    virDomainDeviceInfo info,
-                                    virQEMUCapsPtr qemuCaps,
-                                    const char *devicename);
+bool
+qemuDomainCheckCCWS390AddressSupport(const virDomainDef *def,
+                                     const virDomainDeviceInfo *info,
+                                     virQEMUCapsPtr qemuCaps,
+                                     const char *devicename);
 
 int
 qemuDomainPrepareDiskSourceData(virDomainDiskDefPtr disk,
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index d50744a952..c376f3f897 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -3226,7 +3226,7 @@ qemuDomainEnsureVirtioAddress(bool *releaseAddr,
         else if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_S390))
             info->type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390;
     } else {
-        if (!qemuDomainCheckCCWS390AddressSupport(vm->def, *info, priv->qemuCaps,
+        if (!qemuDomainCheckCCWS390AddressSupport(vm->def, info, priv->qemuCaps,
                                                   devicename))
             return -1;
     }
-- 
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