From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:48264) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8C6P-0004U4-Mx for qemu-devel@nongnu.org; Thu, 15 Mar 2012 10:56:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S8C6N-0008M5-QP for qemu-devel@nongnu.org; Thu, 15 Mar 2012 10:56:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41668) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8C6N-0008Lw-If for qemu-devel@nongnu.org; Thu, 15 Mar 2012 10:56:27 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q2FEuPC2012663 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 15 Mar 2012 10:56:26 -0400 Date: Thu, 15 Mar 2012 11:56:29 -0300 From: Luiz Capitulino Message-ID: <20120315115629.4f8a89cd@doriath.home> In-Reply-To: <1331765714-26209-6-git-send-email-alevy@redhat.com> References: <1331765714-26209-1-git-send-email-alevy@redhat.com> <1331765714-26209-6-git-send-email-alevy@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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: Alon Levy Cc: mlureau@redhat.com, qemu-devel@nongnu.org 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. > > 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; > } >