[libvirt] [PATCH 04/17] qemu: rename virDomainDeviceInfoPtr variables to avoid confusion

Laine Stump laine at laine.org
Tue Feb 28 20:14:35 UTC 2012


The virDomainDeviceInfoPtrs in qemuCollectPCIAddress and
qemuComparePCIDevice are named "dev" and "dev1", but those functions
will be changed (in order to match a change in the args sent to
virDomainDeviceInfoIterate() callback args) to contain a
virDomainDeviceDefPtr device.

This patch renames "dev" to "info" (and "dev[n]" to "info[n]") to
avoid later confusion.
---
new Patch in V2.

 src/qemu/qemu_command.c |   18 +++++++++---------
 src/qemu/qemu_hotplug.c |   12 ++++++------
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 01adf0d..04e580f 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -835,22 +835,22 @@ static char *qemuPCIAddressAsString(virDomainDeviceInfoPtr dev)
 
 
 static int qemuCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED,
-                                 virDomainDeviceInfoPtr dev,
+                                 virDomainDeviceInfoPtr info,
                                  void *opaque)
 {
     int ret = -1;
     char *addr = NULL;
     qemuDomainPCIAddressSetPtr addrs = opaque;
 
-    if (dev->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)
+    if (info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)
         return 0;
 
-    addr = qemuPCIAddressAsString(dev);
+    addr = qemuPCIAddressAsString(info);
     if (!addr)
         goto cleanup;
 
     if (virHashLookup(addrs->used, addr)) {
-        if (dev->addr.pci.function != 0) {
+        if (info->addr.pci.function != 0) {
             qemuReportError(VIR_ERR_XML_ERROR,
                             _("Attempted double use of PCI Address '%s' "
                               "(may need \"multifunction='on'\" for device on function 0"),
@@ -867,15 +867,15 @@ static int qemuCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED,
         goto cleanup;
     addr = NULL;
 
-    if ((dev->addr.pci.function == 0) &&
-        (dev->addr.pci.multi != VIR_DOMAIN_DEVICE_ADDRESS_PCI_MULTI_ON)) {
+    if ((info->addr.pci.function == 0) &&
+        (info->addr.pci.multi != VIR_DOMAIN_DEVICE_ADDRESS_PCI_MULTI_ON)) {
         /* a function 0 w/o multifunction=on must reserve the entire slot */
         int function;
-        virDomainDeviceInfo temp_dev = *dev;
+        virDomainDeviceInfo temp_info = *info;
 
         for (function = 1; function < QEMU_PCI_ADDRESS_LAST_FUNCTION; function++) {
-            temp_dev.addr.pci.function = function;
-            addr = qemuPCIAddressAsString(&temp_dev);
+            temp_info.addr.pci.function = function;
+            addr = qemuPCIAddressAsString(&temp_info);
             if (!addr)
                 goto cleanup;
 
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 5c64dbe..0ca3186 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1481,17 +1481,17 @@ static inline int qemuFindDisk(virDomainDefPtr def, const char *dst)
 }
 
 static int qemuComparePCIDevice(virDomainDefPtr def ATTRIBUTE_UNUSED,
-                                virDomainDeviceInfoPtr dev1,
+                                virDomainDeviceInfoPtr info1,
                                 void *opaque)
 {
-    virDomainDeviceInfoPtr dev2 = opaque;
+    virDomainDeviceInfoPtr info2 = opaque;
 
-    if (dev1->type !=  VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI ||
-        dev2->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)
+    if (info1->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI ||
+        info2->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)
         return 0;
 
-    if (dev1->addr.pci.slot == dev2->addr.pci.slot &&
-        dev1->addr.pci.function != dev2->addr.pci.function)
+    if (info1->addr.pci.slot == info2->addr.pci.slot &&
+        info1->addr.pci.function != info2->addr.pci.function)
         return -1;
     return 0;
 }
-- 
1.7.7.6




More information about the libvir-list mailing list