From 8a2ce0bc1eb447c19c52422c03e690a420ea3ec7 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Date: Tue, 12 Mar 2019 18:48:48 +0200 Subject: block: Add a 'mutable_opts' field to BlockDriver If we reopen a BlockDriverState and there is an option that is present in bs->options but missing from the new set of options then we have to return an error unless the driver is able to reset it to its default value. This patch adds a new 'mutable_opts' field to BlockDriver. This is a list of runtime options that can be modified during reopen. If an option in this list is unspecified on reopen then it must be reset (or return an error). Signed-off-by: Alberto Garcia Signed-off-by: Kevin Wolf --- block/raw-format.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'block/raw-format.c') diff --git a/block/raw-format.c b/block/raw-format.c index e3e5ba2..cec2998 100644 --- a/block/raw-format.c +++ b/block/raw-format.c @@ -37,6 +37,8 @@ typedef struct BDRVRawState { bool has_size; } BDRVRawState; +static const char *const mutable_opts[] = { "offset", "size", NULL }; + static QemuOptsList raw_runtime_opts = { .name = "raw", .head = QTAILQ_HEAD_INITIALIZER(raw_runtime_opts.head), @@ -570,6 +572,7 @@ BlockDriver bdrv_raw = { .create_opts = &raw_create_opts, .bdrv_has_zero_init = &raw_has_zero_init, .strong_runtime_opts = raw_strong_runtime_opts, + .mutable_opts = mutable_opts, }; static void bdrv_raw_init(void) -- cgit v1.1