[PATCH 10/13] Move and rename qemuDomainSupportsPCI

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

 



qemuDomainSupportsPCI is renamed to virDomainSupportsPCI and moved
from qemu_domain_address.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         | 18 ++++++++++++++++++
 src/conf/domain_addr.h         |  5 +++++
 src/libvirt_private.syms       |  1 +
 src/qemu/qemu_domain_address.c | 22 ++--------------------
 4 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index 3a9c44d..3ac7d3f 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -2232,3 +2232,21 @@ virDomainMachineIsVirt(const virDomainDef *def)
 
     return true;
 }
+
+
+bool
+virDomainSupportsPCI(virDomainDefPtr def,
+                     bool gpexEnabled)
+{
+    if ((def->os.arch != VIR_ARCH_ARMV7L) && (def->os.arch != VIR_ARCH_AARCH64))
+        return true;
+
+    if (STREQ(def->os.machine, "versatilepb"))
+        return true;
+
+    if (virDomainMachineIsVirt(def) &&
+        gpexEnabled)
+        return true;
+
+    return false;
+}
diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h
index 7ecdac3..f06ae46 100644
--- a/src/conf/domain_addr.h
+++ b/src/conf/domain_addr.h
@@ -285,4 +285,9 @@ virDomainAssignDevicePCISlots(virDomainDefPtr def,
 bool
 virDomainMachineIsVirt(const virDomainDef *def);
 
+bool
+virDomainSupportsPCI(virDomainDefPtr def,
+                     bool gpexEnabled)
+    ATTRIBUTE_NONNULL(1);
+
 #endif /* __DOMAIN_ADDR_H__ */
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index e02f453..9d1024b 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -114,6 +114,7 @@ virDomainPCIAddressSlotInUse;
 virDomainPCIAddressValidate;
 virDomainPCIBusFullyReserved;
 virDomainPCIControllerModelToConnectType;
+virDomainSupportsPCI;
 virDomainValidateDevicePCISlotsChipsets;
 virDomainValidateDevicePCISlotsPIIX3;
 virDomainValidateDevicePCISlotsQ35;
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index be790ec..795fcd0 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -360,24 +360,6 @@ qemuDomainAssignARMVirtioMMIOAddresses(virDomainDefPtr def,
 }
 
 
-static bool
-qemuDomainSupportsPCI(virDomainDefPtr def,
-                      bool gpexEnabled)
-{
-    if ((def->os.arch != VIR_ARCH_ARMV7L) && (def->os.arch != VIR_ARCH_AARCH64))
-        return true;
-
-    if (STREQ(def->os.machine, "versatilepb"))
-        return true;
-
-    if (virDomainMachineIsVirt(def) &&
-        gpexEnabled)
-        return true;
-
-    return false;
-}
-
-
 static void
 qemuDomainPCIControllerSetDefaultModelName(virDomainControllerDefPtr cont)
 {
@@ -439,7 +421,7 @@ qemuDomainPCIAddrSetCreateFromDomain(virDomainDefPtr def,
     if (!(addrs = virDomainPCIAddressSetCreate(def, nbuses, false)))
         goto cleanup;
 
-    if (qemuDomainSupportsPCI(def, gpexEnabled)) {
+    if (virDomainSupportsPCI(def, gpexEnabled)) {
         if (virDomainValidateDevicePCISlotsChipsets(def, addrs,
                                              videoPrimaryEnabled) < 0)
             goto cleanup;
@@ -545,7 +527,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
                                                        gpexEnabled)))
         goto cleanup;
 
-    if (qemuDomainSupportsPCI(def, gpexEnabled)) {
+    if (virDomainSupportsPCI(def, gpexEnabled)) {
         for (i = 0; i < def->ncontrollers; i++) {
             virDomainControllerDefPtr cont = def->controllers[i];
             int idx = cont->idx;
-- 
2.7.4 (Apple Git-66)

--
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]