block: Consider all block layer options in append_open_options
The code already special-cased "node-name", which is currently the only option passed in the QDict that isn't driver-specific. Generalise the code to take all general block layer options into consideration. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com>
This commit is contained in:
parent
d9b7b05703
commit
9e700c1ac6
26
block.c
26
block.c
|
@ -3950,20 +3950,30 @@ out:
|
||||||
static bool append_open_options(QDict *d, BlockDriverState *bs)
|
static bool append_open_options(QDict *d, BlockDriverState *bs)
|
||||||
{
|
{
|
||||||
const QDictEntry *entry;
|
const QDictEntry *entry;
|
||||||
|
QemuOptDesc *desc;
|
||||||
bool found_any = false;
|
bool found_any = false;
|
||||||
|
|
||||||
for (entry = qdict_first(bs->options); entry;
|
for (entry = qdict_first(bs->options); entry;
|
||||||
entry = qdict_next(bs->options, entry))
|
entry = qdict_next(bs->options, entry))
|
||||||
{
|
{
|
||||||
/* Only take options for this level and exclude all non-driver-specific
|
/* Only take options for this level */
|
||||||
* options */
|
if (strchr(qdict_entry_key(entry), '.')) {
|
||||||
if (!strchr(qdict_entry_key(entry), '.') &&
|
continue;
|
||||||
strcmp(qdict_entry_key(entry), "node-name"))
|
|
||||||
{
|
|
||||||
qobject_incref(qdict_entry_value(entry));
|
|
||||||
qdict_put_obj(d, qdict_entry_key(entry), qdict_entry_value(entry));
|
|
||||||
found_any = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* And exclude all non-driver-specific options */
|
||||||
|
for (desc = bdrv_runtime_opts.desc; desc->name; desc++) {
|
||||||
|
if (!strcmp(qdict_entry_key(entry), desc->name)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (desc->name) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
qobject_incref(qdict_entry_value(entry));
|
||||||
|
qdict_put_obj(d, qdict_entry_key(entry), qdict_entry_value(entry));
|
||||||
|
found_any = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return found_any;
|
return found_any;
|
||||||
|
|
Loading…
Reference in a new issue