From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52411) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLuu5-0003Zd-8v for qemu-devel@nongnu.org; Fri, 07 Mar 2014 08:33:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WLuu0-0001ke-8M for qemu-devel@nongnu.org; Fri, 07 Mar 2014 08:33:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:63845) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLuu0-0001kT-1A for qemu-devel@nongnu.org; Fri, 07 Mar 2014 08:33:28 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s27DXRnG019295 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 7 Mar 2014 08:33:27 -0500 From: Kevin Wolf Date: Fri, 7 Mar 2014 14:32:57 +0100 Message-Id: <1394199187-9576-10-git-send-email-kwolf@redhat.com> In-Reply-To: <1394199187-9576-1-git-send-email-kwolf@redhat.com> References: <1394199187-9576-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PULL 09/19] block: Keep "filename" option after parsing List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com From: Max Reitz Currently, bdrv_file_open() always removes the "filename" option from the options QDict after bdrv_parse_filename() has been (successfully) called. However, for drivers with bdrv_needs_filename, it makes more sense for bdrv_parse_filename() to overwrite the "filename" option and for bdrv_file_open() to fetch the filename from there. Since there currently are no drivers that implement bdrv_parse_filename() and have bdrv_needs_filename set, this does not change current behavior. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Benoit Canet Signed-off-by: Kevin Wolf --- block.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/block.c b/block.c index 7330a87..e7387f1 100644 --- a/block.c +++ b/block.c @@ -1017,7 +1017,12 @@ static int bdrv_file_open(BlockDriverState *bs, const char *filename, ret = -EINVAL; goto fail; } - qdict_del(*options, "filename"); + + if (!drv->bdrv_needs_filename) { + qdict_del(*options, "filename"); + } else { + filename = qdict_get_str(*options, "filename"); + } } if (!drv->bdrv_file_open) { -- 1.8.1.4