From: John Snow <jsnow@redhat.com>
To: "Lluís Vilanova" <vilanova@ac.upc.edu>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Thomas Huth <thuth@redhat.com>,
"open list:Floppy" <qemu-block@nongnu.org>,
Stefan Hajnoczi <stefanha@gmail.com>,
Alexander Graf <agraf@suse.de>,
"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
"open list:sPAPR" <qemu-ppc@nongnu.org>,
Markus Armbruster <armbru@redhat.com>,
David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [Qemu-devel] [PATCH v6 2/5] util: Use new error_report_fatal/abort instead of error_setg(&error_fatal/abort)
Date: Tue, 2 Feb 2016 15:16:12 -0500 [thread overview]
Message-ID: <56B10E8C.9070605@redhat.com> (raw)
In-Reply-To: <145442964408.1539.17461121875073871332.stgit@localhost>
On 02/02/2016 11:14 AM, Lluís Vilanova wrote:
> 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 <vilanova@ac.upc.edu>
> ---
> 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]);
> }
>
Acked-by: John Snow <jsnow@redhat.com>
> parse = &(fd_formats[match]);
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 5bd8fd3..3c0f339 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -1039,7 +1039,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
> @@ -1048,7 +1048,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;
> @@ -1079,10 +1079,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 90016e6..2228124 100644
> --- a/hw/ppc/spapr_drc.c
> +++ b/hw/ppc/spapr_drc.c
> @@ -323,7 +323,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);
> }
> }
>
>
>
next prev parent reply other threads:[~2016-02-02 20:16 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-02 16:13 [Qemu-devel] [RFC][PATCH v6 0/5] utils: Improve and document error reporting Lluís Vilanova
2016-02-02 16:13 ` [Qemu-devel] [PATCH v6 1/5] util: Introduce error reporting functions with fatal/abort Lluís Vilanova
2016-02-02 18:53 ` Markus Armbruster
2016-02-02 21:47 ` Thomas Huth
2016-02-03 5:04 ` David Gibson
2016-02-03 9:48 ` Markus Armbruster
2016-02-03 9:58 ` Thomas Huth
2016-02-03 10:38 ` Markus Armbruster
2016-02-03 13:42 ` Lluís Vilanova
2016-02-03 14:34 ` Markus Armbruster
2016-02-03 15:11 ` Lluís Vilanova
2016-02-03 18:06 ` Markus Armbruster
2016-02-03 22:23 ` David Gibson
2016-02-03 7:26 ` Markus Armbruster
2016-02-03 17:59 ` Lluís Vilanova
2016-02-02 16:14 ` [Qemu-devel] [PATCH v6 2/5] util: Use new error_report_fatal/abort instead of error_setg(&error_fatal/abort) Lluís Vilanova
2016-02-02 20:16 ` John Snow [this message]
2016-02-02 16:14 ` [PATCH v6 3/5] util: [ppc] Use new error_report_fatal() instead of exit() Lluís Vilanova
2016-02-02 16:14 ` [Qemu-devel] " Lluís Vilanova
2016-02-02 16:14 ` [PATCH v6 4/5] util: [ppc] Use new error_report_abort() instead of abort() Lluís Vilanova
2016-02-02 16:14 ` [Qemu-devel] " Lluís Vilanova
2016-02-02 19:34 ` Eric Blake
2016-02-02 19:34 ` [Qemu-devel] " Eric Blake
2016-02-03 5:06 ` David Gibson
2016-02-03 5:06 ` [Qemu-devel] " David Gibson
2016-02-02 16:14 ` [Qemu-devel] [PATCH v6 5/5] doc: Introduce coding style for errors Lluís Vilanova
2016-02-02 19:10 ` Markus Armbruster
2016-02-03 13:47 ` Lluís Vilanova
2016-02-03 14:41 ` Markus Armbruster
2016-02-03 15:17 ` Lluís Vilanova
2016-02-03 15:53 ` Markus Armbruster
2016-02-03 16:58 ` Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56B10E8C.9070605@redhat.com \
--to=jsnow@redhat.com \
--cc=agraf@suse.de \
--cc=armbru@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=dgilbert@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=stefanha@gmail.com \
--cc=thuth@redhat.com \
--cc=vilanova@ac.upc.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.