qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 24/47] hw/mips: Replace fprintf(stderr, "*\n"


From: Thomas Huth
Subject: Re: [Qemu-devel] [PATCH v2 24/47] hw/mips: Replace fprintf(stderr, "*\n" with error_report()
Date: Mon, 16 Oct 2017 13:46:58 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

On 30.09.2017 02:16, 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 <address@hidden>
> Cc: Paul Burton <address@hidden>
> Cc: Aurelien Jarno <address@hidden>
> Cc: Yongbok Kim <address@hidden>
> Cc: "Hervé Poussineau" <address@hidden>
> ---
> V2:
>  - Split hw patch into individual directories
> 
>  hw/mips/boston.c        | 4 ++--
>  hw/mips/mips_fulong2e.c | 4 ++--
>  hw/mips/mips_jazz.c     | 4 ++--
>  hw/mips/mips_malta.c    | 4 ++--
>  hw/mips/mips_mipssim.c  | 4 ++--
>  hw/mips/mips_r4k.c      | 6 +++---
>  6 files changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/hw/mips/boston.c b/hw/mips/boston.c
> index 776ee283e1..ee82968ea7 100644
> --- a/hw/mips/boston.c
> +++ b/hw/mips/boston.c
> @@ -353,7 +353,7 @@ static const void *boston_fdt_filter(void *opaque, const 
> void *fdt_orig,
>  
>      err = fdt_open_into(fdt_orig, fdt, fdt_sz);
>      if (err) {
> -        fprintf(stderr, "unable to open FDT\n");
> +        error_report("unable to open FDT");
>          return NULL;
>      }
>  
> @@ -361,7 +361,7 @@ static const void *boston_fdt_filter(void *opaque, const 
> void *fdt_orig,
>              ? machine->kernel_cmdline : " ";
>      err = qemu_fdt_setprop_string(fdt, "/chosen", "bootargs", cmdline);
>      if (err < 0) {
> -        fprintf(stderr, "couldn't set /chosen/bootargs\n");
> +        error_report("couldn't set /chosen/bootargs");
>          return NULL;
>      }
>  
> diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
> index 75318680e1..34710a466c 100644
> --- a/hw/mips/mips_fulong2e.c
> +++ b/hw/mips/mips_fulong2e.c
> @@ -143,7 +143,7 @@ static int64_t load_kernel (CPUMIPSState *env)
>                                       initrd_offset, ram_size - 
> initrd_offset);
>          }
>          if (initrd_size == (target_ulong) -1) {
> -            fprintf(stderr, "qemu: could not load initial ram disk '%s'\n",
> +            error_report("qemu: could not load initial ram disk '%s'",
>                      loaderparams.initrd_filename);
>              exit(1);
>          }
> @@ -342,7 +342,7 @@ static void mips_fulong2e_init(MachineState *machine)
>  
>      isa_bus = vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 0));
>      if (!isa_bus) {
> -        fprintf(stderr, "vt82c686b_init error\n");
> +        error_report("vt82c686b_init error");
>          exit(1);
>      }
>  
> diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
> index 7e6626dc88..6c91a940be 100644
> --- a/hw/mips/mips_jazz.c
> +++ b/hw/mips/mips_jazz.c
> @@ -271,10 +271,10 @@ static void mips_jazz_init(MachineState *machine,
>              sysbus_connect_irq(sysbus, 0, qdev_get_gpio_in(rc4030, 4));
>              break;
>          } else if (is_help_option(nd->model)) {
> -            fprintf(stderr, "qemu: Supported NICs: dp83932\n");
> +            error_report("qemu: Supported NICs: dp83932");
>              exit(1);
>          } else {
> -            fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd->model);
> +            error_report("qemu: Unsupported NIC: %s", nd->model);
>              exit(1);
>          }
>      }
> diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
> index 2adb9bcf89..d457adfa69 100644
> --- a/hw/mips/mips_malta.c
> +++ b/hw/mips/mips_malta.c
> @@ -856,8 +856,8 @@ static int64_t load_kernel (void)
>                                                ram_size - initrd_offset);
>          }
>          if (initrd_size == (target_ulong) -1) {
> -            fprintf(stderr, "qemu: could not load initial ram disk '%s'\n",
> -                    loaderparams.initrd_filename);
> +            error_report("qemu: could not load initial ram disk '%s'",
> +                         loaderparams.initrd_filename);
>              exit(1);
>          }
>      }
> diff --git a/hw/mips/mips_mipssim.c b/hw/mips/mips_mipssim.c
> index a092072e2a..a3d9406610 100644
> --- a/hw/mips/mips_mipssim.c
> +++ b/hw/mips/mips_mipssim.c
> @@ -101,8 +101,8 @@ static int64_t load_kernel(void)
>                  initrd_offset, loaderparams.ram_size - initrd_offset);
>          }
>          if (initrd_size == (target_ulong) -1) {
> -            fprintf(stderr, "qemu: could not load initial ram disk '%s'\n",
> -                    loaderparams.initrd_filename);
> +            error_report("qemu: could not load initial ram disk '%s'",
> +                         loaderparams.initrd_filename);
>              exit(1);
>          }
>      }
> diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c
> index 1272d4ef9d..e54ce918a7 100644
> --- a/hw/mips/mips_r4k.c
> +++ b/hw/mips/mips_r4k.c
> @@ -121,8 +121,8 @@ static int64_t load_kernel(void)
>                                                ram_size - initrd_offset);
>          }
>          if (initrd_size == (target_ulong) -1) {
> -            fprintf(stderr, "qemu: could not load initial ram disk '%s'\n",
> -                    loaderparams.initrd_filename);
> +            error_report("qemu: could not load initial ram disk '%s'",
> +                         loaderparams.initrd_filename);
>              exit(1);
>          }
>      }
> @@ -246,7 +246,7 @@ void mips_r4k_init(MachineState *machine)
>                                     blk_by_legacy_dinfo(dinfo),
>                                     sector_len, mips_rom / sector_len,
>                                     4, 0, 0, 0, 0, be)) {
> -            fprintf(stderr, "qemu: Error registering flash memory.\n");
> +            error_report("qemu: Error registering flash memory.");
>       }
>      } else if (!qtest_enabled()) {
>          /* not fatal */
> 

Please remove the "qemu:" prefixes from the strings here, too.

 Thomas



reply via email to

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