0a7476
From b0664bfa45b1615cab1c66d502018e1c23d32529 Mon Sep 17 00:00:00 2001
0a7476
Message-Id: <b0664bfa45b1615cab1c66d502018e1c23d32529@dist-git>
0a7476
From: Laine Stump <laine@laine.org>
0a7476
Date: Thu, 11 Apr 2019 15:14:45 -0400
0a7476
Subject: [PATCH] qemu_hotplug: rename dev to match in
0a7476
 qemuDomainDetachDeviceLive
0a7476
0a7476
I'm about to add a second virDomainDeviceDef to this function that
0a7476
will point to the actual device in the domain object. while this is
0a7476
just a partially filled-in example of what to look for. Naming it
0a7476
match will make the code easier to follow.
0a7476
0a7476
Signed-off-by: Laine Stump <laine@laine.org>
0a7476
ACKed-by: Peter Krempa <pkrempa@redhat.com>
0a7476
(cherry picked from commit c4d6a121a8e903dc8d012d6737fd308b3ddec31a)
0a7476
0a7476
Partially-Resolves: https://bugzilla.redhat.com/1658198
0a7476
Signed-off-by: Laine Stump <laine@redhat.com>
0a7476
Signed-off-by: Laine Stump <laine@laine.org>
0a7476
Message-Id: <20190411191453.24055-34-laine@redhat.com>
0a7476
Acked-by: Michal Privoznik <mprivozn@redhat.com>
0a7476
---
0a7476
 src/qemu/qemu_hotplug.c | 32 ++++++++++++++++----------------
0a7476
 src/qemu/qemu_hotplug.h |  2 +-
0a7476
 2 files changed, 17 insertions(+), 17 deletions(-)
0a7476
0a7476
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
0a7476
index b0f45708ae..a655fc391f 100644
0a7476
--- a/src/qemu/qemu_hotplug.c
0a7476
+++ b/src/qemu/qemu_hotplug.c
0a7476
@@ -5650,52 +5650,52 @@ qemuDomainDetachLease(virQEMUDriverPtr driver,
0a7476
 
0a7476
 int
0a7476
 qemuDomainDetachDeviceLive(virDomainObjPtr vm,
0a7476
-                           virDomainDeviceDefPtr dev,
0a7476
+                           virDomainDeviceDefPtr match,
0a7476
                            virQEMUDriverPtr driver,
0a7476
                            bool async)
0a7476
 {
0a7476
     int ret = -1;
0a7476
 
0a7476
-    switch ((virDomainDeviceType)dev->type) {
0a7476
+    switch ((virDomainDeviceType)match->type) {
0a7476
     case VIR_DOMAIN_DEVICE_DISK:
0a7476
-        ret = qemuDomainDetachDeviceDiskLive(driver, vm, dev, async);
0a7476
+        ret = qemuDomainDetachDeviceDiskLive(driver, vm, match, async);
0a7476
         break;
0a7476
     case VIR_DOMAIN_DEVICE_CONTROLLER:
0a7476
-        ret = qemuDomainDetachControllerDevice(driver, vm, dev, async);
0a7476
+        ret = qemuDomainDetachControllerDevice(driver, vm, match, async);
0a7476
         break;
0a7476
     case VIR_DOMAIN_DEVICE_LEASE:
0a7476
-        ret = qemuDomainDetachLease(driver, vm, dev->data.lease);
0a7476
+        ret = qemuDomainDetachLease(driver, vm, match->data.lease);
0a7476
         break;
0a7476
     case VIR_DOMAIN_DEVICE_NET:
0a7476
-        ret = qemuDomainDetachNetDevice(driver, vm, dev, async);
0a7476
+        ret = qemuDomainDetachNetDevice(driver, vm, match, async);
0a7476
         break;
0a7476
     case VIR_DOMAIN_DEVICE_HOSTDEV:
0a7476
-        ret = qemuDomainDetachHostDevice(driver, vm, dev, async);
0a7476
+        ret = qemuDomainDetachHostDevice(driver, vm, match, async);
0a7476
         break;
0a7476
     case VIR_DOMAIN_DEVICE_CHR:
0a7476
-        ret = qemuDomainDetachChrDevice(driver, vm, dev->data.chr, async);
0a7476
+        ret = qemuDomainDetachChrDevice(driver, vm, match->data.chr, async);
0a7476
         break;
0a7476
     case VIR_DOMAIN_DEVICE_RNG:
0a7476
-        ret = qemuDomainDetachRNGDevice(driver, vm, dev->data.rng, async);
0a7476
+        ret = qemuDomainDetachRNGDevice(driver, vm, match->data.rng, async);
0a7476
         break;
0a7476
     case VIR_DOMAIN_DEVICE_MEMORY:
0a7476
-        ret = qemuDomainDetachMemoryDevice(driver, vm, dev->data.memory, async);
0a7476
+        ret = qemuDomainDetachMemoryDevice(driver, vm, match->data.memory, async);
0a7476
         break;
0a7476
     case VIR_DOMAIN_DEVICE_SHMEM:
0a7476
-        ret = qemuDomainDetachShmemDevice(driver, vm, dev->data.shmem, async);
0a7476
+        ret = qemuDomainDetachShmemDevice(driver, vm, match->data.shmem, async);
0a7476
         break;
0a7476
     case VIR_DOMAIN_DEVICE_WATCHDOG:
0a7476
-        ret = qemuDomainDetachWatchdog(driver, vm, dev->data.watchdog, async);
0a7476
+        ret = qemuDomainDetachWatchdog(driver, vm, match->data.watchdog, async);
0a7476
         break;
0a7476
     case VIR_DOMAIN_DEVICE_INPUT:
0a7476
-        ret = qemuDomainDetachInputDevice(vm, dev->data.input, async);
0a7476
+        ret = qemuDomainDetachInputDevice(vm, match->data.input, async);
0a7476
         break;
0a7476
     case VIR_DOMAIN_DEVICE_REDIRDEV:
0a7476
-        ret = qemuDomainDetachRedirdevDevice(driver, vm, dev->data.redirdev, async);
0a7476
+        ret = qemuDomainDetachRedirdevDevice(driver, vm, match->data.redirdev, async);
0a7476
         break;
0a7476
 
0a7476
     case VIR_DOMAIN_DEVICE_VSOCK:
0a7476
-        ret = qemuDomainDetachVsockDevice(vm, dev->data.vsock, async);
0a7476
+        ret = qemuDomainDetachVsockDevice(vm, match->data.vsock, async);
0a7476
         break;
0a7476
 
0a7476
     case VIR_DOMAIN_DEVICE_FS:
0a7476
@@ -5713,7 +5713,7 @@ qemuDomainDetachDeviceLive(virDomainObjPtr vm,
0a7476
     case VIR_DOMAIN_DEVICE_LAST:
0a7476
         virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
0a7476
                        _("live detach of device '%s' is not supported"),
0a7476
-                       virDomainDeviceTypeToString(dev->type));
0a7476
+                       virDomainDeviceTypeToString(match->type));
0a7476
         break;
0a7476
     }
0a7476
 
0a7476
diff --git a/src/qemu/qemu_hotplug.h b/src/qemu/qemu_hotplug.h
0a7476
index e8e4934db8..699d61877f 100644
0a7476
--- a/src/qemu/qemu_hotplug.h
0a7476
+++ b/src/qemu/qemu_hotplug.h
0a7476
@@ -117,7 +117,7 @@ int qemuDomainAttachRNGDevice(virQEMUDriverPtr driver,
0a7476
                               virDomainRNGDefPtr rng);
0a7476
 
0a7476
 int qemuDomainDetachDeviceLive(virDomainObjPtr vm,
0a7476
-                               virDomainDeviceDefPtr dev,
0a7476
+                               virDomainDeviceDefPtr match,
0a7476
                                virQEMUDriverPtr driver,
0a7476
                                bool async);
0a7476
 
0a7476
-- 
0a7476
2.21.0
0a7476