qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: qemu-devel@nongnu.org
Cc: armbru@redhat.com
Subject: [Qemu-devel] [PATCH 16/21] Monitor: Rename cmd_new_ret()
Date: Wed, 10 Feb 2010 23:50:02 -0200	[thread overview]
Message-ID: <1265853007-27300-17-git-send-email-lcapitulino@redhat.com> (raw)
In-Reply-To: <1265853007-27300-1-git-send-email-lcapitulino@redhat.com>

Now that all handlers are converted to cmd_new_ret(), we can rename
it back to cmd_new(). But now it returns a value.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 monitor.c       |    9 ++-------
 qemu-monitor.hx |   42 +++++++++++++++++++++---------------------
 2 files changed, 23 insertions(+), 28 deletions(-)

diff --git a/monitor.c b/monitor.c
index 37a2a48..6eb0e2c 100644
--- a/monitor.c
+++ b/monitor.c
@@ -98,13 +98,12 @@ typedef struct mon_cmd_t {
     const char *params;
     const char *help;
     void (*user_print)(Monitor *mon, const QObject *data);
-    int (*cmd_new_ret)(Monitor *mon, const QDict *params, QObject **ret_data);
     union {
         void (*info)(Monitor *mon);
         void (*info_new)(Monitor *mon, QObject **ret_data);
         int  (*info_async)(Monitor *mon, MonitorCompletion *cb, void *opaque);
         void (*cmd)(Monitor *mon, const QDict *qdict);
-        void (*cmd_new)(Monitor *mon, const QDict *params, QObject **ret_data);
+        int  (*cmd_new)(Monitor *mon, const QDict *params, QObject **ret_data);
         int  (*cmd_async)(Monitor *mon, const QDict *params,
                           MonitorCompletion *cb, void *opaque);
     } mhandler;
@@ -3846,11 +3845,7 @@ static void monitor_call_handler(Monitor *mon, const mon_cmd_t *cmd,
 {
     QObject *data = NULL;
 
-    if (cmd->cmd_new_ret) {
-        cmd->cmd_new_ret(mon, params, &data);
-    } else {
-        cmd->mhandler.cmd_new(mon, params, &data);
-    }
+    cmd->mhandler.cmd_new(mon, params, &data);
 
     if (is_async_return(data)) {
         /*
diff --git a/qemu-monitor.hx b/qemu-monitor.hx
index d5b344e..7f9d261 100644
--- a/qemu-monitor.hx
+++ b/qemu-monitor.hx
@@ -43,7 +43,7 @@ ETEXI
         .params     = "[subcommand]",
         .help       = "show various information about the system state",
         .user_print = monitor_user_noop,
-        .cmd_new_ret = do_info,
+        .mhandler.cmd_new = do_info,
     },
 
 STEXI
@@ -123,7 +123,7 @@ ETEXI
         .params     = "",
         .help       = "quit the emulator",
         .user_print = monitor_user_noop,
-        .cmd_new_ret = do_quit,
+        .mhandler.cmd_new = do_quit,
     },
 
 STEXI
@@ -138,7 +138,7 @@ ETEXI
         .params     = "[-f] device",
         .help       = "eject a removable medium (use -f to force it)",
         .user_print = monitor_user_noop,
-        .cmd_new_ret = do_eject,
+        .mhandler.cmd_new = do_eject,
     },
 
 STEXI
@@ -153,7 +153,7 @@ ETEXI
         .params     = "device filename [format]",
         .help       = "change a removable medium, optional format",
         .user_print = monitor_user_noop,
-        .cmd_new_ret = do_change,
+        .mhandler.cmd_new = do_change,
     },
 
 STEXI
@@ -303,7 +303,7 @@ ETEXI
         .params     = "",
         .help       = "stop emulation",
         .user_print = monitor_user_noop,
-        .cmd_new_ret = do_stop,
+        .mhandler.cmd_new = do_stop,
     },
 
 STEXI
@@ -318,7 +318,7 @@ ETEXI
         .params     = "",
         .help       = "resume emulation",
         .user_print = monitor_user_noop,
-        .cmd_new_ret = do_cont,
+        .mhandler.cmd_new = do_cont,
     },
 
 STEXI
@@ -494,7 +494,7 @@ ETEXI
         .params     = "",
         .help       = "reset the system",
         .user_print = monitor_user_noop,
-        .cmd_new_ret = do_system_reset,
+        .mhandler.cmd_new = do_system_reset,
     },
 
 STEXI
@@ -510,7 +510,7 @@ ETEXI
         .params     = "",
         .help       = "send system power down event",
         .user_print = monitor_user_noop,
-        .cmd_new_ret = do_system_powerdown,
+        .mhandler.cmd_new = do_system_powerdown,
     },
 
 STEXI
@@ -604,7 +604,7 @@ ETEXI
         .params     = "index",
         .help       = "set the default CPU",
         .user_print = monitor_user_noop,
-        .cmd_new_ret = do_cpu_set,
+        .mhandler.cmd_new = do_cpu_set,
     },
 
 STEXI
@@ -705,7 +705,7 @@ ETEXI
         .params     = "addr size file",
         .help       = "save to disk virtual memory dump starting at 'addr' of size 'size'",
         .user_print = monitor_user_noop,
-        .cmd_new_ret = do_memory_save,
+        .mhandler.cmd_new = do_memory_save,
     },
 
 STEXI
@@ -720,7 +720,7 @@ ETEXI
         .params     = "addr size file",
         .help       = "save to disk physical memory dump starting at 'addr' of size 'size'",
         .user_print = monitor_user_noop,
-        .cmd_new_ret = do_physical_memory_save,
+        .mhandler.cmd_new = do_physical_memory_save,
     },
 
 STEXI
@@ -773,7 +773,7 @@ ETEXI
 		      "shared storage with incremental copy of disk "
 		      "(base image shared between src and destination)",
         .user_print = monitor_user_noop,	
-	.cmd_new_ret = do_migrate,
+	.mhandler.cmd_new = do_migrate,
     },
 
 
@@ -791,7 +791,7 @@ ETEXI
         .params     = "",
         .help       = "cancel the current VM migration",
         .user_print = monitor_user_noop,
-        .cmd_new_ret = do_migrate_cancel,
+        .mhandler.cmd_new = do_migrate_cancel,
     },
 
 STEXI
@@ -806,7 +806,7 @@ ETEXI
         .params     = "value",
         .help       = "set maximum speed (in bytes) for migrations",
         .user_print = monitor_user_noop,
-        .cmd_new_ret = do_migrate_set_speed,
+        .mhandler.cmd_new = do_migrate_set_speed,
     },
 
 STEXI
@@ -821,7 +821,7 @@ ETEXI
         .params     = "value",
         .help       = "set maximum tolerated downtime (in seconds) for migrations",
         .user_print = monitor_user_noop,
-        .cmd_new_ret = do_migrate_set_downtime,
+        .mhandler.cmd_new = do_migrate_set_downtime,
     },
 
 STEXI
@@ -857,7 +857,7 @@ ETEXI
         .params     = "auto|[[<domain>:]<bus>:]<slot> nic|storage [[vlan=n][,macaddr=addr][,model=type]] [file=file][,if=type][,bus=nr]...",
         .help       = "hot-add PCI device",
         .user_print = pci_device_hot_add_print,
-        .cmd_new_ret = pci_device_hot_add,
+        .mhandler.cmd_new = pci_device_hot_add,
     },
 #endif
 
@@ -874,7 +874,7 @@ ETEXI
         .params     = "[[<domain>:]<bus>:]<slot>",
         .help       = "hot remove PCI device",
         .user_print = monitor_user_noop,
-        .cmd_new_ret = do_pci_device_hot_remove,
+        .mhandler.cmd_new = do_pci_device_hot_remove,
     },
 #endif
 
@@ -1083,7 +1083,7 @@ ETEXI
         .params     = "getfd name",
         .help       = "receive a file descriptor via SCM rights and assign it a name",
         .user_print = monitor_user_noop,
-        .cmd_new_ret = do_getfd,
+        .mhandler.cmd_new = do_getfd,
     },
 
 STEXI
@@ -1100,7 +1100,7 @@ ETEXI
         .params     = "closefd name",
         .help       = "close a file descriptor previously passed via SCM rights",
         .user_print = monitor_user_noop,
-        .cmd_new_ret = do_closefd,
+        .mhandler.cmd_new = do_closefd,
     },
 
 STEXI
@@ -1117,7 +1117,7 @@ ETEXI
         .params     = "block_passwd device password",
         .help       = "set the password of encrypted block devices",
         .user_print = monitor_user_noop,
-        .cmd_new_ret = do_block_set_passwd,
+        .mhandler.cmd_new = do_block_set_passwd,
     },
 
 STEXI
@@ -1132,7 +1132,7 @@ ETEXI
         .params     = "",
         .help       = "enable QMP capabilities",
         .user_print = monitor_user_noop,
-        .cmd_new_ret = do_qmp_capabilities,
+        .mhandler.cmd_new = do_qmp_capabilities,
     },
 
 STEXI
-- 
1.6.6

  parent reply	other threads:[~2010-02-11  1:51 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-11  1:49 [Qemu-devel] [PATCH v0 00/21]: Monitor: improve handlers error handling Luiz Capitulino
2010-02-11  1:49 ` [Qemu-devel] [PATCH 01/21] Monitor: Introduce cmd_new_ret() Luiz Capitulino
2010-02-19 21:28   ` Anthony Liguori
2010-02-11  1:49 ` [Qemu-devel] [PATCH 02/21] Monitor: Convert simple handlers to cmd_new_ret() Luiz Capitulino
2010-02-11  1:49 ` [Qemu-devel] [PATCH 03/21] Monitor: Convert do_cont() " Luiz Capitulino
2010-02-11  1:49 ` [Qemu-devel] [PATCH 04/21] Monitor: Convert do_eject() " Luiz Capitulino
2010-02-11  1:49 ` [Qemu-devel] [PATCH 05/21] Monitor: Convert do_cpu_set() " Luiz Capitulino
2010-02-11  1:49 ` [Qemu-devel] [PATCH 06/21] Monitor: Convert do_block_set_passwd() " Luiz Capitulino
2010-02-11  1:49 ` [Qemu-devel] [PATCH 07/21] Monitor: Convert do_getfd() " Luiz Capitulino
2010-02-11  1:49 ` [Qemu-devel] [PATCH 08/21] Monitor: Convert do_closefd() " Luiz Capitulino
2010-02-11  1:49 ` [Qemu-devel] [PATCH 09/21] Monitor: Convert pci_device_hot_add() " Luiz Capitulino
2010-02-11  1:49 ` [Qemu-devel] [PATCH 10/21] Monitor: Convert pci_device_hot_remove() " Luiz Capitulino
2010-02-11  1:49 ` [Qemu-devel] [PATCH 11/21] Monitor: Convert do_migrate() " Luiz Capitulino
2010-02-11  1:49 ` [Qemu-devel] [PATCH 12/21] Monitor: Convert do_memory_save() " Luiz Capitulino
2010-02-11  1:49 ` [Qemu-devel] [PATCH 13/21] Monitor: Convert do_physical_memory_save() " Luiz Capitulino
2010-02-11  1:50 ` [Qemu-devel] [PATCH 14/21] Monitor: Convert do_info() " Luiz Capitulino
2010-02-11  1:50 ` [Qemu-devel] [PATCH 15/21] Monitor: Convert do_change() " Luiz Capitulino
2010-02-11  1:50 ` Luiz Capitulino [this message]
2010-02-11  1:50 ` [Qemu-devel] [PATCH 17/21] Monitor: Debugging support Luiz Capitulino
2010-02-11  1:50 ` [Qemu-devel] [PATCH 18/21] Monitor: Drop the print disabling mechanism Luiz Capitulino
2010-02-11  1:50 ` [Qemu-devel] [PATCH 19/21] Monitor: Audit handler return Luiz Capitulino
2010-02-11  1:50 ` [Qemu-devel] [PATCH 20/21] Monitor: Debug stray prints the right way Luiz Capitulino
2010-02-11  1:50 ` [Qemu-devel] [PATCH 21/21] Monitor: Report more than one error in handlers Luiz Capitulino
2010-02-11  8:58 ` [Qemu-devel] [PATCH v0 00/21]: Monitor: improve handlers error handling Markus Armbruster
2010-02-11 11:48   ` Luiz Capitulino
2010-02-11 12:21     ` Markus Armbruster
2010-02-11 14:04 ` Anthony Liguori
2010-02-11 15:27   ` Markus Armbruster
2010-02-11 16:00     ` Luiz Capitulino
2010-02-11 16:12     ` Anthony Liguori
2010-02-11 16:57       ` Markus Armbruster
2010-02-11 17:17         ` Anthony Liguori
2010-02-12 10:04           ` 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=1265853007-27300-17-git-send-email-lcapitulino@redhat.com \
    --to=lcapitulino@redhat.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).