From patchwork Wed Oct 27 18:19:10 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Liguori X-Patchwork-Id: 69384 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 2A494B70D4 for ; Thu, 28 Oct 2010 05:20:06 +1100 (EST) Received: from localhost ([127.0.0.1]:51412 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PBAbT-0005yr-Dm for incoming@patchwork.ozlabs.org; Wed, 27 Oct 2010 14:20:03 -0400 Received: from [140.186.70.92] (port=34375 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PBAao-0005wt-A9 for qemu-devel@nongnu.org; Wed, 27 Oct 2010 14:19:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PBAam-0003PI-Uh for qemu-devel@nongnu.org; Wed, 27 Oct 2010 14:19:21 -0400 Received: from e35.co.us.ibm.com ([32.97.110.153]:38257) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PBAam-0003Od-KB for qemu-devel@nongnu.org; Wed, 27 Oct 2010 14:19:20 -0400 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by e35.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id o9RI8A44026653 for ; Wed, 27 Oct 2010 12:08:10 -0600 Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o9RIJAp3141802 for ; Wed, 27 Oct 2010 12:19:12 -0600 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o9RIJ97l013847 for ; Wed, 27 Oct 2010 12:19:10 -0600 Received: from localhost.localdomain (sig-9-65-50-179.mts.ibm.com [9.65.50.179]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id o9RIJ9ro013805; Wed, 27 Oct 2010 12:19:09 -0600 From: Anthony Liguori To: qemu-devel@nongnu.org Date: Wed, 27 Oct 2010 13:19:10 -0500 Message-Id: <1288203550-23698-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 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 diff --git a/block.c b/block.c index 1a965b2..00b6f21 100644 --- a/block.c +++ b/block.c @@ -603,10 +603,16 @@ 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 =