Received: from eggs.gnu.org ([2001:4830:134:3::10]:47689) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uobqe-00051v-Q8 for qemu-devel@nongnu.org; Mon, 17 Jun 2013 12:00:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UobqZ-00022s-K2 for qemu-devel@nongnu.org; Mon, 17 Jun 2013 12:00:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59834) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UobqZ-00022c-CL for qemu-devel@nongnu.org; Mon, 17 Jun 2013 11:59:59 -0400 From: Luiz Capitulino Date: Mon, 17 Jun 2013 11:57:06 -0400 Message-Id: <1371484631-29510-5-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1371484631-29510-1-git-send-email-lcapitulino@redhat.com> References: <1371484631-29510-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PULL 4/9] blockdev: use error_setg_file_open() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com Signed-off-by: Luiz Capitulino Reviewed-by: Stefan Hajnoczi Acked-by: Kevin Wolf --- blockdev.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/blockdev.c b/blockdev.c index 9937311..5975dde 100644 --- a/blockdev.c +++ b/blockdev.c @@ -899,7 +899,7 @@ static void external_snapshot_prepare(BlkTransactionStates *common, ret = bdrv_open(states->new_bs, new_image_file, NULL, flags | BDRV_O_NO_BACKING, drv); if (ret != 0) { - error_set(errp, QERR_OPEN_FILE_FAILED, new_image_file); + error_setg_file_open(errp, -ret, new_image_file); } } @@ -1062,8 +1062,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, NULL, bdrv_flags, drv) < 0) { - error_set(errp, QERR_OPEN_FILE_FAILED, filename); + int ret; + + ret = bdrv_open(bs, filename, NULL, bdrv_flags, drv); + if (ret < 0) { + error_setg_file_open(errp, -ret, filename); return; } @@ -1483,7 +1486,7 @@ void qmp_drive_mirror(const char *device, const char *target, if (ret < 0) { bdrv_delete(target_bs); - error_set(errp, QERR_OPEN_FILE_FAILED, target); + error_setg_file_open(errp, -ret, target); return; } -- 1.8.1.4