From patchwork Thu Jun 20 17:46:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 253055 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 BA5492C00A2 for ; Fri, 21 Jun 2013 04:17:48 +1000 (EST) Received: from localhost ([::1]:53790 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpjAt-000845-13 for incoming@patchwork.ozlabs.org; Thu, 20 Jun 2013 14:01:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58239) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Upiwq-0005qh-Ma for qemu-devel@nongnu.org; Thu, 20 Jun 2013 13:47:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Upiwp-0002Jz-9B for qemu-devel@nongnu.org; Thu, 20 Jun 2013 13:47:04 -0400 Received: from mail-we0-x22c.google.com ([2a00:1450:400c:c03::22c]:51498) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Upiwp-0002Js-1j for qemu-devel@nongnu.org; Thu, 20 Jun 2013 13:47:03 -0400 Received: by mail-we0-f172.google.com with SMTP id q56so5777585wes.31 for ; Thu, 20 Jun 2013 10:47:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=ZwJ8hbpI3Caujn11z86GzE1XqsKP7h9VHuMBQAtOAic=; b=Cze1eztRkxX1KsgLUGxjgmP6wx35ckuqBlOrLJACUNdYe6s/LcTm5maNiKNT//1X1P wi2SeWD4SWupW5dN0Hy8JwnfxmDni1ym1aLtHAFjC5xzQESjweAMirfv9HobRCIy/hyQ O8TbJEV3SOyU55n2sNrdLnRM1h4LPtPtLmnDpmz5TPb0lGCSSr56boQZIV3BXWpgMPQo BTVGAjN4FtsNHjmCDl8xddLBpN1E4YbTyozNlxXMIpGfT3wyrpkjAPv69WvcSxgikq3W P3pXMtlA5NxqwvrOJVL0Iazv2Lj0b5xJ7+xQrKndIP7ZK+/J0JXuhugacRzPhWEkmLgU RtdQ== X-Received: by 10.180.74.146 with SMTP id t18mr392822wiv.3.1371750422332; Thu, 20 Jun 2013 10:47:02 -0700 (PDT) Received: from localhost (158.red-80-26-177.adsl.dynamic.ccgg.telefonica.net. [80.26.177.158]) by mx.google.com with ESMTPSA id f8sm507141wiv.0.2013.06.20.10.47.00 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 20 Jun 2013 10:47:01 -0700 (PDT) From: "=?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=" To: qemu-devel@nongnu.org Date: Thu, 20 Jun 2013 19:46:10 +0200 Message-Id: <1371750371-18491-12-git-send-email-marcandre.lureau@redhat.com> X-Mailer: git-send-email 1.8.3.rc1.49.g8d97506 In-Reply-To: <1371750371-18491-1-git-send-email-marcandre.lureau@redhat.com> References: <1371750371-18491-1-git-send-email-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c03::22c Cc: spice-devel@lists.freedesktop.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [Qemu-devel] [PATCH 11/12] block: allow to call bdrv_open() with an opaque 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 If the block driver already has a bs->opaque when calling bdrv_open(), pass it down to the file driver. Signed-off-by: Marc-André Lureau --- block.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/block.c b/block.c index bdffb42..ff9cb0b 100644 --- a/block.c +++ b/block.c @@ -1041,6 +1041,7 @@ int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options, int ret; BlockDriverState *file = NULL; QDict *file_options = NULL; + void *backing_opaque = NULL; /* NULL means an empty set of options */ if (options == NULL) { @@ -1064,6 +1065,8 @@ int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options, goto fail; } + backing_opaque = bs->opaque; + bs->opaque = NULL; if (total_size == -1) { bs1 = bdrv_new_int("", NULL, NULL); ret = bdrv_open(bs1, filename, NULL, 0, drv); @@ -1088,7 +1091,8 @@ int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options, extract_subqdict(options, &file_options, "file."); ret = bdrv_file_open_int(&file, filename, file_options, - bdrv_open_flags(bs, flags), bs, NULL); + bdrv_open_flags(bs, flags), bs, bs->opaque); + bs->opaque = NULL; if (ret < 0) { goto fail; } @@ -1118,7 +1122,7 @@ int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options, QDict *backing_options; extract_subqdict(options, &backing_options, "backing."); - ret = bdrv_open_backing_file_int(bs, backing_options, NULL); + ret = bdrv_open_backing_file_int(bs, backing_options, backing_opaque); if (ret < 0) { goto close_and_fail; }