From mboxrd@z Thu Jan 1 00:00:00 1970 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 From: Anthony Liguori Date: Wed, 27 Oct 2010 14:44:09 -0500 Message-Id: <1288208649-27542-1-git-send-email-aliguori@us.ibm.com> Subject: [Qemu-devel] [PATCH] block: fix the use of protocols in backing files (v2) List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Anthony Liguori , Stefan Hajnoczi , Adam Litke 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 = -- 1.7.0.4