From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41008) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQhN8-0007JI-Nm for qemu-devel@nongnu.org; Tue, 02 Feb 2016 15:16:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aQhN7-0003Ow-KQ for qemu-devel@nongnu.org; Tue, 02 Feb 2016 15:16:22 -0500 References: <145442963048.1539.13602468921796488810.stgit@localhost> <145442964408.1539.17461121875073871332.stgit@localhost> From: John Snow Message-ID: <56B10E8C.9070605@redhat.com> Date: Tue, 2 Feb 2016 15:16:12 -0500 MIME-Version: 1.0 In-Reply-To: <145442964408.1539.17461121875073871332.stgit@localhost> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v6 2/5] util: Use new error_report_fatal/abort instead of error_setg(&error_fatal/abort) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Llu=c3=ads_Vilanova?= , qemu-devel@nongnu.org Cc: Kevin Wolf , Thomas Huth , "open list:Floppy" , Stefan Hajnoczi , Alexander Graf , "Dr . David Alan Gilbert" , "open list:sPAPR" , Markus Armbruster , David Gibson On 02/02/2016 11:14 AM, Llu=C3=ADs 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. >=20 > Signed-off-by: Llu=C3=ADs 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(-) >=20 > 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) > =20 > /* No match of any kind found -- fd_format is misconfigured, abort= . */ > if (match =3D=3D -1) { > - error_setg(&error_abort, "No candidate geometries present in t= able " > - " 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]); > } > =20 Acked-by: John Snow > parse =3D &(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 *s= papr) > * 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 *s= papr) > * but we don't allow booting of such guests. > */ > if (shift !=3D spapr->htab_shift) { > - error_setg(&error_abort, "Failed to allocate HTAB of reque= sted size, try with smaller maxmem"); > + error_report_abort("Failed to allocate HTAB of requested s= ize, try with smaller maxmem"); > } > =20 > spapr->htab_shift =3D shift; > @@ -1079,10 +1079,10 @@ static void spapr_reset_htab(sPAPRMachineState = *spapr) > =20 > shift =3D 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 !=3D spapr->htab_shift) { > - error_setg(&error_abort, "Requested HTAB allocation failed= during reset"); > + error_report_abort("Requested HTAB allocation failed durin= g reset"); > } > =20 > /* 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, v= oid *opaque, > break; > } > default: > - error_setg(&error_abort, "device FDT in unexpected state: = %d", tag); > + error_report_abort("device FDT in unexpected state: %d", t= ag); > } > fdt_offset =3D fdt_offset_next; > } while (fdt_depth !=3D 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; > =20 > 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 =3D=3D &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 =3D=3D &error_fatal) { > - error_report_err(err); > - exit(1); > + error_report_fatal("%s", err->msg); > } > } > =20 >=20 >=20