aboutsummaryrefslogtreecommitdiff
path: root/hmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'hmp.c')
-rw-r--r--hmp.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/hmp.c b/hmp.c
index 96e3ce18c1..d6235269b0 100644
--- a/hmp.c
+++ b/hmp.c
@@ -561,3 +561,35 @@ void hmp_pmemsave(Monitor *mon, const QDict *qdict)
qmp_pmemsave(addr, size, filename, &errp);
hmp_handle_error(mon, &errp);
}
+
+static void hmp_cont_cb(void *opaque, int err)
+{
+ Monitor *mon = opaque;
+
+ if (!err) {
+ hmp_cont(mon, NULL);
+ }
+}
+
+void hmp_cont(Monitor *mon, const QDict *qdict)
+{
+ Error *errp = NULL;
+
+ qmp_cont(&errp);
+ if (error_is_set(&errp)) {
+ if (error_is_type(errp, QERR_DEVICE_ENCRYPTED)) {
+ const char *device;
+
+ /* The device is encrypted. Ask the user for the password
+ and retry */
+
+ device = error_get_field(errp, "device");
+ assert(device != NULL);
+
+ monitor_read_block_device_key(mon, device, hmp_cont_cb, mon);
+ error_free(errp);
+ return;
+ }
+ hmp_handle_error(mon, &errp);
+ }
+}