qemu: rename virDomainDeviceInfoPtr variables to avoid confusion

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.
This commit is contained in:
Laine Stump 2012-02-23 12:59:21 -05:00
parent fdad9c34ad
commit 37038d5c0b
2 changed files with 15 additions and 15 deletions

View File

@ -833,22 +833,22 @@ static char *qemuPCIAddressAsString(virDomainDeviceInfoPtr dev)
static int qemuCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED, static int qemuCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED,
virDomainDeviceInfoPtr dev, virDomainDeviceInfoPtr info,
void *opaque) void *opaque)
{ {
int ret = -1; int ret = -1;
char *addr = NULL; char *addr = NULL;
qemuDomainPCIAddressSetPtr addrs = opaque; qemuDomainPCIAddressSetPtr addrs = opaque;
if (dev->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) if (info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)
return 0; return 0;
addr = qemuPCIAddressAsString(dev); addr = qemuPCIAddressAsString(info);
if (!addr) if (!addr)
goto cleanup; goto cleanup;
if (virHashLookup(addrs->used, addr)) { if (virHashLookup(addrs->used, addr)) {
if (dev->addr.pci.function != 0) { if (info->addr.pci.function != 0) {
qemuReportError(VIR_ERR_XML_ERROR, qemuReportError(VIR_ERR_XML_ERROR,
_("Attempted double use of PCI Address '%s' " _("Attempted double use of PCI Address '%s' "
"(may need \"multifunction='on'\" for device on function 0"), "(may need \"multifunction='on'\" for device on function 0"),
@ -865,15 +865,15 @@ static int qemuCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED,
goto cleanup; goto cleanup;
addr = NULL; addr = NULL;
if ((dev->addr.pci.function == 0) && if ((info->addr.pci.function == 0) &&
(dev->addr.pci.multi != VIR_DOMAIN_DEVICE_ADDRESS_PCI_MULTI_ON)) { (info->addr.pci.multi != VIR_DOMAIN_DEVICE_ADDRESS_PCI_MULTI_ON)) {
/* a function 0 w/o multifunction=on must reserve the entire slot */ /* a function 0 w/o multifunction=on must reserve the entire slot */
int function; int function;
virDomainDeviceInfo temp_dev = *dev; virDomainDeviceInfo temp_info = *info;
for (function = 1; function < QEMU_PCI_ADDRESS_LAST_FUNCTION; function++) { for (function = 1; function < QEMU_PCI_ADDRESS_LAST_FUNCTION; function++) {
temp_dev.addr.pci.function = function; temp_info.addr.pci.function = function;
addr = qemuPCIAddressAsString(&temp_dev); addr = qemuPCIAddressAsString(&temp_info);
if (!addr) if (!addr)
goto cleanup; goto cleanup;

View File

@ -1481,17 +1481,17 @@ static inline int qemuFindDisk(virDomainDefPtr def, const char *dst)
} }
static int qemuComparePCIDevice(virDomainDefPtr def ATTRIBUTE_UNUSED, static int qemuComparePCIDevice(virDomainDefPtr def ATTRIBUTE_UNUSED,
virDomainDeviceInfoPtr dev1, virDomainDeviceInfoPtr info1,
void *opaque) void *opaque)
{ {
virDomainDeviceInfoPtr dev2 = opaque; virDomainDeviceInfoPtr info2 = opaque;
if (dev1->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI || if (info1->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI ||
dev2->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) info2->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)
return 0; return 0;
if (dev1->addr.pci.slot == dev2->addr.pci.slot && if (info1->addr.pci.slot == info2->addr.pci.slot &&
dev1->addr.pci.function != dev2->addr.pci.function) info1->addr.pci.function != info2->addr.pci.function)
return -1; return -1;
return 0; return 0;
} }