Async QEMU process events are normally completed through
qemuProcessEventHandler(). Tests that exercise DEVICE_DELETED completion
need to drive that same path instead of mirroring the production logic locally.

Move the declaration to a guarded private header and make the handler
non-static so test code can wire it into a test worker pool. This does not
change runtime behaviour.

Signed-off-by: Akash Kulhalli <[email protected]>
---
 src/qemu/qemu_driver.c     |  9 +++++----
 src/qemu/qemu_driverpriv.h | 27 +++++++++++++++++++++++++++
 2 files changed, 32 insertions(+), 4 deletions(-)
 create mode 100644 src/qemu/qemu_driverpriv.h

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index eda1f42054af..c6d18f6575b7 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -31,6 +31,8 @@
 #include <sys/ioctl.h>
 
 #include "qemu_driver.h"
+#define LIBVIRT_QEMU_DRIVERPRIV_H_ALLOW
+#include "qemu_driverpriv.h"
 #include "qemu_agent.h"
 #include "qemu_alias.h"
 #include "qemu_block.h"
@@ -139,9 +141,6 @@ VIR_ENUM_IMPL(qemuDumpFormat,
               "win-dmp",
 );
 
-
-static void qemuProcessEventHandler(void *data, void *opaque);
-
 static int qemuStateCleanup(void);
 
 static int qemuDomainObjStart(virConnectPtr conn,
@@ -4149,7 +4148,9 @@ processShutdownCompletedEvent(virDomainObj *vm)
 }
 
 
-static void qemuProcessEventHandler(void *data, void *opaque)
+void
+qemuProcessEventHandler(void *data,
+                        void *opaque)
 {
     struct qemuProcessEvent *processEvent = data;
     virDomainObj *vm = processEvent->vm;
diff --git a/src/qemu/qemu_driverpriv.h b/src/qemu/qemu_driverpriv.h
new file mode 100644
index 000000000000..4fb0cc22b026
--- /dev/null
+++ b/src/qemu/qemu_driverpriv.h
@@ -0,0 +1,27 @@
+/*
+ * qemu_driverpriv.h: private declarations for QEMU driver internals
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef LIBVIRT_QEMU_DRIVERPRIV_H_ALLOW
+# error "qemu_driverpriv.h may only be included by qemu_driver.c or test 
suites"
+#endif /* LIBVIRT_QEMU_DRIVERPRIV_H_ALLOW */
+
+#pragma once
+
+void
+qemuProcessEventHandler(void *data,
+                        void *opaque);
-- 
2.47.3

Reply via email to