From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34289) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGXPB-0003s9-PQ for qemu-devel@nongnu.org; Wed, 28 Jan 2015 13:31:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YGXP6-00067r-Eu for qemu-devel@nongnu.org; Wed, 28 Jan 2015 13:31:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44693) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGXP6-00066W-8Q for qemu-devel@nongnu.org; Wed, 28 Jan 2015 13:31:52 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t0SIVnuJ019402 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 28 Jan 2015 13:31:50 -0500 Message-ID: <54C92B14.5090009@redhat.com> Date: Wed, 28 Jan 2015 13:31:48 -0500 From: John Snow MIME-Version: 1.0 References: <1422387983-32153-1-git-send-email-mreitz@redhat.com> <1422387983-32153-18-git-send-email-mreitz@redhat.com> In-Reply-To: <1422387983-32153-18-git-send-email-mreitz@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH RESEND 17/50] block: Respect empty BB in bdrv_lookup_bs() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-devel@nongnu.org Cc: Kevin Wolf , Jeff Cody , Fam Zheng , Markus Armbruster , Stefan Hajnoczi On 01/27/2015 02:45 PM, Max Reitz wrote: > blk_by_name() may return a BlockBackend for which blk_bs() returns NULL. > In this case, an error should be returned (instead of just returning > NULL without modifying *errp). > > Signed-off-by: Max Reitz > --- > block.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/block.c b/block.c > index 9a0a510..b7e631c 100644 > --- a/block.c > +++ b/block.c > @@ -3718,6 +3718,11 @@ BlockDriverState *bdrv_lookup_bs(const char *device, > blk = blk_by_name(device); > > if (blk) { > + if (!blk_bs(blk)) { > + error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device); > + return NULL; > + } > + > return blk_bs(blk); > } > } > Do we have a consensus on The One True And Proper Way to report errors? I know Markus usually campaigns against error_set() in favor of error_setg().