From: Marc-André Lureau <marcandre.lureau@redhat.com>
The monitor is specific to QEMU. Instead of passing a Monitor type
argument to the exec handler, use a generic void* pointer. This simplify
also the unit dependency, as now the dispatching code is free from
QEMU-specifics.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
include/qapi/qmp/dispatch.h | 5 ++---
monitor/qmp.c | 3 ++-
qapi/qmp-dispatch.c | 4 ++--
stubs/qmp-dispatch-exec.c | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/include/qapi/qmp/dispatch.h b/include/qapi/qmp/dispatch.h
index 6941a759a7..ee8a05015a 100644
--- a/include/qapi/qmp/dispatch.h
+++ b/include/qapi/qmp/dispatch.h
@@ -14,7 +14,6 @@
#ifndef QAPI_QMP_DISPATCH_H
#define QAPI_QMP_DISPATCH_H
-#include "monitor/monitor.h"
#include "qemu/queue.h"
typedef void (QmpCommandFunc)(QDict *, QObject **, Error **);
@@ -41,7 +40,7 @@ typedef struct QmpCommand
typedef QTAILQ_HEAD(QmpCommandList, QmpCommand) QmpCommandList;
-void qmp_dispatch_exec(const QmpCommand *cmd, bool oob, Monitor *cur_mon,
+void qmp_dispatch_exec(const QmpCommand *cmd, bool oob, void *exec_data,
QDict *args, QObject **ret, Error **err);
void qmp_register_command(QmpCommandList *cmds, const char *name,
@@ -59,7 +58,7 @@ const char *qmp_command_name(const QmpCommand *cmd);
bool qmp_has_success_response(const QmpCommand *cmd);
QDict *qmp_error_response(Error *err);
QDict *qmp_dispatch(const QmpCommandList *cmds, QObject *request,
- bool allow_oob, Monitor *cur_mon);
+ bool allow_oob, void *exec_data);
bool qmp_is_oob(const QDict *dict);
typedef void (*qmp_cmd_callback_fn)(const QmpCommand *cmd, void *opaque);
diff --git a/monitor/qmp.c b/monitor/qmp.c
index b9b109a40a..4f0eb6e200 100644
--- a/monitor/qmp.c
+++ b/monitor/qmp.c
@@ -156,9 +156,10 @@ static void do_qmp_dispatch_bh(void *opaque)
* Runs outside of coroutine context for OOB commands, but in coroutine
* context for everything else.
*/
-void qmp_dispatch_exec(const QmpCommand *cmd, bool oob, Monitor *cur_mon,
+void qmp_dispatch_exec(const QmpCommand *cmd, bool oob, void *exec_data,
QDict *args, QObject **ret, Error **errp)
{
+ Monitor *cur_mon = exec_data;
assert(!(oob && qemu_in_coroutine()));
assert(monitor_cur() == NULL);
diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c
index bec07e4958..2fea789fd3 100644
--- a/qapi/qmp-dispatch.c
+++ b/qapi/qmp-dispatch.c
@@ -108,7 +108,7 @@ bool qmp_is_oob(const QDict *dict)
}
QDict *qmp_dispatch(const QmpCommandList *cmds, QObject *request,
- bool allow_oob, Monitor *cur_mon)
+ bool allow_oob, void *exec_data)
{
Error *err = NULL;
bool oob;
@@ -176,7 +176,7 @@ QDict *qmp_dispatch(const QmpCommandList *cmds, QObject *request,
qobject_ref(args);
}
- qmp_dispatch_exec(cmd, oob, cur_mon, args, &ret, &err);
+ qmp_dispatch_exec(cmd, oob, exec_data, args, &ret, &err);
qobject_unref(args);
if (err) {
diff --git a/stubs/qmp-dispatch-exec.c b/stubs/qmp-dispatch-exec.c
index 4aef28d198..4740f55222 100644
--- a/stubs/qmp-dispatch-exec.c
+++ b/stubs/qmp-dispatch-exec.c
@@ -1,7 +1,7 @@
#include "qemu/osdep.h"
#include "qapi/qmp/dispatch.h"
-void qmp_dispatch_exec(const QmpCommand *cmd, bool oob, Monitor *cur_mon,
+void qmp_dispatch_exec(const QmpCommand *cmd, bool oob, void *exec_data,
QDict *args, QObject **ret, Error **err)
{
cmd->fn(args, ret, err);
--
2.37.1