From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48741) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrWGL-0002W4-5i for qemu-devel@nongnu.org; Fri, 13 Dec 2013 12:10:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VrWGE-00081M-R1 for qemu-devel@nongnu.org; Fri, 13 Dec 2013 12:10:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:11108) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrWGE-000816-I1 for qemu-devel@nongnu.org; Fri, 13 Dec 2013 12:10:46 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rBDHAjaw030330 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 13 Dec 2013 12:10:45 -0500 From: Max Reitz Date: Fri, 13 Dec 2013 18:10:21 +0100 Message-Id: <1386954633-28905-11-git-send-email-mreitz@redhat.com> In-Reply-To: <1386954633-28905-1-git-send-email-mreitz@redhat.com> References: <1386954633-28905-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH v5 10/22] block: Pass reference to bdrv_file_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 With that now being possible, bdrv_open() should try to extract a block device reference from the options and pass it to bdrv_file_open(). Signed-off-by: Max Reitz --- block.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/block.c b/block.c index 1e53b3d..bef4f82 100644 --- a/block.c +++ b/block.c @@ -1056,6 +1056,7 @@ int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options, char tmp_filename[PATH_MAX + 1]; BlockDriverState *file = NULL; QDict *file_options = NULL; + const char *file_reference; const char *drvname; Error *local_err = NULL; @@ -1142,9 +1143,11 @@ int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options, } qdict_extract_subqdict(options, &file_options, "file."); + file_reference = qdict_get_try_str(options, "file"); - ret = bdrv_file_open(&file, filename, NULL, 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; } -- 1.8.5.1