From patchwork Thu Jan 28 21:41:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Llu=C3=ADs_Vilanova?= X-Patchwork-Id: 8154221 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BB6A59FBF9 for ; Thu, 28 Jan 2016 21:42:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1251B2020F for ; Thu, 28 Jan 2016 21:42:00 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3ACD720320 for ; Thu, 28 Jan 2016 21:41:59 +0000 (UTC) Received: from localhost ([::1]:58654 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOuKE-0003G6-Hu for patchwork-qemu-devel@patchwork.kernel.org; Thu, 28 Jan 2016 16:41:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45933) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOuJy-0003AO-Ok for qemu-devel@nongnu.org; Thu, 28 Jan 2016 16:41:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aOuJx-0001N2-OE for qemu-devel@nongnu.org; Thu, 28 Jan 2016 16:41:42 -0500 Received: from roura.ac.upc.es ([147.83.33.10]:37165) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOuJv-0001LY-4s; Thu, 28 Jan 2016 16:41:39 -0500 Received: from gw-2.ac.upc.es (gw-2.ac.upc.es [147.83.30.8]) by roura.ac.upc.es (8.13.8/8.13.8) with ESMTP id u0SLfQDI020231; Thu, 28 Jan 2016 22:41:27 +0100 Received: from localhost (unknown [84.88.51.85]) by gw-2.ac.upc.es (Postfix) with ESMTPSA id 8E16EA6; Thu, 28 Jan 2016 22:41:26 +0100 (CET) From: =?utf-8?b?TGx1w61z?= Vilanova To: qemu-devel@nongnu.org Date: Thu, 28 Jan 2016 22:41:26 +0100 Message-Id: <145401728613.31479.17627158740103188761.stgit@localhost> X-Mailer: git-send-email 2.7.0.rc3 In-Reply-To: <145401727502.31479.11571397180565966513.stgit@localhost> References: <145401727502.31479.11571397180565966513.stgit@localhost> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by roura.ac.upc.es id u0SLfQDI020231 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 147.83.33.10 Cc: Kevin Wolf , Alexander Graf , Thomas Huth , "open list:Floppy" , Stefan Hajnoczi , "Dr . David Alan Gilbert" , Markus Armbruster , "open list:sPAPR" , John Snow , David Gibson Subject: [Qemu-devel] [PATCH v4 2/5] util: Use new error_report_fatal/abort instead of error_setg(&error_fatal/abort) 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Replaces all direct uses of 'error_setg(&error_fatal/abort)' with 'error_report_fatal/abort'. Also reimplements the former on top of the latter. Signed-off-by: LluĂ­s Vilanova --- hw/block/fdc.c | 6 +++--- hw/ppc/spapr.c | 8 ++++---- hw/ppc/spapr_drc.c | 2 +- util/error.c | 9 +++------ 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/hw/block/fdc.c b/hw/block/fdc.c index e3b0e1e..8f0c947 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -347,9 +347,9 @@ static int pick_geometry(FDrive *drv) /* No match of any kind found -- fd_format is misconfigured, abort. */ if (match == -1) { - error_setg(&error_abort, "No candidate geometries present in table " - " for floppy drive type '%s'", - FloppyDriveType_lookup[drv->drive]); + error_report_abort("No candidate geometries present in table " + " for floppy drive type '%s'", + FloppyDriveType_lookup[drv->drive]); } parse = &(fd_formats[match]); diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 50e5a26..a5afea1 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1031,7 +1031,7 @@ static void spapr_alloc_htab(sPAPRMachineState *spapr) * For HV KVM, host kernel will return -ENOMEM when requested * HTAB size can't be allocated. */ - error_setg(&error_abort, "Failed to allocate HTAB of requested size, try with smaller maxmem"); + error_report_abort("Failed to allocate HTAB of requested size, try with smaller maxmem"); } else if (shift > 0) { /* * Kernel handles htab, we don't need to allocate one @@ -1040,7 +1040,7 @@ static void spapr_alloc_htab(sPAPRMachineState *spapr) * but we don't allow booting of such guests. */ if (shift != spapr->htab_shift) { - error_setg(&error_abort, "Failed to allocate HTAB of requested size, try with smaller maxmem"); + error_report_abort("Failed to allocate HTAB of requested size, try with smaller maxmem"); } spapr->htab_shift = shift; @@ -1071,10 +1071,10 @@ static void spapr_reset_htab(sPAPRMachineState *spapr) shift = kvmppc_reset_htab(spapr->htab_shift); if (shift < 0) { - error_setg(&error_abort, "Failed to reset HTAB"); + error_report_abort("Failed to reset HTAB"); } else if (shift > 0) { if (shift != spapr->htab_shift) { - error_setg(&error_abort, "Requested HTAB allocation failed during reset"); + error_report_abort("Requested HTAB allocation failed during reset"); } /* Tell readers to update their file descriptor */ diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index dccb908..0d8f5b4 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -322,7 +322,7 @@ static void prop_get_fdt(Object *obj, Visitor *v, void *opaque, break; } default: - error_setg(&error_abort, "device FDT in unexpected state: %d", tag); + error_report_abort("device FDT in unexpected state: %d", tag); } fdt_offset = fdt_offset_next; } while (fdt_depth != 0); diff --git a/util/error.c b/util/error.c index 57303fd..b8a9120 100644 --- a/util/error.c +++ b/util/error.c @@ -30,15 +30,12 @@ Error *error_fatal; static void error_handle_fatal(Error **errp, Error *err) { + /* None of them has a hint, so error_report_err() is not necessary here */ if (errp == &error_abort) { - fprintf(stderr, "Unexpected error in %s() at %s:%d:\n", - err->func, err->src, err->line); - error_report_err(err); - abort(); + error_report_abort_internal("%s", err->msg); } if (errp == &error_fatal) { - error_report_err(err); - exit(1); + error_report_fatal("%s", err->msg); } }