1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

qemu: Clean up qemuDomainAttachHostPCIDevice()

We use hostdev->info frequently enough that having
a shorter name for it makes the code more readable.
We will also be adding even more uses later on.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Laine Stump <laine@laine.org>
This commit is contained in:
Andrea Bolognani 2017-06-05 15:29:40 +02:00
parent c949f6e69c
commit 7654217232

View File

@ -1398,6 +1398,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
qemuDomainObjPrivatePtr priv = vm->privateData;
virDomainDeviceDef dev = { VIR_DOMAIN_DEVICE_HOSTDEV,
{ .hostdev = hostdev } };
virDomainDeviceInfoPtr info = hostdev->info;
int ret;
char *devstr = NULL;
int configfd = -1;
@ -1470,7 +1471,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
if (backend != VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO)
teardownlabel = true;
if (qemuAssignDeviceHostdevAlias(vm->def, &hostdev->info->alias, -1) < 0)
if (qemuAssignDeviceHostdevAlias(vm->def, &info->alias, -1) < 0)
goto error;
if (qemuDomainEnsurePCIAddress(vm, &dev, driver) < 0)
goto error;
@ -1479,8 +1480,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_PCI_CONFIGFD)) {
configfd = qemuOpenPCIConfig(hostdev);
if (configfd >= 0) {
if (virAsprintf(&configfd_name, "fd-%s",
hostdev->info->alias) < 0)
if (virAsprintf(&configfd_name, "fd-%s", info->alias) < 0)
goto error;
}
}
@ -1525,7 +1525,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
VIR_WARN("Unable to remove host device from /dev");
if (releaseaddr)
qemuDomainReleaseDeviceAddress(vm, hostdev->info, NULL);
qemuDomainReleaseDeviceAddress(vm, info, NULL);
qemuHostdevReAttachPCIDevices(driver, vm->def->name, &hostdev, 1);