qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: aliguori@us.ibm.com
Cc: mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 06/19] qapi: Convert the cpu command
Date: Thu, 27 Oct 2011 17:02:03 -0200	[thread overview]
Message-ID: <1319742136-8691-7-git-send-email-lcapitulino@redhat.com> (raw)
In-Reply-To: <1319742136-8691-1-git-send-email-lcapitulino@redhat.com>

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 hmp-commands.hx  |    3 +--
 hmp.c            |   12 ++++++++++++
 hmp.h            |    1 +
 monitor.c        |   11 -----------
 qapi-schema.json |   11 +++++++++++
 qmp-commands.hx  |    5 +----
 qmp.c            |    5 +++++
 7 files changed, 31 insertions(+), 17 deletions(-)

diff --git a/hmp-commands.hx b/hmp-commands.hx
index ab08d58..969ccf5 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -587,8 +587,7 @@ ETEXI
         .args_type  = "index:i",
         .params     = "index",
         .help       = "set the default CPU",
-        .user_print = monitor_user_noop,
-        .mhandler.cmd_new = do_cpu_set,
+        .mhandler.cmd = hmp_cpu,
     },
 
 STEXI
diff --git a/hmp.c b/hmp.c
index 619b8ba..35b0ca0 100644
--- a/hmp.c
+++ b/hmp.c
@@ -165,3 +165,15 @@ void hmp_system_powerdown(Monitor *mon, const QDict *qdict)
 {
     qmp_system_powerdown(NULL);
 }
+
+void hmp_cpu(Monitor *mon, const QDict *qdict)
+{
+    int64_t cpu_index;
+
+    /* XXX: drop the monitor_set_cpu() usage when all HMP commands that
+            use it are converted to the QAPI */
+    cpu_index = qdict_get_int(qdict, "index");
+    if (monitor_set_cpu(cpu_index) < 0) {
+        monitor_printf(mon, "invalid CPU index\n");
+    }
+}
diff --git a/hmp.h b/hmp.h
index 49d9662..9322b7f 100644
--- a/hmp.h
+++ b/hmp.h
@@ -29,5 +29,6 @@ void hmp_quit(Monitor *mon, const QDict *qdict);
 void hmp_stop(Monitor *mon, const QDict *qdict);
 void hmp_system_reset(Monitor *mon, const QDict *qdict);
 void hmp_system_powerdown(Monitor *mon, const QDict *qdict);
+void hmp_cpu(Monitor *mon, const QDict *qdict);
 
 #endif
diff --git a/monitor.c b/monitor.c
index 3e1cd33..1edb646 100644
--- a/monitor.c
+++ b/monitor.c
@@ -902,17 +902,6 @@ static void do_info_cpus(Monitor *mon, QObject **ret_data)
     *ret_data = QOBJECT(cpu_list);
 }
 
-static int do_cpu_set(Monitor *mon, const QDict *qdict, QObject **ret_data)
-{
-    int index = qdict_get_int(qdict, "index");
-    if (monitor_set_cpu(index) < 0) {
-        qerror_report(QERR_INVALID_PARAMETER_VALUE, "index",
-                      "a CPU number");
-        return -1;
-    }
-    return 0;
-}
-
 static void do_info_jit(Monitor *mon)
 {
     dump_exec_info((FILE *)mon, monitor_fprintf);
diff --git a/qapi-schema.json b/qapi-schema.json
index eb155b4..e4cf6da 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -351,3 +351,14 @@
 #        prompting the user in some way.
 ##
 { 'command': 'system_powerdown' }
+
+##
+# @cpu:
+#
+# This command is a nop that is only provided for the purposes of compatibility.
+#
+# Since: 0.14.0
+#
+# Notes: Do not use this command.
+##
+{ 'command': 'cpu', 'data': {'index': 'int'} }
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 8efdb25..dcca53c 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -331,10 +331,7 @@ EQMP
     {
         .name       = "cpu",
         .args_type  = "index:i",
-        .params     = "index",
-        .help       = "set the default CPU",
-        .user_print = monitor_user_noop,
-        .mhandler.cmd_new = do_cpu_set,
+        .mhandler.cmd_new = qmp_marshal_input_cpu,
     },
 
 SQMP
diff --git a/qmp.c b/qmp.c
index bf58b05..e84922b 100644
--- a/qmp.c
+++ b/qmp.c
@@ -90,3 +90,8 @@ void qmp_system_powerdown(Error **erp)
 {
     qemu_system_powerdown_request();
 }
+
+void qmp_cpu(int64_t index, Error **errp)
+{
+    /* Just do nothing */
+}
-- 
1.7.7.1.475.g997a1

  parent reply	other threads:[~2011-10-27 19:02 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-27 19:01 [Qemu-devel] [PULL 00/19]: QMP queue Luiz Capitulino
2011-10-27 19:01 ` [Qemu-devel] [PATCH 01/19] qapi-commands.py: Don't call the output marshal on error Luiz Capitulino
2011-10-27 19:01 ` [Qemu-devel] [PATCH 02/19] qapi: Convert query-mice Luiz Capitulino
2011-10-27 19:02 ` [Qemu-devel] [PATCH 03/19] qapi: Convert query-migrate Luiz Capitulino
2011-10-27 19:02 ` [Qemu-devel] [PATCH 04/19] Monitor: Make mon_set_cpu() public Luiz Capitulino
2011-10-27 19:02 ` [Qemu-devel] [PATCH 05/19] Monitor: Introduce monitor_get_cpu_index() Luiz Capitulino
2011-10-27 19:02 ` Luiz Capitulino [this message]
2011-10-27 19:02 ` [Qemu-devel] [PATCH 07/19] qapi: Convert query-cpus Luiz Capitulino
2011-10-27 19:02 ` [Qemu-devel] [PATCH 08/19] block: iostatus: Drop BDRV_IOS_INVAL Luiz Capitulino
2011-10-27 19:02 ` [Qemu-devel] [PATCH 09/19] block: Rename the BlockIOStatus enum values Luiz Capitulino
2011-10-27 19:02 ` [Qemu-devel] [PATCH 10/19] qapi: Convert query-block Luiz Capitulino
2011-10-27 19:02 ` [Qemu-devel] [PATCH 11/19] qapi: Convert query-blockstats Luiz Capitulino
2011-10-27 19:02 ` [Qemu-devel] [PATCH 12/19] qerror: Add a user string for QERR_FEATURE_DISABLED Luiz Capitulino
2011-10-27 19:02 ` [Qemu-devel] [PATCH 13/19] qapi: Convert query-vnc Luiz Capitulino
2011-10-27 19:02 ` [Qemu-devel] [PATCH 14/19] qapi: Convert query-spice Luiz Capitulino
2011-10-27 19:02 ` [Qemu-devel] [PATCH 15/19] qapi: Convert query-balloon Luiz Capitulino
2011-10-27 19:02 ` [Qemu-devel] [PATCH 16/19] qapi: Convert query-pci Luiz Capitulino
2011-10-27 19:02 ` [Qemu-devel] [PATCH 17/19] QMP: Drop the query commands dispatch table Luiz Capitulino
2011-10-27 19:02 ` [Qemu-devel] [PATCH 18/19] Monitor: do_info(): Drop QMP command handling code Luiz Capitulino
2011-10-27 19:02 ` [Qemu-devel] [PATCH 19/19] Drop qemu-objects.h from modules that don't require it Luiz Capitulino
2011-10-31 16:52 ` [Qemu-devel] [PULL 00/19]: QMP queue Anthony Liguori
  -- strict thread matches above, loose matches on Subject: below --
2011-10-24 13:26 [Qemu-devel] [PATCH v1 00/19]: QAPI conversions round 2 Luiz Capitulino
2011-10-24 13:26 ` [Qemu-devel] [PATCH 06/19] qapi: Convert the cpu command Luiz Capitulino

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=1319742136-8691-7-git-send-email-lcapitulino@redhat.com \
    --to=lcapitulino@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=mdroth@linux.vnet.ibm.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).