Revision a3a55a2e
b/monitor.c | ||
---|---|---|
772 | 772 |
eject_device(mon, bs, force); |
773 | 773 |
} |
774 | 774 |
|
775 |
static void do_block_set_passwd(Monitor *mon, const QDict *qdict, |
|
776 |
QObject **ret_data) |
|
777 |
{ |
|
778 |
BlockDriverState *bs; |
|
779 |
|
|
780 |
bs = bdrv_find(qdict_get_str(qdict, "device")); |
|
781 |
if (!bs) { |
|
782 |
qemu_error_new(QERR_DEVICE_NOT_FOUND, qdict_get_str(qdict, "device")); |
|
783 |
return; |
|
784 |
} |
|
785 |
|
|
786 |
if (bdrv_set_key(bs, qdict_get_str(qdict, "password")) < 0) { |
|
787 |
qemu_error_new(QERR_INVALID_PASSWORD); |
|
788 |
} |
|
789 |
} |
|
790 |
|
|
775 | 791 |
static void do_change_block(Monitor *mon, const char *device, |
776 | 792 |
const char *filename, const char *fmt) |
777 | 793 |
{ |
b/qemu-monitor.hx | ||
---|---|---|
1047 | 1047 |
used by another monitor command. |
1048 | 1048 |
ETEXI |
1049 | 1049 |
|
1050 |
{ |
|
1051 |
.name = "block_passwd", |
|
1052 |
.args_type = "device:B,password:s", |
|
1053 |
.params = "block_passwd device password", |
|
1054 |
.help = "set the password of encrypted block devices", |
|
1055 |
.user_print = monitor_user_noop, |
|
1056 |
.mhandler.cmd_new = do_block_set_passwd, |
|
1057 |
}, |
|
1058 |
|
|
1059 |
STEXI |
|
1060 |
@item block_passwd @var{device} @var{password} |
|
1061 |
Set the encrypted device @var{device} password to @var{password} |
|
1062 |
ETEXI |
|
1063 |
|
|
1050 | 1064 |
STEXI |
1051 | 1065 |
@end table |
1052 | 1066 |
ETEXI |
Also available in: Unified diff