[libvirt] [PATCH 07/13] Move and rename qemuDomainValidateDevicePCISlotsChipsets

Tomasz Flendrich t.flendrich at gmail.com
Wed Jul 20 00:07:21 UTC 2016


qemuDomainValidateDevicePCISlotsChipsets is renamed to
virDomainValidateDevicePCISlotsChipsets and moved from
qemu_domain_addr.c to domain_addr.c

All these functions are being moved because they don't depend on
qemu, so they have the potential to be reused for more hypervisors.
---
 src/conf/domain_addr.c         | 19 +++++++++++++++++++
 src/conf/domain_addr.h         |  6 +++++-
 src/libvirt_private.syms       |  1 +
 src/qemu/qemu_domain_address.c | 23 ++---------------------
 4 files changed, 27 insertions(+), 22 deletions(-)

diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index aecad04..0659842 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -1712,3 +1712,22 @@ virDomainValidateDevicePCISlotsQ35(virDomainDefPtr def,
     VIR_FREE(addrStr);
     return ret;
 }
+
+
+int
+virDomainValidateDevicePCISlotsChipsets(virDomainDefPtr def,
+                                         virDomainPCIAddressSetPtr addrs,
+                                         bool videoPrimaryEnabled)
+{
+    if (virDomainMachineIsI440FX(def) &&
+        virDomainValidateDevicePCISlotsPIIX3(def, addrs, videoPrimaryEnabled) < 0) {
+        return -1;
+    }
+
+    if (virDomainMachineIsQ35(def) &&
+        virDomainValidateDevicePCISlotsQ35(def, addrs, videoPrimaryEnabled) < 0) {
+        return -1;
+    }
+
+    return 0;
+}
diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h
index 55c4e83..42424f9 100644
--- a/src/conf/domain_addr.h
+++ b/src/conf/domain_addr.h
@@ -256,6 +256,10 @@ virDomainValidateDevicePCISlotsQ35(virDomainDefPtr def,
                                     bool videoPrimaryEnabled)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
 
-
+int
+virDomainValidateDevicePCISlotsChipsets(virDomainDefPtr def,
+                                         virDomainPCIAddressSetPtr addrs,
+                                         bool videoPrimaryEnabled)
+    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
 
 #endif /* __DOMAIN_ADDR_H__ */
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 89c1710..3e468b5 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -109,6 +109,7 @@ virDomainPCIAddressSetGrow;
 virDomainPCIAddressSlotInUse;
 virDomainPCIAddressValidate;
 virDomainPCIControllerModelToConnectType;
+virDomainValidateDevicePCISlotsChipsets;
 virDomainValidateDevicePCISlotsPIIX3;
 virDomainValidateDevicePCISlotsQ35;
 virDomainVirtioSerialAddrAssign;
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index dcdd4e2..ec67e37 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -418,25 +418,6 @@ qemuDomainPCIAddressSetCreate(virDomainDefPtr def,
 }
 
 
-static int
-qemuDomainValidateDevicePCISlotsChipsets(virDomainDefPtr def,
-                                         virDomainPCIAddressSetPtr addrs,
-                                         bool videoPrimaryEnabled)
-{
-    if (virDomainMachineIsI440FX(def) &&
-        virDomainValidateDevicePCISlotsPIIX3(def, addrs, videoPrimaryEnabled) < 0) {
-        return -1;
-    }
-
-    if (virDomainMachineIsQ35(def) &&
-        virDomainValidateDevicePCISlotsQ35(def, addrs, videoPrimaryEnabled) < 0) {
-        return -1;
-    }
-
-    return 0;
-}
-
-
 static bool
 qemuDomainPCIBusFullyReserved(virDomainPCIAddressBusPtr bus)
 {
@@ -945,7 +926,7 @@ qemuDomainPCIAddrSetCreateFromDomain(virDomainDefPtr def,
         goto cleanup;
 
     if (qemuDomainSupportsPCI(def, gpexEnabled)) {
-        if (qemuDomainValidateDevicePCISlotsChipsets(def, addrs,
+        if (virDomainValidateDevicePCISlotsChipsets(def, addrs,
                                              videoPrimaryEnabled) < 0)
             goto cleanup;
 
@@ -996,7 +977,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
         if (!(addrs = qemuDomainPCIAddressSetCreate(def, nbuses, true)))
             goto cleanup;
 
-        if (qemuDomainValidateDevicePCISlotsChipsets(def, addrs,
+        if (virDomainValidateDevicePCISlotsChipsets(def, addrs,
                                                      videoPrimaryEnabled) < 0)
             goto cleanup;
 
-- 
2.7.4 (Apple Git-66)




More information about the libvir-list mailing list