]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: rename CheckSlot to SlotInUse
authorJán Tomko <jtomko@redhat.com>
Mon, 15 Apr 2013 17:56:03 +0000 (19:56 +0200)
committerJán Tomko <jtomko@redhat.com>
Fri, 19 Apr 2013 16:16:01 +0000 (18:16 +0200)
Also change its return value from int to bool.

src/qemu/qemu_command.c

index e25d66ac492954d9fca766d06ac8cae4835b0047..05c12b2bdcc28c4320cbf99682ac9db7ae3fb8c3 100644 (file)
@@ -1388,14 +1388,13 @@ error:
     return NULL;
 }
 
-/* check whether the slot is used by the other device
- * Return 0 if the slot is not used by the other device, or -1 if the slot
- * is used by the other device.
+/*
+ * Check if the PCI slot is used by another device.
  */
-static int qemuDomainPCIAddressCheckSlot(qemuDomainPCIAddressSetPtr addrs,
-                                         virDevicePCIAddressPtr addr)
+static bool qemuDomainPCIAddressSlotInUse(qemuDomainPCIAddressSetPtr addrs,
+                                          virDevicePCIAddressPtr addr)
 {
-    return addrs->used[addr->bus][addr->slot] ? -1 : 0;
+    return !!addrs->used[addr->bus][addr->slot];
 }
 
 int qemuDomainPCIAddressReserveAddr(qemuDomainPCIAddressSetPtr addrs,
@@ -1516,7 +1515,7 @@ qemuDomainPCIAddressGetNextSlot(qemuDomainPCIAddressSetPtr addrs,
         if (!(addr = qemuPCIAddressAsString(&tmp_addr)))
             return -1;
 
-        if (qemuDomainPCIAddressCheckSlot(addrs, &tmp_addr) < 0) {
+        if (qemuDomainPCIAddressSlotInUse(addrs, &tmp_addr)) {
             VIR_DEBUG("PCI addr %s already in use", addr);
             VIR_FREE(addr);
             continue;
@@ -1684,7 +1683,7 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
             primaryVideo->info.addr.pci.function = 0;
             addrptr = &primaryVideo->info.addr.pci;
 
-            if (qemuDomainPCIAddressCheckSlot(addrs, addrptr) < 0) {
+            if (qemuDomainPCIAddressSlotInUse(addrs, addrptr)) {
                 if (qemuDeviceVideoUsable) {
                     virResetLastError();
                     if (qemuDomainPCIAddressSetNextAddr(addrs, &primaryVideo->info) < 0)
@@ -1714,7 +1713,7 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
         memset(&tmp_addr, 0, sizeof(tmp_addr));
         tmp_addr.slot = 2;
 
-        if (qemuDomainPCIAddressCheckSlot(addrs, &tmp_addr) < 0) {
+        if (qemuDomainPCIAddressSlotInUse(addrs, &tmp_addr)) {
             VIR_DEBUG("PCI address 0:0:2.0 in use, future addition of a video"
                       " device will not be possible without manual"
                       " intervention");