All of lore.kernel.org
 help / color / mirror / Atom feed
From: marcandre.lureau@redhat.com
To: qemu-devel@nongnu.org
Cc: "Markus Armbruster" <armbru@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Cleber Rosa" <crosa@redhat.com>,
	"Michael Roth" <michael.roth@amd.com>,
	"John Snow" <jsnow@redhat.com>,
	"Xie Yongji" <xieyongji@bytedance.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [PATCH v3 07/16] qapi: remove QEMU-specific monitor dependency from dispatch
Date: Wed, 10 Aug 2022 16:48:48 +0400	[thread overview]
Message-ID: <20220810124857.1360211-8-marcandre.lureau@redhat.com> (raw)
In-Reply-To: <20220810124857.1360211-1-marcandre.lureau@redhat.com>

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



  parent reply	other threads:[~2022-08-10 13:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-10 12:48 [PATCH v3 00/16] Preliminary patches for subproject split marcandre.lureau
2022-08-10 12:48 ` [PATCH v3 01/16] error-report: misc comment fix marcandre.lureau
2022-08-10 12:48 ` [PATCH v3 02/16] error-report: introduce "detailed" variable marcandre.lureau
2022-08-10 12:48 ` [PATCH v3 03/16] error-report: simplify print_loc() marcandre.lureau
2022-08-10 12:48 ` [PATCH v3 04/16] error-report: introduce overridable error_is_detailed() marcandre.lureau
2022-08-10 12:48 ` [PATCH v3 05/16] stubs: remove needless error_vprintf_unless_qmp() marcandre.lureau
2022-08-10 12:48 ` [PATCH v3 06/16] qapi: move QEMU-specific dispatch code in monitor marcandre.lureau
2022-08-10 12:48 ` marcandre.lureau [this message]
2022-08-10 12:48 ` [PATCH v3 08/16] scripts/qapi-gen: add -i option marcandre.lureau
2022-08-10 12:48 ` [PATCH v3 09/16] scripts/qapi: add required system includes to visitor marcandre.lureau
2022-08-10 12:48 ` [PATCH v3 10/16] util: move 256-by-128 division helpers to int128 marcandre.lureau
2022-08-10 12:48 ` [PATCH v3 11/16] qemu-common: introduce a common subproject marcandre.lureau
2022-08-10 12:48 ` [PATCH v3 12/16] qemu-common: move scripts/qapi marcandre.lureau
2022-08-10 12:48 ` [PATCH v3 13/16] qemu-common: move glib-compat.h marcandre.lureau
2022-08-10 12:48 ` [PATCH v3 14/16] qemu-common: move error-report marcandre.lureau
2022-08-10 12:48 ` [PATCH v3 15/16] mtest2make.py: teach suite name that are just "PROJECT" marcandre.lureau
2022-08-10 12:48 ` [PATCH v3 16/16] qemu-common: add error-report test marcandre.lureau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220810124857.1360211-8-marcandre.lureau@redhat.com \
    --to=marcandre.lureau@redhat.com \
    --cc=armbru@redhat.com \
    --cc=crosa@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=michael.roth@amd.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=xieyongji@bytedance.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.