[PATCH v2] qemu: move qemuDomainCCWAddrSetCreateFromDomain

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

 



from src/qemu/qemu_domain_address.c to src/conf/domain_addr.c
and rename to virDomainCCWAddressSetCreateFromDomain

(rename to have Address in full instead of Addr to follow
the naming convention of other virDomainCCWAddress functions)

Signed-off-by: Anya Harter <aharter@xxxxxxxxxx>
---

renamed function in v2 patch (reason supplied in commit message)

original patch email: https://www.redhat.com/archives/libvir-list/2018-June/msg01823.html

 src/conf/domain_addr.c         | 24 ++++++++++++++++++++++++
 src/conf/domain_addr.h         |  4 ++++
 src/libvirt_private.syms       |  1 +
 src/qemu/qemu_domain_address.c | 26 ++------------------------
 src/qemu/qemu_domain_address.h |  4 ----
 src/qemu/qemu_hotplug.c        |  4 ++--
 6 files changed, 33 insertions(+), 30 deletions(-)

diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index fd66a74e9d..eb0784cd2c 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -1185,6 +1185,30 @@ virDomainCCWAddressSetCreate(void)
 }
 
 
+virDomainCCWAddressSetPtr
+virDomainCCWAddressSetCreateFromDomain(virDomainDefPtr def)
+{
+    virDomainCCWAddressSetPtr addrs = NULL;
+
+    if (!(addrs = virDomainCCWAddressSetCreate()))
+        goto error;
+
+    if (virDomainDeviceInfoIterate(def, virDomainCCWAddressValidate,
+                                   addrs) < 0)
+        goto error;
+
+    if (virDomainDeviceInfoIterate(def, virDomainCCWAddressAllocate,
+                                   addrs) < 0)
+        goto error;
+
+    return addrs;
+
+ error:
+    virDomainCCWAddressSetFree(addrs);
+    return NULL;
+}
+
+
 #define VIR_DOMAIN_DEFAULT_VIRTIO_SERIAL_PORTS 31
 
 
diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h
index 2764070cd2..776399eb63 100644
--- a/src/conf/domain_addr.h
+++ b/src/conf/domain_addr.h
@@ -202,6 +202,10 @@ int virDomainCCWAddressValidate(virDomainDefPtr def,
 
 virDomainCCWAddressSetPtr virDomainCCWAddressSetCreate(void);
 
+virDomainCCWAddressSetPtr
+virDomainCCWAddressSetCreateFromDomain(virDomainDefPtr def)
+    ATTRIBUTE_NONNULL(1);
+
 struct _virDomainVirtioSerialController {
     unsigned int idx;
     virBitmapPtr ports;
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index ffe5dfd19b..7000620b41 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -107,6 +107,7 @@ virPCIDeviceAddressParseXML;
 virDomainCCWAddressAllocate;
 virDomainCCWAddressAssign;
 virDomainCCWAddressSetCreate;
+virDomainCCWAddressSetCreateFromDomain;
 virDomainCCWAddressSetFree;
 virDomainCCWAddressValidate;
 virDomainPCIAddressAsString;
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index e9f460d77a..eb11a660d7 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -376,28 +376,6 @@ qemuDomainPrimeVirtioDeviceAddresses(virDomainDefPtr def,
     }
 }
 
-virDomainCCWAddressSetPtr
-qemuDomainCCWAddrSetCreateFromDomain(virDomainDefPtr def)
-{
-    virDomainCCWAddressSetPtr addrs = NULL;
-
-    if (!(addrs = virDomainCCWAddressSetCreate()))
-        goto error;
-
-    if (virDomainDeviceInfoIterate(def, virDomainCCWAddressValidate,
-                                   addrs) < 0)
-        goto error;
-
-    if (virDomainDeviceInfoIterate(def, virDomainCCWAddressAllocate,
-                                   addrs) < 0)
-        goto error;
-
-    return addrs;
-
- error:
-    virDomainCCWAddressSetFree(addrs);
-    return NULL;
-}
 
 /*
  * Three steps populating CCW devnos
@@ -420,7 +398,7 @@ qemuDomainAssignS390Addresses(virDomainDefPtr def,
         qemuDomainPrimeVirtioDeviceAddresses(
             def, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW);
 
-        if (!(addrs = qemuDomainCCWAddrSetCreateFromDomain(def)))
+        if (!(addrs = virDomainCCWAddressSetCreateFromDomain(def)))
             goto cleanup;
 
     } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390)) {
@@ -3027,7 +3005,7 @@ qemuDomainEnsureVirtioAddress(bool *releaseAddr,
     }
 
     if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
-        if (!(ccwaddrs = qemuDomainCCWAddrSetCreateFromDomain(vm->def)))
+        if (!(ccwaddrs = virDomainCCWAddressSetCreateFromDomain(vm->def)))
             goto cleanup;
         if (virDomainCCWAddressAssign(info, ccwaddrs,
                                       !info->addr.ccw.assigned) < 0)
diff --git a/src/qemu/qemu_domain_address.h b/src/qemu/qemu_domain_address.h
index 83f8e81cad..89d7a5ac3e 100644
--- a/src/qemu/qemu_domain_address.h
+++ b/src/qemu/qemu_domain_address.h
@@ -59,10 +59,6 @@ void qemuDomainReleaseDeviceAddress(virDomainObjPtr vm,
                                     virDomainDeviceInfoPtr info,
                                     const char *devstr);
 
-virDomainCCWAddressSetPtr
-qemuDomainCCWAddrSetCreateFromDomain(virDomainDefPtr def)
-    ATTRIBUTE_NONNULL(1);
-
 int qemuDomainAssignMemoryDeviceSlot(virDomainDefPtr def,
                                      virDomainMemoryDefPtr mem);
 
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index fcd8eb0ffa..f028175fb4 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -964,7 +964,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
     if (qemuDomainIsS390CCW(vm->def) &&
         virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_CCW)) {
         net->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW;
-        if (!(ccwaddrs = qemuDomainCCWAddrSetCreateFromDomain(vm->def)))
+        if (!(ccwaddrs = virDomainCCWAddressSetCreateFromDomain(vm->def)))
             goto cleanup;
         if (virDomainCCWAddressAssign(&net->info, ccwaddrs,
                                       !net->info.addr.ccw.assigned) < 0)
@@ -2375,7 +2375,7 @@ qemuDomainAttachSCSIVHostDevice(virQEMUDriverPtr driver,
         if (qemuDomainEnsurePCIAddress(vm, &dev, driver) < 0)
             goto cleanup;
     } else if (hostdev->info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
-        if (!(ccwaddrs = qemuDomainCCWAddrSetCreateFromDomain(vm->def)))
+        if (!(ccwaddrs = virDomainCCWAddressSetCreateFromDomain(vm->def)))
             goto cleanup;
         if (virDomainCCWAddressAssign(hostdev->info, ccwaddrs,
                                       !hostdev->info->addr.ccw.assigned) < 0)
-- 
2.17.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