From patchwork Wed Oct 27 19:44:09 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Liguori X-Patchwork-Id: 69399 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 81183B6EEB for ; Thu, 28 Oct 2010 07:03:35 +1100 (EST) Received: from localhost ([127.0.0.1]:36056 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PBCDc-0000mQ-ST for incoming@patchwork.ozlabs.org; Wed, 27 Oct 2010 16:03:32 -0400 Received: from [140.186.70.92] (port=39093 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PBC9i-0005vU-QO for qemu-devel@nongnu.org; Wed, 27 Oct 2010 15:59:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PBBus-000343-QC for qemu-devel@nongnu.org; Wed, 27 Oct 2010 15:44:11 -0400 Received: from e5.ny.us.ibm.com ([32.97.182.145]:51123) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PBBus-00033y-Me for qemu-devel@nongnu.org; Wed, 27 Oct 2010 15:44:10 -0400 Received: from d01relay07.pok.ibm.com (d01relay07.pok.ibm.com [9.56.227.147]) by e5.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id o9RJNDJQ020385 for ; Wed, 27 Oct 2010 15:23:13 -0400 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay07.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o9RJi9Lf2404372 for ; Wed, 27 Oct 2010 15:44:09 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o9RJi98Z020038 for ; Wed, 27 Oct 2010 17:44:09 -0200 Received: from localhost.localdomain (sig-9-65-50-179.mts.ibm.com [9.65.50.179]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id o9RJi7T1020012; Wed, 27 Oct 2010 17:44:08 -0200 From: Anthony Liguori To: qemu-devel@nongnu.org Date: Wed, 27 Oct 2010 14:44:09 -0500 Message-Id: <1288208649-27542-1-git-send-email-aliguori@us.ibm.com> X-Mailer: git-send-email 1.7.0.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: Kevin Wolf , Anthony Liguori , Stefan Hajnoczi , Adam Litke Subject: [Qemu-devel] [PATCH] block: fix the use of protocols in backing files (v2) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Anthony Liguori --- v1 -> v2 - Fix up CODING_STYLE of modified code diff --git a/block.c b/block.c index 1a965b2..029017e 100644 --- a/block.c +++ b/block.c @@ -603,10 +603,17 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags, BlockDriver *back_drv = NULL; bs->backing_hd = bdrv_new(""); - path_combine(backing_filename, sizeof(backing_filename), - filename, bs->backing_file); - if (bs->backing_format[0] != '\0') - back_drv = bdrv_find_format(bs->backing_format); + back_drv = bdrv_find_protocol(bs->backing_file); + if (!back_drv) { + path_combine(backing_filename, sizeof(backing_filename), + filename, bs->backing_file); + if (bs->backing_format[0] != '\0') { + back_drv = bdrv_find_format(bs->backing_format); + } + } else { + pstrcpy(backing_filename, sizeof(backing_filename), + bs->backing_file); + } /* backing files always opened read-only */ back_flags =