From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=59907 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PDzeu-00016y-Fi for qemu-devel@nongnu.org; Thu, 04 Nov 2010 09:15:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PDzek-00039V-NB for qemu-devel@nongnu.org; Thu, 04 Nov 2010 09:15:14 -0400 Received: from e4.ny.us.ibm.com ([32.97.182.144]:56447) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PDzek-00037j-Kr for qemu-devel@nongnu.org; Thu, 04 Nov 2010 09:15:06 -0400 Received: from d01relay01.pok.ibm.com (d01relay01.pok.ibm.com [9.56.227.233]) by e4.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id oA4CwPmG026423 for ; Thu, 4 Nov 2010 08:58:25 -0400 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay01.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id oA4DEmPg372462 for ; Thu, 4 Nov 2010 09:14:49 -0400 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id oA4DEmVT009595 for ; Thu, 4 Nov 2010 11:14:48 -0200 Message-ID: <4CD2B1C7.9090704@linux.vnet.ibm.com> Date: Thu, 04 Nov 2010 08:14:47 -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> <4CD2ACEB.8060400@redhat.com> In-Reply-To: <4CD2ACEB.8060400@redhat.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: Anthony Liguori , agl@linux.vnet.ibm.com, qemu-devel@nongnu.org, Stefan Hajnoczi On 11/04/2010 07:54 AM, Kevin Wolf wrote: > Am 27.10.2010 20:19, schrieb Anthony Liguori: > >> 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) { >> > If no protocol is specified, bdrv_find_protocol doesn't return NULL but > the file: driver. > An ugly way to handle this would be to do if (strstr(bs->backing_file, ":") == NULL) instead. A deeper refactoring could return NULL in bdrv_find_protocol and fixup the callers to default to file: if none are specified. What do you think? Regards, Anthony Liguori > This breaks all backing file related qemu-iotests cases because qcow2 > backing files are opened as raw files now. > > Kevin >