mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-23 19:49:43 +00:00
Monitor: Convert do_block_set_passwd() to cmd_new_ret()
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
584cbdb596
commit
ba85d35191
@ -1006,7 +1006,7 @@ static int do_eject(Monitor *mon, const QDict *qdict, QObject **ret_data)
|
|||||||
return eject_device(mon, bs, force);
|
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)
|
QObject **ret_data)
|
||||||
{
|
{
|
||||||
BlockDriverState *bs;
|
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"));
|
bs = bdrv_find(qdict_get_str(qdict, "device"));
|
||||||
if (!bs) {
|
if (!bs) {
|
||||||
qemu_error_new(QERR_DEVICE_NOT_FOUND, qdict_get_str(qdict, "device"));
|
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) {
|
if (bdrv_set_key(bs, qdict_get_str(qdict, "password")) < 0) {
|
||||||
qemu_error_new(QERR_INVALID_PASSWORD);
|
qemu_error_new(QERR_INVALID_PASSWORD);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_change_block(Monitor *mon, const char *device,
|
static void do_change_block(Monitor *mon, const char *device,
|
||||||
|
@ -1117,7 +1117,7 @@ ETEXI
|
|||||||
.params = "block_passwd device password",
|
.params = "block_passwd device password",
|
||||||
.help = "set the password of encrypted block devices",
|
.help = "set the password of encrypted block devices",
|
||||||
.user_print = monitor_user_noop,
|
.user_print = monitor_user_noop,
|
||||||
.mhandler.cmd_new = do_block_set_passwd,
|
.cmd_new_ret = do_block_set_passwd,
|
||||||
},
|
},
|
||||||
|
|
||||||
STEXI
|
STEXI
|
||||||
|
Loading…
Reference in New Issue
Block a user