From 9d0d053dc7f8af8ebb3c7fbb3a11335e4b50717b Mon Sep 17 00:00:00 2001
Message-Id: <9d0d053dc7f8af8ebb3c7fbb3a11335e4b50717b@dist-git>
From: Andrea Bolognani <abologna@redhat.com>
Date: Mon, 17 Jul 2017 12:08:58 +0200
Subject: [PATCH] conf: Move virDomainPCIAddressBusIsFullyReserved()
This function was private to the QEMU driver and was,
accordingly, called qemuDomainPCIBusFullyReserved().
However the function is really not QEMU-specific at
all, so it makes sense to move it closer to the
virDomainPCIAddressBus struct it operates on.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Laine Stump <laine@laine.org>
(cherry picked from commit c79f97c83ce1421f79756a9a344e8e77ceeeb1d8)
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1431193
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Jiri Denemark <jdenemar@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 639168effa..0ae1ed93af 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 f884b8af2b..c90a335919 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 9c596e3f1c..7876ffb208 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -105,6 +105,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 3da6b7369d..ff57edb564 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -1494,19 +1494,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
@@ -2038,7 +2025,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.13.3