[libvirt] [PATCH 1/7] qemu: QEMU_PCI constant consistency

Ján Tomko jtomko at redhat.com
Wed Apr 3 15:50:30 UTC 2013


Change QEMU_PCI_ADDRESS_LAST_SLOT to the number of slots in the bus,
not the maximum slot value, to match QEMU_PCI_ADDRESS_LAST_FUNCTION.
---
 src/qemu/qemu_command.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 693d30d..8321dcd 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1185,7 +1185,7 @@ cleanup:
     return ret;
 }
 
-#define QEMU_PCI_ADDRESS_LAST_SLOT 31
+#define QEMU_PCI_ADDRESS_LAST_SLOT 32
 #define QEMU_PCI_ADDRESS_LAST_FUNCTION 8
 struct _qemuDomainPCIAddressSet {
     virHashTablePtr used;
@@ -1536,8 +1536,8 @@ qemuDomainPCIAddressGetNextSlot(qemuDomainPCIAddressSetPtr addrs,
     char *addr;
 
     tmp_addr.slot++;
-    for (i = 0; i <= QEMU_PCI_ADDRESS_LAST_SLOT; i++, tmp_addr.slot++) {
-        if (QEMU_PCI_ADDRESS_LAST_SLOT < tmp_addr.slot) {
+    for (i = 0; i < QEMU_PCI_ADDRESS_LAST_SLOT; i++, tmp_addr.slot++) {
+        if (QEMU_PCI_ADDRESS_LAST_SLOT <= tmp_addr.slot) {
             tmp_addr.slot = 0;
         }
 
-- 
1.8.1.5




More information about the libvir-list mailing list