From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:36140) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8CWy-00088l-Tf for qemu-devel@nongnu.org; Thu, 15 Mar 2012 11:24:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S8CWs-0006TW-It for qemu-devel@nongnu.org; Thu, 15 Mar 2012 11:23:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44500) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8CWs-0006QV-AE for qemu-devel@nongnu.org; Thu, 15 Mar 2012 11:23:50 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q2FFNmWF012417 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 15 Mar 2012 11:23:48 -0400 Date: Thu, 15 Mar 2012 17:23:42 +0200 From: Alon Levy Message-ID: <20120315152342.GQ5895@garlic.tlv.redhat.com> References: <1331765714-26209-1-git-send-email-alevy@redhat.com> <1331765714-26209-6-git-send-email-alevy@redhat.com> <20120315115629.4f8a89cd@doriath.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120315115629.4f8a89cd@doriath.home> Subject: Re: [Qemu-devel] [PATCH v2 5/5] blockdev: use error_set_file_open_failed List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: mlureau@redhat.com, qemu-devel@nongnu.org On Thu, Mar 15, 2012 at 11:56:29AM -0300, Luiz Capitulino wrote: > On Thu, 15 Mar 2012 00:55:14 +0200 > Alon Levy wrote: > > > This is a little trickier, since those calls chain in many fun ways and > > produce sometimes their own return values reusing existing errno values > > for similar meanings. In that respect error_set_file_open_failed > > specifically ignores EINVAL, ENOTSUP and ENOENT. The first two simply > > are not returned by open (2), but the last is but I chose to ignore it > > to allow easy reuse in blockdev to avoid confusion when it is used > > internally by the create functions. > > Please, just drop this from this series as it's completely unrelated to > the screendump command. After I went to all the trouble jumping through blockdev.c ? OK :) > > > > > Signed-off-by: Alon Levy > > --- > > blockdev.c | 11 +++++++---- > > 1 file changed, 7 insertions(+), 4 deletions(-) > > > > diff --git a/blockdev.c b/blockdev.c > > index 1a500b8..544d067 100644 > > --- a/blockdev.c > > +++ b/blockdev.c > > @@ -777,7 +777,7 @@ void qmp_transaction(BlockdevActionList *dev_list, Error **errp) > > states->old_bs->drv->format_name, > > NULL, -1, flags); > > if (ret) { > > - error_set(errp, QERR_OPEN_FILE_FAILED, new_image_file); > > + error_set_file_open_failed(errp, new_image_file, -ret); > > goto delete_and_fail; > > } > > } > > @@ -787,7 +787,7 @@ void qmp_transaction(BlockdevActionList *dev_list, Error **errp) > > ret = bdrv_open(states->new_bs, new_image_file, > > flags | BDRV_O_NO_BACKING, drv); > > if (ret != 0) { > > - error_set(errp, QERR_OPEN_FILE_FAILED, new_image_file); > > + error_set_file_open_failed(errp, new_image_file, -ret); > > goto delete_and_fail; > > } > > } > > @@ -881,8 +881,11 @@ static void qmp_bdrv_open_encrypted(BlockDriverState *bs, const char *filename, > > int bdrv_flags, BlockDriver *drv, > > const char *password, Error **errp) > > { > > - if (bdrv_open(bs, filename, bdrv_flags, drv) < 0) { > > - error_set(errp, QERR_OPEN_FILE_FAILED, filename); > > + int ret; > > + > > + ret = bdrv_open(bs, filename, bdrv_flags, drv); > > + if (ret < 0) { > > + error_set_file_open_failed(errp, filename, ret); > > return; > > } > > >