From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60806) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtjZk-0005kI-JQ for qemu-devel@nongnu.org; Thu, 19 Dec 2013 14:48:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VtjZK-0004se-Ab for qemu-devel@nongnu.org; Thu, 19 Dec 2013 14:48:04 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37697) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtjZK-0004sM-1j for qemu-devel@nongnu.org; Thu, 19 Dec 2013 14:47:38 -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 rBJJlaoD008937 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 19 Dec 2013 14:47:37 -0500 From: Max Reitz Date: Thu, 19 Dec 2013 20:47:13 +0100 Message-Id: <1387482443-10633-13-git-send-email-mreitz@redhat.com> In-Reply-To: <1387482443-10633-1-git-send-email-mreitz@redhat.com> References: <1387482443-10633-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH v6 12/22] block: Use bdrv_open_image() in bdrv_open() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Fam Zheng , Stefan Hajnoczi , Max Reitz Using bdrv_open_image() instead of bdrv_file_open() directly in bdrv_open() is easier. Signed-off-by: Max Reitz --- block.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/block.c b/block.c index 76b6c25..9e4e85f 100644 --- a/block.c +++ b/block.c @@ -1128,8 +1128,6 @@ int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options, /* TODO: extra byte is a hack to ensure MAX_PATH space on Windows. */ char tmp_filename[PATH_MAX + 1]; BlockDriverState *file = NULL; - QDict *file_options = NULL; - const char *file_reference; const char *drvname; Error *local_err = NULL; @@ -1215,17 +1213,11 @@ int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options, flags |= BDRV_O_ALLOW_RDWR; } - qdict_extract_subqdict(options, &file_options, "file."); - file_reference = qdict_get_try_str(options, "file"); - - if (filename || file_reference || qdict_size(file_options)) { - ret = bdrv_file_open(&file, filename, file_reference, file_options, - bdrv_open_flags(bs, flags | BDRV_O_UNMAP), - &local_err); - qdict_del(options, "file"); - if (ret < 0) { - goto fail; - } + ret = bdrv_open_image(&file, filename, options, "file", + bdrv_open_flags(bs, flags | BDRV_O_UNMAP), true, true, + &local_err); + if (ret < 0) { + goto fail; } /* Find the right image format driver */ -- 1.8.5.1