From patchwork Mon Jun 10 17:02:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 250303 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 76BEE2C008A for ; Tue, 11 Jun 2013 03:03:19 +1000 (EST) Received: from localhost ([::1]:46909 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Um5Uz-0000Fm-HH for incoming@patchwork.ozlabs.org; Mon, 10 Jun 2013 13:03:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47227) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Um5UK-0000DF-G3 for qemu-devel@nongnu.org; Mon, 10 Jun 2013 13:02:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Um5UJ-0002XV-4V for qemu-devel@nongnu.org; Mon, 10 Jun 2013 13:02:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:7678) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Um5UI-0002XK-TG for qemu-devel@nongnu.org; Mon, 10 Jun 2013 13:02:35 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r5AH2YFa018935 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 10 Jun 2013 13:02:34 -0400 Received: from localhost (ovpn-113-96.phx2.redhat.com [10.3.113.96]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r5AH2Xsb009347; Mon, 10 Jun 2013 13:02:33 -0400 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Mon, 10 Jun 2013 13:02:23 -0400 Message-Id: <1370883748-31439-5-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1370883748-31439-1-git-send-email-lcapitulino@redhat.com> References: <1370883748-31439-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, armbru@redhat.com, stefanha@redhat.com Subject: [Qemu-devel] [PATCH 4/9] blockdev: use error_setg_file_open() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Luiz Capitulino --- 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; }