From patchwork Fri Dec 4 13:35:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 552692 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 7DDBD1402C0 for ; Sat, 5 Dec 2015 00:40:10 +1100 (AEDT) Received: from localhost ([::1]:40912 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a4qam-0006qE-6o for incoming@patchwork.ozlabs.org; Fri, 04 Dec 2015 08:40:08 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53182) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a4qWd-0006lm-8R for qemu-devel@nongnu.org; Fri, 04 Dec 2015 08:35:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a4qWZ-0002sH-9r for qemu-devel@nongnu.org; Fri, 04 Dec 2015 08:35:51 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35448) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a4qWV-0002qO-HL; Fri, 04 Dec 2015 08:35:43 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 3DD33A37AB; Fri, 4 Dec 2015 13:35:43 +0000 (UTC) Received: from noname.redhat.com (ovpn-116-104.ams2.redhat.com [10.36.116.104]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tB4DZUlN020071; Fri, 4 Dec 2015 08:35:41 -0500 From: Kevin Wolf To: qemu-block@nongnu.org Date: Fri, 4 Dec 2015 14:35:08 +0100 Message-Id: <1449236124-19605-6-git-send-email-kwolf@redhat.com> In-Reply-To: <1449236124-19605-1-git-send-email-kwolf@redhat.com> References: <1449236124-19605-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, berto@igalia.com, qemu-devel@nongnu.org, mreitz@redhat.com Subject: [Qemu-devel] [PATCH v3 05/21] block: Consider all block layer options in append_open_options X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 Reviewed-by: Alberto Garcia --- block.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/block.c b/block.c index 0241acd..73f0816 100644 --- a/block.c +++ b/block.c @@ -3950,20 +3950,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;