Patchwork [06/21] Monitor: Convert do_block_set_passwd() to cmd_new_ret()

login
register
mail settings
Submitter Luiz Capitulino
Date Feb. 11, 2010, 1:49 a.m.
Message ID <1265853007-27300-7-git-send-email-lcapitulino@redhat.com>
Download mbox | patch
Permalink /patch/45083/
State New
Headers show

Comments

Luiz Capitulino - Feb. 11, 2010, 1:49 a.m.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 monitor.c       |    7 +++++--
 qemu-monitor.hx |    2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

Patch

diff --git a/monitor.c b/monitor.c
index 598dbfe..0ae408a 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1006,7 +1006,7 @@  static int do_eject(Monitor *mon, const QDict *qdict, QObject **ret_data)
     return eject_device(mon, bs, force);
 }
 
-static void do_block_set_passwd(Monitor *mon, const QDict *qdict,
+static int do_block_set_passwd(Monitor *mon, const QDict *qdict,
                                 QObject **ret_data)
 {
     BlockDriverState *bs;
@@ -1014,12 +1014,15 @@  static void do_block_set_passwd(Monitor *mon, const QDict *qdict,
     bs = bdrv_find(qdict_get_str(qdict, "device"));
     if (!bs) {
         qemu_error_new(QERR_DEVICE_NOT_FOUND, qdict_get_str(qdict, "device"));
-        return;
+        return -1;
     }
 
     if (bdrv_set_key(bs, qdict_get_str(qdict, "password")) < 0) {
         qemu_error_new(QERR_INVALID_PASSWORD);
+        return -1;
     }
+
+    return 0;
 }
 
 static void do_change_block(Monitor *mon, const char *device,
diff --git a/qemu-monitor.hx b/qemu-monitor.hx
index 835fd05..d2be5c4 100644
--- a/qemu-monitor.hx
+++ b/qemu-monitor.hx
@@ -1117,7 +1117,7 @@  ETEXI
         .params     = "block_passwd device password",
         .help       = "set the password of encrypted block devices",
         .user_print = monitor_user_noop,
-        .mhandler.cmd_new = do_block_set_passwd,
+        .cmd_new_ret = do_block_set_passwd,
     },
 
 STEXI