block: Add strong_runtime_opts to BlockDriver

This new field can be set by block drivers to list the runtime options
they accept that may influence the contents of the respective BDS. As of
a follow-up patch, this list will be used by the common
bdrv_refresh_filename() implementation to decide which options to put
into BDS.full_open_options (and consequently whether a JSON filename has
to be created), thus freeing the drivers of having to implement that
logic themselves.

Additionally, this patch adds the field to all of the block drivers that
need it and sets it accordingly.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Message-id: 20190201192935.18394-22-mreitz@redhat.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
Max Reitz 2019-02-01 20:29:25 +01:00
parent c0625e8092
commit 2654267cc1
23 changed files with 256 additions and 1 deletions

View file

@ -252,6 +252,13 @@ static void null_refresh_filename(BlockDriverState *bs, QDict *opts)
bs->full_open_options = qobject_ref(opts);
}
static const char *const null_strong_runtime_opts[] = {
BLOCK_OPT_SIZE,
NULL_OPT_ZEROES,
NULL
};
static BlockDriver bdrv_null_co = {
.format_name = "null-co",
.protocol_name = "null-co",
@ -269,6 +276,7 @@ static BlockDriver bdrv_null_co = {
.bdrv_co_block_status = null_co_block_status,
.bdrv_refresh_filename = null_refresh_filename,
.strong_runtime_opts = null_strong_runtime_opts,
};
static BlockDriver bdrv_null_aio = {
@ -288,6 +296,7 @@ static BlockDriver bdrv_null_aio = {
.bdrv_co_block_status = null_co_block_status,
.bdrv_refresh_filename = null_refresh_filename,
.strong_runtime_opts = null_strong_runtime_opts,
};
static void bdrv_null_init(void)