From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=60315 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PBBtA-0006vz-Dw for qemu-devel@nongnu.org; Wed, 27 Oct 2010 15:42:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PBBt9-0002rC-3y for qemu-devel@nongnu.org; Wed, 27 Oct 2010 15:42:24 -0400 Received: from e34.co.us.ibm.com ([32.97.110.152]:42887) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PBBt8-0002q9-V4 for qemu-devel@nongnu.org; Wed, 27 Oct 2010 15:42:23 -0400 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e34.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id o9RJWQ6w013329 for ; Wed, 27 Oct 2010 13:32:26 -0600 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id o9RJgF2u237574 for ; Wed, 27 Oct 2010 13:42:15 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o9RJgFwr004258 for ; Wed, 27 Oct 2010 13:42:15 -0600 Message-ID: <4CC88099.1060406@linux.vnet.ibm.com> Date: Wed, 27 Oct 2010 14:42:17 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] block: fix the use of protocols in backing files References: <1288203550-23698-1-git-send-email-aliguori@us.ibm.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: malc Cc: Kevin Wolf , agl@linux.vnet.ibm.com, qemu-devel@nongnu.org, Stefan Hajnoczi On 10/27/2010 02:22 PM, malc wrote: > On Wed, 27 Oct 2010, Anthony Liguori wrote: > > >> 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); >> > Sigh.. > Always good to see such clear and constructive comments... I'll respin. Regards, Anthony Liguori > >> + } else { >> + pstrcpy(backing_filename, sizeof(backing_filename), >> + bs->backing_file); >> + } >> >> /* backing files always opened read-only */ >> back_flags = >> >> >