From patchwork Wed Dec 11 18:11:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Reitz X-Patchwork-Id: 300252 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 32BF62C00A6 for ; Thu, 12 Dec 2013 05:16:21 +1100 (EST) Received: from localhost ([::1]:59143 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqoKW-00008B-AA for incoming@patchwork.ozlabs.org; Wed, 11 Dec 2013 13:16:16 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51151) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqoFL-0001DQ-GM for qemu-devel@nongnu.org; Wed, 11 Dec 2013 13:11:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VqoFF-0002GL-Hg for qemu-devel@nongnu.org; Wed, 11 Dec 2013 13:10:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:28486) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqoFE-0002GD-U7 for qemu-devel@nongnu.org; Wed, 11 Dec 2013 13:10:49 -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 rBBIAm1e003893 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 11 Dec 2013 13:10:48 -0500 Received: from localhost (ovpn-116-110.ams2.redhat.com [10.36.116.110]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id rBBIAkrG009611 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Wed, 11 Dec 2013 13:10:47 -0500 From: Max Reitz To: qemu-devel@nongnu.org Date: Wed, 11 Dec 2013 19:11:01 +0100 Message-Id: <1386785473-26157-10-git-send-email-mreitz@redhat.com> In-Reply-To: <1386785473-26157-1-git-send-email-mreitz@redhat.com> References: <1386785473-26157-1-git-send-email-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Kevin Wolf , Fam Zheng , Stefan Hajnoczi , Max Reitz Subject: [Qemu-devel] [PATCH v3 09/21] block: Pass reference to bdrv_file_open() 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 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 9e197b3..4a2c251 100644 --- a/block.c +++ b/block.c @@ -1058,6 +1058,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; @@ -1144,9 +1145,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; }