qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
	armbru@redhat.com, "Luiz Capitulino" <lcapitulino@redhat.com>
Subject: [Qemu-devel] [PATCH for-2.5 3/4] monitor: use qapi for qmp_capabilities command
Date: Wed, 11 Nov 2015 18:17:41 -0700	[thread overview]
Message-ID: <1447291062-11011-4-git-send-email-eblake@redhat.com> (raw)
In-Reply-To: <1447291062-11011-1-git-send-email-eblake@redhat.com>

From: Marc-André Lureau <marcandre.lureau@redhat.com>

This was initially done to add qmp_capabilities documentation to the
schema. Then I figured it would also help to get rid of the "middle
mode" monitor dispatch code.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <1443189844-20341-5-git-send-email-marcandre.lureau@redhat.com>
[Add empty 'Capabilities' to make it obvious that we don't have any yet.]
Signed-off-by: Eric Blake <eblake@redhat.com>
---
 monitor.c        |  4 ++--
 qapi-schema.json | 28 ++++++++++++++++++++++++++++
 qmp-commands.hx  |  2 +-
 3 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/monitor.c b/monitor.c
index 3295840..608c70f 100644
--- a/monitor.c
+++ b/monitor.c
@@ -599,7 +599,7 @@ static void monitor_qapi_event_init(void)
     qmp_event_set_func_emit(monitor_qapi_event_queue);
 }

-static void qmp_capabilities(QDict *params, QObject **ret_data, Error **errp)
+void qmp_qmp_capabilities(Error **errp)
 {
     cur_mon->qmp.in_command_mode = true;
 }
@@ -3575,7 +3575,7 @@ static int monitor_can_read(void *opaque)
 static bool invalid_qmp_mode(const Monitor *mon, const mon_cmd_t *cmd,
                              Error **errp)
 {
-    bool is_cap = cmd->mhandler.cmd_new == qmp_capabilities;
+    bool is_cap = cmd->mhandler.cmd_new == qmp_marshal_qmp_capabilities;

     if (is_cap && mon->qmp.in_command_mode) {
         error_set(errp, ERROR_CLASS_COMMAND_NOT_FOUND,
diff --git a/qapi-schema.json b/qapi-schema.json
index f99d413..ce2dd45 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -21,6 +21,34 @@
 { 'include': 'qapi/introspect.json' }

 ##
+# @Capabilities
+#
+# The set of recognized QMP capabilities; currently empty.
+#
+# Since 2.5
+##
+{ 'struct': 'Capabilities', 'data': {} }
+
+##
+# @qmp_capabilities:
+#
+# Enable QMP capabilities.
+#
+# Arguments: None.
+#
+# Example:
+#
+# -> { "execute": "qmp_capabilities" }
+# <- { "return": {} }
+#
+# Notes: This command must be issued before issuing any other command.
+#
+# Since 0.14
+#
+##
+{ 'command': 'qmp_capabilities', 'data': 'Capabilities' }
+
+##
 # @LostTickPolicy:
 #
 # Policy for handling lost ticks in timer devices.
diff --git a/qmp-commands.hx b/qmp-commands.hx
index cde7505..672fcfc 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -2090,7 +2090,7 @@ EQMP
         .args_type  = "",
         .params     = "",
         .help       = "enable QMP capabilities",
-        .mhandler.cmd_new = qmp_capabilities,
+        .mhandler.cmd_new = qmp_marshal_qmp_capabilities,
     },

 SQMP
-- 
2.4.3

  parent reply	other threads:[~2015-11-12  1:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-12  1:17 [Qemu-devel] [PATCH for-2.5 0/4] Expose ErrorClass through introspection Eric Blake
2015-11-12  1:17 ` [Qemu-devel] [PATCH for-2.5 1/4] qapi: Add type.is_empty() helper Eric Blake
2015-11-12  1:17 ` [Qemu-devel] [PATCH for-2.5 2/4] qapi: Fix command with named empty argument type Eric Blake
2015-11-12  1:17 ` Eric Blake [this message]
2015-11-12  1:17 ` [Qemu-devel] [PATCH for-2.5 4/4] qapi: Expose ErrorClass through introspection Eric Blake
2015-11-12 10:48 ` [Qemu-devel] [PATCH for-2.5 0/4] " Markus Armbruster
2015-11-12 13:28   ` Eric Blake
2015-11-12 10:48 ` Markus Armbruster
2015-11-12 13:37   ` Eric Blake

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=1447291062-11011-4-git-send-email-eblake@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).