[PATCH 2/3] qemu: revise qemuDomainFindGraphics to be reused in the future patch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We want to use qemuDomainFindGraphics in the qemuDomainUpdateDeviceConfig in
a future patch. So adjust its parameter.

Signed-off-by: Wang Rui <moon.wangrui@xxxxxxxxxx>
---
 src/qemu/qemu_hotplug.c | 13 ++++++-------
 src/qemu/qemu_hotplug.h |  3 +++
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 1c75861..d39ed54 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2297,15 +2297,14 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
 }
 
 
-
-static virDomainGraphicsDefPtr qemuDomainFindGraphics(virDomainObjPtr vm,
-                                                      virDomainGraphicsDefPtr dev)
+virDomainGraphicsDefPtr
+qemuDomainFindGraphics(virDomainDefPtr def, virDomainGraphicsDefPtr dev)
 {
     size_t i;
 
-    for (i = 0; i < vm->def->ngraphics; i++) {
-        if (vm->def->graphics[i]->type == dev->type)
-            return vm->def->graphics[i];
+    for (i = 0; i < def->ngraphics; i++) {
+        if (def->graphics[i]->type == dev->type)
+            return def->graphics[i];
     }
 
     return NULL;
@@ -2317,7 +2316,7 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
                          virDomainObjPtr vm,
                          virDomainGraphicsDefPtr dev)
 {
-    virDomainGraphicsDefPtr olddev = qemuDomainFindGraphics(vm, dev);
+    virDomainGraphicsDefPtr olddev = qemuDomainFindGraphics(vm->def, dev);
     int ret = -1;
     virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
     size_t i;
diff --git a/src/qemu/qemu_hotplug.h b/src/qemu/qemu_hotplug.h
index 1c9ca8f..176fde0 100644
--- a/src/qemu/qemu_hotplug.h
+++ b/src/qemu/qemu_hotplug.h
@@ -55,6 +55,9 @@ int qemuDomainAttachHostDevice(virConnectPtr conn,
                                virQEMUDriverPtr driver,
                                virDomainObjPtr vm,
                                virDomainHostdevDefPtr hostdev);
+virDomainGraphicsDefPtr
+qemuDomainFindGraphics(virDomainDefPtr def,
+                       virDomainGraphicsDefPtr dev);
 int qemuDomainChangeGraphics(virQEMUDriverPtr driver,
                              virDomainObjPtr vm,
                              virDomainGraphicsDefPtr dev);
-- 
1.7.12.4


--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]