From: Luiz Capitulino <lcapitulino@redhat.com>
To: qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com, armbru@redhat.com
Subject: [Qemu-devel] [PATCH 2/4] QMP: Introduce the qmp_capabilities command
Date: Thu, 4 Feb 2010 18:10:05 -0200 [thread overview]
Message-ID: <1265314207-6323-3-git-send-email-lcapitulino@redhat.com> (raw)
In-Reply-To: <1265314207-6323-1-git-send-email-lcapitulino@redhat.com>
This command will be used to enable QMP capabilities advertised
by the capabilities array.
Note that it will be mandatory to issue this command in order
to make QMP functional (although this behavior is not being
enforced by this commit).
Also, as we don't have any capabilities yet, the new command
doesn't accept any arguments. I will postpone the decision for
a format for this until we get our first capability.
Finally, this command is visible from the user Monitor too, in
the meaning that you can execute it but it won't do anything.
Making it only visible in QMP is beyond this series' goal, as
it requires changes in unrelated places.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
monitor.c | 11 +++++++++++
qemu-monitor.hx | 14 ++++++++++++++
2 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/monitor.c b/monitor.c
index ec1d11e..94fc685 100644
--- a/monitor.c
+++ b/monitor.c
@@ -122,6 +122,7 @@ typedef struct MonitorControl {
QObject *id;
int print_enabled;
JSONMessageParser parser;
+ int command_mode;
} MonitorControl;
struct Monitor {
@@ -409,6 +410,15 @@ void monitor_protocol_event(MonitorEvent event, QObject *data)
QDECREF(qmp);
}
+static void do_qmp_capabilities(Monitor *mon, const QDict *params,
+ QObject **ret_data)
+{
+ /* Will setup QMP capabilities in the future */
+ if (monitor_ctrl_mode(mon)) {
+ mon->mc->command_mode = 1;
+ }
+}
+
static int compare_cmd(const char *name, const char *list)
{
const char *p, *pstart;
@@ -4382,6 +4392,7 @@ static void monitor_control_event(void *opaque, int event)
QObject *data;
Monitor *mon = opaque;
+ mon->mc->command_mode = 0;
json_message_parser_init(&mon->mc->parser, handle_qmp_command);
data = get_qmp_greeting();
diff --git a/qemu-monitor.hx b/qemu-monitor.hx
index e5bff8e..8edbf23 100644
--- a/qemu-monitor.hx
+++ b/qemu-monitor.hx
@@ -1066,6 +1066,20 @@ STEXI
Set the encrypted device @var{device} password to @var{password}
ETEXI
+ {
+ .name = "qmp_capabilities",
+ .args_type = "",
+ .params = "",
+ .help = "enable QMP capabilities",
+ .user_print = monitor_user_noop,
+ .mhandler.cmd_new = do_qmp_capabilities,
+ },
+
+STEXI
+@item qmp_capabilities
+Enable the specified QMP capabilities
+ETEXI
+
STEXI
@end table
ETEXI
--
1.6.6
next prev parent reply other threads:[~2010-02-04 20:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-04 20:10 [Qemu-devel] [PATCH v2 0/4]: QMP capability negotiation support Luiz Capitulino
2010-02-04 20:10 ` [Qemu-devel] [PATCH 1/4] QMP: Add QEMU's version to the greeting message Luiz Capitulino
2010-02-10 19:29 ` Anthony Liguori
2010-02-04 20:10 ` Luiz Capitulino [this message]
2010-02-04 20:10 ` [Qemu-devel] [PATCH 3/4] QMP: Enforce capability negotiation rules Luiz Capitulino
2010-02-04 20:10 ` [Qemu-devel] [PATCH 4/4] QMP: spec: Capability negotiation updates Luiz Capitulino
2010-02-05 9:08 ` [Qemu-devel] [PATCH v2 0/4]: QMP capability negotiation support Markus Armbruster
-- strict thread matches above, loose matches on Subject: below --
2010-02-04 14:24 [Qemu-devel] [PATCH v1 " Luiz Capitulino
2010-02-04 14:24 ` [Qemu-devel] [PATCH 2/4] QMP: Introduce the qmp_capabilities command Luiz Capitulino
2010-02-04 16:40 ` Markus Armbruster
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=1265314207-6323-3-git-send-email-lcapitulino@redhat.com \
--to=lcapitulino@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=armbru@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).