From 4aeb6d14385793a46b11d4d129bbad6c9fe9132b Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Thu, 31 Oct 2013 16:29:26 +0100 Subject: [PATCH 07/29] blockdev: use error_setg_file_open() RH-Author: Laszlo Ersek Message-id: <1383236971-6067-4-git-send-email-lersek@redhat.com> Patchwork-id: 55193 O-Subject: [RHEL-7 qemu-kvm PATCH 3/8] blockdev: use error_setg_file_open() Bugzilla: 907743 RH-Acked-by: Luiz Capitulino RH-Acked-by: Kevin Wolf RH-Acked-by: Paolo Bonzini From: Luiz Capitulino Signed-off-by: Luiz Capitulino Reviewed-by: Stefan Hajnoczi Acked-by: Kevin Wolf (cherry picked from commit 0eef407c7b4130d13138c1f75d9975165433f654) Signed-off-by: Laszlo Ersek --- blockdev.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) Signed-off-by: Miroslav Rezanina --- blockdev.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/blockdev.c b/blockdev.c index 073f553..f65aff4 100644 --- a/blockdev.c +++ b/blockdev.c @@ -950,7 +950,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); } } @@ -1113,8 +1113,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; } @@ -1526,7 +1529,7 @@ void qmp_drive_mirror(const char *device, const char *target, ret = bdrv_open(target_bs, target, NULL, flags | BDRV_O_NO_BACKING, drv); if (ret < 0) { bdrv_delete(target_bs); - error_set(errp, QERR_OPEN_FILE_FAILED, target); + error_setg_file_open(errp, -ret, target); return; } -- 1.7.1