From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53501) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0tXO-0004oN-3t for qemu-devel@nongnu.org; Mon, 23 Nov 2015 11:00:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a0tXJ-0006eg-VH for qemu-devel@nongnu.org; Mon, 23 Nov 2015 11:00:17 -0500 From: Kevin Wolf Date: Mon, 23 Nov 2015 16:59:44 +0100 Message-Id: <1448294400-476-6-git-send-email-kwolf@redhat.com> In-Reply-To: <1448294400-476-1-git-send-email-kwolf@redhat.com> References: <1448294400-476-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH v2 05/21] block: Consider all block layer options in append_open_options List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: kwolf@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com 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 Reviewed-by: Eric Blake Reviewed-by: Max Reitz --- block.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/block.c b/block.c index ca6c4e9..23d9e10 100644 --- a/block.c +++ b/block.c @@ -3951,20 +3951,30 @@ out: static bool append_open_options(QDict *d, BlockDriverState *bs) { const QDictEntry *entry; + QemuOptDesc *desc; bool found_any = false; for (entry = qdict_first(bs->options); entry; entry = qdict_next(bs->options, entry)) { - /* Only take options for this level and exclude all non-driver-specific - * options */ - if (!strchr(qdict_entry_key(entry), '.') && - 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; + /* Only take options for this level */ + if (strchr(qdict_entry_key(entry), '.')) { + continue; } + + /* 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; -- 1.8.3.1