Received: from [140.186.70.92] (port=48621 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PBBij-0006aF-KQ for qemu-devel@nongnu.org; Wed, 27 Oct 2010 15:31:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PBBZu-0006sh-06 for qemu-devel@nongnu.org; Wed, 27 Oct 2010 15:22:32 -0400 Received: from fe01x03-cgp.akado.ru ([77.232.31.164]:59875 helo=akado.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PBBZt-0006s3-OJ for qemu-devel@nongnu.org; Wed, 27 Oct 2010 15:22:29 -0400 Date: Wed, 27 Oct 2010 23:22:10 +0400 (MSD) From: malc Subject: Re: [Qemu-devel] [PATCH] block: fix the use of protocols in backing files In-Reply-To: <1288203550-23698-1-git-send-email-aliguori@us.ibm.com> Message-ID: References: <1288203550-23698-1-git-send-email-aliguori@us.ibm.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Kevin Wolf , Adam Litke , qemu-devel@nongnu.org, Stefan Hajnoczi 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.. > + } else { > + pstrcpy(backing_filename, sizeof(backing_filename), > + bs->backing_file); > + } > > /* backing files always opened read-only */ > back_flags = > -- mailto:av1474@comtv.ru