All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
To: Alistair Francis <alistair.francis@xilinx.com>,
	qemu-devel@nongnu.org, qemu-trivial@nongnu.org
Cc: alistair23@gmail.com, armbru@redhat.com,
	Fabien Chouteau <chouteau@adacore.com>,
	Artyom Tarasenko <atar4qemu@gmail.com>
Subject: Re: [Qemu-devel] [PATCH v5 24/29] hw/sparc*: Replace fprintf(stderr, "*\n" with error_report()
Date: Fri, 17 Nov 2017 13:45:18 +0000	[thread overview]
Message-ID: <abbeaa0a-2023-7f04-41b2-cd9837acb8e4@ilande.co.uk> (raw)
In-Reply-To: <a78b2c8879bded4abe59b71d7e9fb172e784a35d.1510612380.git.alistair.francis@xilinx.com>

On 13/11/17 22:35, Alistair Francis wrote:

> Replace a large number of the fprintf(stderr, "*\n" calls with
> error_report(). The functions were renamed with these commands and then
> compiler issues where manually fixed.
> 
> find ./* -type f -exec sed -i \
>     'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
>     {} +
> find ./* -type f -exec sed -i \
>     'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
>     {} +
> find ./* -type f -exec sed -i \
>     'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
>     {} +
> find ./* -type f -exec sed -i \
>     'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
>     {} +
> find ./* -type f -exec sed -i \
>     'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
>     {} +
> find ./* -type f -exec sed -i \
>     'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
>     {} +
> find ./* -type f -exec sed -i \
>     'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
>     {} +
> find ./* -type f -exec sed -i \
>     'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
>     {} +
> find ./* -type f -exec sed -i \
>     'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
>     {} +
> find ./* -type f -exec sed -i \
>     'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
>     {} +
> find ./* -type f -exec sed -i \
>     'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
>     {} +
> 
> Some lines where then manually tweaked to pass checkpatch.
> 
> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
> Cc: Fabien Chouteau <chouteau@adacore.com>
> Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> Cc: Artyom Tarasenko <atar4qemu@gmail.com>
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> V2:
>  - Split hw patch into individual directories
> 
>  hw/sparc/leon3.c     | 16 +++++++---------
>  hw/sparc/sun4m.c     | 16 +++++++---------
>  hw/sparc64/niagara.c |  4 ++--
>  hw/sparc64/sun4u.c   | 10 +++++-----
>  4 files changed, 21 insertions(+), 25 deletions(-)
> 
> diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c
> index 8c66d5af24..bba3aa3dee 100644
> --- a/hw/sparc/leon3.c
> +++ b/hw/sparc/leon3.c
> @@ -22,6 +22,7 @@
>   * THE SOFTWARE.
>   */
>  #include "qemu/osdep.h"
> +#include "qemu/error-report.h"
>  #include "qapi/error.h"
>  #include "qemu-common.h"
>  #include "cpu.h"
> @@ -139,9 +140,8 @@ static void leon3_generic_hw_init(MachineState *machine)
>  
>      /* Allocate RAM */
>      if ((uint64_t)ram_size > (1UL << 30)) {
> -        fprintf(stderr,
> -                "qemu: Too much memory for this machine: %d, maximum 1G\n",
> -                (unsigned int)(ram_size / (1024 * 1024)));
> +        error_report("Too much memory for this machine: %d, maximum 1G",
> +                     (unsigned int)(ram_size / (1024 * 1024)));
>          exit(1);
>      }
>  
> @@ -167,19 +167,18 @@ static void leon3_generic_hw_init(MachineState *machine)
>      }
>  
>      if (bios_size > prom_size) {
> -        fprintf(stderr, "qemu: could not load prom '%s': file too big\n",
> -                filename);
> +        error_report("could not load prom '%s': file too big", filename);
>          exit(1);
>      }
>  
>      if (bios_size > 0) {
>          ret = load_image_targphys(filename, 0x00000000, bios_size);
>          if (ret < 0 || ret > prom_size) {
> -            fprintf(stderr, "qemu: could not load prom '%s'\n", filename);
> +            error_report("could not load prom '%s'", filename);
>              exit(1);
>          }
>      } else if (kernel_filename == NULL && !qtest_enabled()) {
> -        fprintf(stderr, "Can't read bios image %s\n", filename);
> +        error_report("Can't read bios image %s", filename);
>          exit(1);
>      }
>      g_free(filename);
> @@ -192,8 +191,7 @@ static void leon3_generic_hw_init(MachineState *machine)
>          kernel_size = load_elf(kernel_filename, NULL, NULL, &entry, NULL, NULL,
>                                 1 /* big endian */, EM_SPARC, 0, 0);
>          if (kernel_size < 0) {
> -            fprintf(stderr, "qemu: could not load kernel '%s'\n",
> -                    kernel_filename);
> +            error_report("could not load kernel '%s'", kernel_filename);
>              exit(1);
>          }
>          if (bios_size <= 0) {
> diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
> index 24c2b8a555..e9e0ef0630 100644
> --- a/hw/sparc/sun4m.c
> +++ b/hw/sparc/sun4m.c
> @@ -260,8 +260,7 @@ static unsigned long sun4m_load_kernel(const char *kernel_filename,
>                                                KERNEL_LOAD_ADDR,
>                                                RAM_size - KERNEL_LOAD_ADDR);
>          if (kernel_size < 0) {
> -            fprintf(stderr, "qemu: could not load kernel '%s'\n",
> -                    kernel_filename);
> +            error_report("could not load kernel '%s'", kernel_filename);
>              exit(1);
>          }
>  
> @@ -272,8 +271,8 @@ static unsigned long sun4m_load_kernel(const char *kernel_filename,
>                                                INITRD_LOAD_ADDR,
>                                                RAM_size - INITRD_LOAD_ADDR);
>              if (initrd_size < 0) {
> -                fprintf(stderr, "qemu: could not load initial ram disk '%s'\n",
> -                        initrd_filename);
> +                error_report("could not load initial ram disk '%s'",
> +                             initrd_filename);
>                  exit(1);
>              }
>          }
> @@ -681,7 +680,7 @@ static void prom_init(hwaddr addr, const char *bios_name)
>          ret = -1;
>      }
>      if (ret < 0 || ret > PROM_SIZE_MAX) {
> -        fprintf(stderr, "qemu: could not load prom '%s'\n", bios_name);
> +        error_report("could not load prom '%s'", bios_name);
>          exit(1);
>      }
>  }
> @@ -747,10 +746,9 @@ static void ram_init(hwaddr addr, ram_addr_t RAM_size,
>  
>      /* allocate RAM */
>      if ((uint64_t)RAM_size > max_mem) {
> -        fprintf(stderr,
> -                "qemu: Too much memory for this machine: %d, maximum %d\n",
> -                (unsigned int)(RAM_size / (1024 * 1024)),
> -                (unsigned int)(max_mem / (1024 * 1024)));
> +        error_report("Too much memory for this machine: %d, maximum %d",
> +                     (unsigned int)(RAM_size / (1024 * 1024)),
> +                     (unsigned int)(max_mem / (1024 * 1024)));
>          exit(1);
>      }
>      dev = qdev_create(NULL, "memory");
> diff --git a/hw/sparc64/niagara.c b/hw/sparc64/niagara.c
> index 7a723326c5..996ce2ada0 100644
> --- a/hw/sparc64/niagara.c
> +++ b/hw/sparc64/niagara.c
> @@ -152,8 +152,8 @@ static void niagara_init(MachineState *machine)
>              dinfo->is_default = 1;
>              rom_add_file_fixed(blk_bs(blk)->filename, NIAGARA_VDISK_BASE, -1);
>          } else {
> -            fprintf(stderr, "qemu: could not load ram disk '%s'\n",
> -                    blk_bs(blk)->filename);
> +            error_report("could not load ram disk '%s'",
> +                         blk_bs(blk)->filename);
>              exit(1);
>          }
>      }
> diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
> index 1672f256e7..1fd1c3c861 100644
> --- a/hw/sparc64/sun4u.c
> +++ b/hw/sparc64/sun4u.c
> @@ -22,6 +22,7 @@
>   * THE SOFTWARE.
>   */
>  #include "qemu/osdep.h"
> +#include "qemu/error-report.h"
>  #include "qapi/error.h"
>  #include "qemu-common.h"
>  #include "cpu.h"
> @@ -166,8 +167,7 @@ static uint64_t sun4u_load_kernel(const char *kernel_filename,
>                                                RAM_size - KERNEL_LOAD_ADDR);
>          }
>          if (kernel_size < 0) {
> -            fprintf(stderr, "qemu: could not load kernel '%s'\n",
> -                    kernel_filename);
> +            error_report("could not load kernel '%s'", kernel_filename);
>              exit(1);
>          }
>          /* load initrd above kernel */
> @@ -179,8 +179,8 @@ static uint64_t sun4u_load_kernel(const char *kernel_filename,
>                                                 *initrd_addr,
>                                                 RAM_size - *initrd_addr);
>              if ((int)*initrd_size < 0) {
> -                fprintf(stderr, "qemu: could not load initial ram disk '%s'\n",
> -                        initrd_filename);
> +                error_report("could not load initial ram disk '%s'",
> +                             initrd_filename);
>                  exit(1);
>              }
>          }
> @@ -327,7 +327,7 @@ static void prom_init(hwaddr addr, const char *bios_name)
>          ret = -1;
>      }
>      if (ret < 0 || ret > PROM_SIZE_MAX) {
> -        fprintf(stderr, "qemu: could not load prom '%s'\n", bios_name);
> +        error_report("could not load prom '%s'", bios_name);
>          exit(1);
>      }
>  }

Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>


ATB,

Mark.

  reply	other threads:[~2017-11-17 13:45 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-13 22:34 [Qemu-devel] [PATCH v5 00/29] Remove some of the fprintf(stderr, "* Alistair Francis
2017-11-13 22:34 ` [Qemu-devel] [PATCH v5 01/29] audio: Replace AUDIO_FUNC with __func__ Alistair Francis
2017-11-14  9:55   ` Gerd Hoffmann
2017-11-13 22:34 ` [Qemu-devel] [PATCH v5 02/29] Replace all occurances of __FUNCTION__ " Alistair Francis
2017-11-13 22:34   ` Alistair Francis
2017-11-14  9:56   ` [Qemu-devel] " Gerd Hoffmann
2017-11-14  9:56   ` Gerd Hoffmann
2017-11-13 22:34 ` [Qemu-devel] [PATCH v5 03/29] Fixes after renaming __FUNCTION__ to __func__ Alistair Francis
2017-11-13 22:34 ` [Qemu-devel] [PATCH v5 04/29] hw/arm: Replace fprintf(stderr, "*\n" with error_report() Alistair Francis
2017-11-13 22:34 ` [Qemu-devel] [PATCH v5 05/29] hw/dma: " Alistair Francis
2017-11-13 22:34 ` [Qemu-devel] [PATCH v5 06/29] hw/gpio: " Alistair Francis
2017-11-13 22:34 ` [Qemu-devel] [PATCH v5 07/29] hw/i2c: " Alistair Francis
2017-11-13 22:35 ` [Qemu-devel] [PATCH v5 09/29] hw/ide: " Alistair Francis
2017-11-13 22:35 ` [Qemu-devel] [PATCH v5 10/29] hw/intc: " Alistair Francis
2017-11-13 22:35 ` [Qemu-devel] [PATCH v5 11/29] hw/ipmi: " Alistair Francis
2017-11-13 22:35 ` [Qemu-devel] [PATCH v5 12/29] hw/isa: " Alistair Francis
2017-11-13 22:35 ` [Qemu-devel] [PATCH v5 13/29] hw/lm32: " Alistair Francis
2017-11-14  6:54   ` Michael Walle
2017-11-13 22:35 ` [Qemu-devel] [PATCH v5 14/29] hw/mips: " Alistair Francis
2017-11-13 22:35 ` [Qemu-devel] [PATCH v5 15/29] hw/moxie: " Alistair Francis
2017-11-14  7:53   ` Thomas Huth
2017-11-13 22:35 ` [Qemu-devel] [PATCH v5 16/29] hw/nios2: " Alistair Francis
2017-11-13 22:35 ` [Qemu-devel] [PATCH v5 17/29] hw/nvram: " Alistair Francis
2017-11-13 23:56   ` [Qemu-devel] [Qemu-trivial] " Philippe Mathieu-Daudé
2017-11-13 22:35 ` [Qemu-devel] [PATCH v5 18/29] hw/openrisc: " Alistair Francis
2017-11-13 22:35 ` [Qemu-devel] [PATCH v5 19/29] hw/pci*: " Alistair Francis
2017-11-13 22:35 ` [Qemu-devel] [PATCH v5 20/29] hw/ppc: " Alistair Francis
2017-11-14  8:30   ` [Qemu-devel] [Qemu-ppc] " Thomas Huth
2017-11-13 22:35 ` [Qemu-devel] [PATCH v5 21/29] hw/s390x: " Alistair Francis
2017-11-13 22:35 ` [Qemu-devel] [PATCH v5 22/29] hw/scsi: " Alistair Francis
2017-11-13 22:35 ` [Qemu-devel] [PATCH v5 23/29] hw/sd: " Alistair Francis
2017-11-13 22:35 ` [Qemu-devel] [PATCH v5 24/29] hw/sparc*: " Alistair Francis
2017-11-17 13:45   ` Mark Cave-Ayland [this message]
2017-11-13 22:36 ` [Qemu-devel] [PATCH v5 25/29] hw/ssi: " Alistair Francis
2017-11-13 22:36 ` [Qemu-devel] [PATCH v5 26/29] hw/timer: " Alistair Francis
2017-11-14  7:51   ` Thomas Huth
2017-11-13 22:36 ` [Qemu-devel] [PATCH v5 27/29] hw/xen*: " Alistair Francis
2017-11-14  7:47   ` Thomas Huth
2017-11-13 22:36 ` [Qemu-devel] [PATCH v5 28/29] tcg: " Alistair Francis
2017-11-14  7:44   ` Thomas Huth
2017-11-13 22:36 ` [Qemu-devel] [PATCH v5 29/29] target: Use qemu_log() instead of fprintf(stderr, ...) Alistair Francis
2017-11-14  7:40   ` Thomas Huth
2017-12-19 22:43     ` Alistair Francis

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=abbeaa0a-2023-7f04-41b2-cd9837acb8e4@ilande.co.uk \
    --to=mark.cave-ayland@ilande.co.uk \
    --cc=alistair.francis@xilinx.com \
    --cc=alistair23@gmail.com \
    --cc=armbru@redhat.com \
    --cc=atar4qemu@gmail.com \
    --cc=chouteau@adacore.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /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.