qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v4 0/4] Introduce error_report_{fatal|abort}


From: Peter Xu
Subject: [Qemu-devel] [PATCH v4 0/4] Introduce error_report_{fatal|abort}
Date: Wed, 7 Sep 2016 14:06:26 +0800

v4 changes:
- remove two standard headers since they are included in osdep.h
  already [Fam]
- make sure it passes build on all platforms (no --target-list
  specified during configure)

v3 changes:
- implement error_report_fatal using function [Markus]
- provide error_report_abort as well in seperate patch [Markus, Fam]

We have many use cases that first print some error messages, then
quit (by either exit() or abort()). This series introduce two helper
functions for that.

The old formats are mostly one of the following:

Case one:

  error_report(...);
  exit(1|EXIT_FAILURE) | abort();

Case two:

  error_setg(&error_{fatal|abort}, ...);

And we can convert either of the above cases into:

  error_report_{fatal|abort}(...);

Two coccinelle scripts are created to help automate the work, plus
some manual tweaks:

1. very long strings, fix for over-80-chars issues, to make sure it
   passes checkpatch.pl.

2. add "return XXX" for some non-void retcode functions.

The first two patches introduce the functions. The latter two apply
them.

Peter Xu (4):
  error-report: provide error_report_fatal()
  error-report: provide error_report_abort()
  error-report: leverage error_report_fatal()
  error-report: leverage error_report_abort()

 arch_init.c                                 |   8 +-
 block/qcow2.c                               |   4 +-
 bootdevice.c                                |   4 +-
 cpus.c                                      |   3 +-
 device_tree.c                               |  61 +++---
 hw/9pfs/9p.c                                |   3 +-
 hw/alpha/dp264.c                            |  14 +-
 hw/arm/armv7m.c                             |   3 +-
 hw/arm/digic_boards.c                       |   6 +-
 hw/arm/fsl-imx6.c                           |   5 +-
 hw/arm/highbank.c                           |   6 +-
 hw/arm/raspi.c                              |   7 +-
 hw/arm/sabrelite.c                          |   9 +-
 hw/arm/strongarm.c                          |   6 +-
 hw/arm/sysbus-fdt.c                         |  41 ++--
 hw/arm/vexpress.c                           |  14 +-
 hw/arm/virt.c                               |  45 ++---
 hw/arm/xlnx-ep108.c                         |  10 +-
 hw/block/fdc.c                              |   6 +-
 hw/block/tc58128.c                          |   3 +-
 hw/block/virtio-blk.c                       |   9 +-
 hw/char/exynos4210_uart.c                   |   9 +-
 hw/core/machine.c                           |   7 +-
 hw/core/platform-bus.c                      |   8 +-
 hw/i386/intel_iommu.c                       |   5 +-
 hw/i386/kvm/pci-assign.c                    |   4 +-
 hw/i386/pc.c                                |  36 ++--
 hw/i386/pc_piix.c                           |   3 +-
 hw/i386/x86-iommu.c                         |   5 +-
 hw/ide/core.c                               |   5 +-
 hw/intc/ioapic.c                            |   5 +-
 hw/intc/xics.c                              |   5 +-
 hw/intc/xics_kvm.c                          |  17 +-
 hw/m68k/an5206.c                            |   3 +-
 hw/microblaze/boot.c                        |   5 +-
 hw/mips/mips_fulong2e.c                     |   3 +-
 hw/mips/mips_jazz.c                         |   3 +-
 hw/mips/mips_malta.c                        |  26 ++-
 hw/mips/mips_mipssim.c                      |   6 +-
 hw/net/virtio-net.c                         |  28 ++-
 hw/nvram/fw_cfg.c                           |   5 +-
 hw/pci/pci.c                                |   8 +-
 hw/ppc/e500.c                               |   5 +-
 hw/ppc/mac_newworld.c                       |  14 +-
 hw/ppc/mac_oldworld.c                       |  18 +-
 hw/ppc/mpc8544ds.c                          |   4 +-
 hw/ppc/ppc405_boards.c                      |  14 +-
 hw/ppc/prep.c                               |  11 +-
 hw/ppc/spapr.c                              |  89 ++++-----
 hw/ppc/spapr_drc.c                          |   2 +-
 hw/ppc/virtex_ml507.c                       |   5 +-
 hw/scsi/vhost-scsi.c                        |  11 +-
 hw/scsi/virtio-scsi.c                       |  10 +-
 hw/sh4/shix.c                               |   3 +-
 hw/smbios/smbios.c                          |  42 ++---
 hw/sparc/sun4m.c                            |  19 +-
 hw/tricore/tricore_testboard.c              |   8 +-
 hw/unicore32/puv3.c                         |   9 +-
 hw/vfio/platform.c                          |  10 +-
 hw/virtio/virtio.c                          |  45 ++---
 hw/xtensa/sim.c                             |   5 +-
 hw/xtensa/xtfpga.c                          |  17 +-
 include/qemu/error-report.h                 |   2 +
 net/netmap.c                                |   5 +-
 net/tap-linux.c                             |  10 +-
 numa.c                                      |  22 +--
 qemu-img.c                                  |  16 +-
 qemu-io.c                                   |   9 +-
 qemu-nbd.c                                  | 116 +++++-------
 replay/replay-char.c                        |   9 +-
 replay/replay-events.c                      |  12 +-
 replay/replay-internal.c                    |   4 +-
 replay/replay-time.c                        |   5 +-
 replay/replay.c                             |   9 +-
 scripts/coccinelle/error_report_abort.cocci |  14 ++
 scripts/coccinelle/error_report_fatal.cocci |  20 ++
 target-arm/machine.c                        |   5 +-
 target-i386/kvm.c                           |  10 +-
 target-ppc/kvm.c                            |   7 +-
 target-ppc/translate_init.c                 |   3 +-
 target-s390x/cpu.c                          |   5 +-
 target-s390x/kvm.c                          |   8 +-
 target-s390x/mmu_helper.c                   |   5 +-
 trace/control.c                             |   6 +-
 ui/spice-core.c                             |  43 ++---
 util/qemu-error.c                           |  22 +++
 vl.c                                        | 279 +++++++++++-----------------
 xen-hvm.c                                   |   3 +-
 88 files changed, 622 insertions(+), 831 deletions(-)
 create mode 100644 scripts/coccinelle/error_report_abort.cocci
 create mode 100644 scripts/coccinelle/error_report_fatal.cocci

-- 
2.7.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]