[libvirt] [PATCH] conf: Move virDomainPCIAddressBusIsFullyReserved()

Andrea Bolognani posted 1 patch 116 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1498747617-5624-1-git-send-email-abologna@redhat.com
src/conf/domain_addr.c         | 14 ++++++++++++++
src/conf/domain_addr.h         |  3 +++
src/libvirt_private.syms       |  1 +
src/qemu/qemu_domain_address.c | 15 +--------------
4 files changed, 19 insertions(+), 14 deletions(-)

[libvirt] [PATCH] conf: Move virDomainPCIAddressBusIsFullyReserved()

Posted by Andrea Bolognani 116 weeks ago
This function was private to the QEMU driver and was,
accordingly, called qemuDomainPCIBusFullyReserved().

However, since it's really not QEMU-specific at all,
it makes a lot of sense to have it closer to the
virDomainPCIAddressBus struct it operates on; even more
so considering we're going to introduce a complementary
virDomainPCIAddressBusIsEmpty() function later on.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 src/conf/domain_addr.c         | 14 ++++++++++++++
 src/conf/domain_addr.h         |  3 +++
 src/libvirt_private.syms       |  1 +
 src/qemu/qemu_domain_address.c | 15 +--------------
 4 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index 639168e..0ae1ed9 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -355,6 +355,20 @@ virDomainPCIAddressBusSetModel(virDomainPCIAddressBusPtr bus,
 }
 
 
+bool
+virDomainPCIAddressBusIsFullyReserved(virDomainPCIAddressBusPtr bus)
+{
+    size_t i;
+
+    for (i = bus->minSlot; i <= bus->maxSlot; i++) {
+        if (!bus->slot[i].functions)
+            return false;
+    }
+
+    return true;
+}
+
+
 /* Ensure addr fits in the address set, by expanding it if needed
  *
  * Return value:
diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h
index f884b8a..c90a335 100644
--- a/src/conf/domain_addr.h
+++ b/src/conf/domain_addr.h
@@ -141,6 +141,9 @@ int virDomainPCIAddressBusSetModel(virDomainPCIAddressBusPtr bus,
                                    virDomainControllerModelPCI model)
     ATTRIBUTE_NONNULL(1);
 
+bool virDomainPCIAddressBusIsFullyReserved(virDomainPCIAddressBusPtr bus)
+    ATTRIBUTE_NONNULL(1);
+
 bool virDomainPCIAddressSlotInUse(virDomainPCIAddressSetPtr addrs,
                                   virPCIDeviceAddressPtr addr)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 888412a..d76c1a7 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -106,6 +106,7 @@ virDomainCCWAddressSetFree;
 virDomainCCWAddressValidate;
 virDomainGetBlkioParametersAssignFromDef;
 virDomainPCIAddressAsString;
+virDomainPCIAddressBusIsFullyReserved;
 virDomainPCIAddressBusSetModel;
 virDomainPCIAddressEnsureAddr;
 virDomainPCIAddressFlagsCompatible;
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index b5b863f..efc698d 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -1499,19 +1499,6 @@ qemuDomainValidateDevicePCISlotsChipsets(virDomainDefPtr def,
 }
 
 
-static bool
-qemuDomainPCIBusFullyReserved(virDomainPCIAddressBusPtr bus)
-{
-    size_t i;
-
-    for (i = bus->minSlot; i <= bus->maxSlot; i++)
-        if (!bus->slot[i].functions)
-            return false;
-
-    return true;
-}
-
-
 /*
  * This assigns static PCI slots to all configured devices.
  * The ordering here is chosen to match the ordering used
@@ -2043,7 +2030,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
             bool buses_reserved = true;
 
             for (i = 0; i < addrs->nbuses; i++) {
-                if (!qemuDomainPCIBusFullyReserved(&addrs->buses[i])) {
+                if (!virDomainPCIAddressBusIsFullyReserved(&addrs->buses[i])) {
                     buses_reserved = false;
                     break;
                 }
-- 
2.7.5

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

Re: [libvirt] [PATCH] conf: Move virDomainPCIAddressBusIsFullyReserved()

Posted by Laine Stump 116 weeks ago
On 06/29/2017 10:46 AM, Andrea Bolognani wrote:
> This function was private to the QEMU driver and was,
> accordingly, called qemuDomainPCIBusFullyReserved().
> 
> However, since it's really not QEMU-specific at all,
> it makes a lot of sense to have it closer to the
> virDomainPCIAddressBus struct it operates on; even more
> so considering we're going to introduce a complementary
> virDomainPCIAddressBusIsEmpty() function later on.
> 
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>

Reviewed-by: Laine Stump <laine@laine.org>

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