From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47905) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WDNd2-0001gK-Iw for qemu-devel@nongnu.org; Tue, 11 Feb 2014 19:24:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WDNcv-00035e-Q5 for qemu-devel@nongnu.org; Tue, 11 Feb 2014 19:24:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:20389) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WDNcv-00035Z-GH for qemu-devel@nongnu.org; Tue, 11 Feb 2014 19:24:33 -0500 Message-ID: <52FABFCE.10206@redhat.com> Date: Wed, 12 Feb 2014 01:26:54 +0100 From: Max Reitz MIME-Version: 1.0 References: <1391881159-13585-1-git-send-email-mreitz@redhat.com> <1391881159-13585-8-git-send-email-mreitz@redhat.com> <20140210145629.GD2832@dhcp-200-207.str.redhat.com> In-Reply-To: <20140210145629.GD2832@dhcp-200-207.str.redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 7/8] block: Reuse success path from bdrv_open() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: Jeff Cody , qemu-devel@nongnu.org, Stefan Hajnoczi , =?ISO-8859-1?Q?Beno=EEt_Canet?= On 10.02.2014 15:56, Kevin Wolf wrote: > Am 08.02.2014 um 18:39 hat Max Reitz geschrieben: >> The fail and success paths of bdrv_file_open() may be further shortened >> by reusing code already existent in bdrv_open(). This includes >> bdrv_file_open() not taking the reference to options which allows the >> removal of QDECREF(options) in that function. >> >> Signed-off-by: Max Reitz >> @@ -1001,41 +1003,35 @@ static int bdrv_file_open(BlockDriverState *bs, const char *filename, >> >> /* Parse the filename and open it */ >> if (drv->bdrv_parse_filename && filename) { >> - drv->bdrv_parse_filename(filename, options, &local_err); >> + drv->bdrv_parse_filename(filename, *options, &local_err); >> if (error_is_set(&local_err)) { >> error_propagate(errp, local_err); >> ret = -EINVAL; >> goto fail; >> } >> - qdict_del(options, "filename"); >> + qdict_del(*options, "filename"); >> + } else if (drv->bdrv_needs_filename && !filename) { >> + error_setg(errp, "The '%s' block driver requires a file name", >> + drv->format_name); >> + ret = -EINVAL; >> + goto fail; >> } > How did this part end up in this patch? It doesn't look wrong, though I > think bdrv_open_common() should already catch it. In any case it's an > addition that the commit message didn't mention. I wonder. It definitely doesn't belong here, since as of your commit "block: Fail gracefully with missing filename" this check should be in bdrv_open_common() and not here. I guess, I somehow ended up reverting it to the old state here. I just hope there aren't any more such reverts; I'll take a look. I remember some rebase conflict here (for obvious reasons), so it's probably just in this case, though. Max