From patchwork Tue Feb 6 19:50:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 870066 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zbbSh0yGBz9s7F for ; Wed, 7 Feb 2018 07:21:08 +1100 (AEDT) Received: from localhost ([::1]:56352 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ej9jm-0005la-2c for incoming@patchwork.ozlabs.org; Tue, 06 Feb 2018 15:21:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56382) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ej9Ga-00032z-1l for qemu-devel@nongnu.org; Tue, 06 Feb 2018 14:50:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ej9GW-0003sq-S4 for qemu-devel@nongnu.org; Tue, 06 Feb 2018 14:50:55 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:50526 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ej9GW-0003rf-IE for qemu-devel@nongnu.org; Tue, 06 Feb 2018 14:50:52 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9363640363BB; Tue, 6 Feb 2018 19:50:50 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-148.ams2.redhat.com [10.36.116.148]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 28FDB2024CA2; Tue, 6 Feb 2018 19:50:50 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id D21811138650; Tue, 6 Feb 2018 20:50:44 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Tue, 6 Feb 2018 20:50:36 +0100 Message-Id: <20180206195044.8347-7-armbru@redhat.com> In-Reply-To: <20180206195044.8347-1-armbru@redhat.com> References: <20180206195044.8347-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 06 Feb 2018 19:50:50 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 06 Feb 2018 19:50:50 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'armbru@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 06/14] hw/mips: Replace fprintf(stderr, "*\n" with error_report() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yongbok Kim , =?utf-8?q?Herv=C3=A9_Poussineau?= , Aurelien Jarno , Paul Burton , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Alistair Francis 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 Cc: Paul Burton Cc: Aurelien Jarno Cc: Yongbok Kim Cc: "Hervé Poussineau" Conversions that aren't followed by exit() dropped, because they might be inappropriate. Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20180203084315.20497-6-armbru@redhat.com> --- hw/mips/mips_fulong2e.c | 13 ++++++------- hw/mips/mips_jazz.c | 4 ++-- hw/mips/mips_malta.c | 16 +++++++--------- hw/mips/mips_mipssim.c | 11 +++++------ hw/mips/mips_r4k.c | 16 +++++++--------- 5 files changed, 27 insertions(+), 33 deletions(-) diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index 725e25a134..f68c625666 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -120,7 +120,7 @@ static int64_t load_kernel (CPUMIPSState *env) (uint64_t *)&kernel_low, (uint64_t *)&kernel_high, 0, EM_MIPS, 1, 0); if (kernel_size < 0) { - error_report("qemu: could not load kernel '%s': %s", + error_report("could not load kernel '%s': %s", loaderparams.kernel_filename, load_elf_strerror(kernel_size)); exit(1); @@ -134,17 +134,16 @@ static int64_t load_kernel (CPUMIPSState *env) if (initrd_size > 0) { initrd_offset = (kernel_high + ~INITRD_PAGE_MASK) & INITRD_PAGE_MASK; if (initrd_offset + initrd_size > ram_size) { - fprintf(stderr, - "qemu: memory too small for initial ram disk '%s'\n", - loaderparams.initrd_filename); + error_report("memory too small for initial ram disk '%s'", + loaderparams.initrd_filename); exit(1); } initrd_size = load_image_targphys(loaderparams.initrd_filename, initrd_offset, 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("could not load initial ram disk '%s'", + loaderparams.initrd_filename); exit(1); } } @@ -338,7 +337,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 0d2c0683ba..596f3c210e 100644 --- a/hw/mips/mips_jazz.c +++ b/hw/mips/mips_jazz.c @@ -268,10 +268,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("Supported NICs: dp83932"); exit(1); } else { - fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd->model); + error_report("Unsupported NIC: %s", nd->model); exit(1); } } diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 37f19428d6..7ca8ba2086 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -812,7 +812,7 @@ static int64_t load_kernel (void) NULL, (uint64_t *)&kernel_entry, NULL, (uint64_t *)&kernel_high, big_endian, EM_MIPS, 1, 0); if (kernel_size < 0) { - error_report("qemu: could not load kernel '%s': %s", + error_report("could not load kernel '%s': %s", loaderparams.kernel_filename, load_elf_strerror(kernel_size)); exit(1); @@ -846,9 +846,8 @@ static int64_t load_kernel (void) initrd_offset = (loaderparams.ram_low_size - initrd_size - 131072 - ~INITRD_PAGE_MASK) & INITRD_PAGE_MASK; if (kernel_high >= initrd_offset) { - fprintf(stderr, - "qemu: memory too small for initial ram disk '%s'\n", - loaderparams.initrd_filename); + error_report("memory too small for initial ram disk '%s'", + loaderparams.initrd_filename); exit(1); } initrd_size = load_image_targphys(loaderparams.initrd_filename, @@ -856,8 +855,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("could not load initial ram disk '%s'", + loaderparams.initrd_filename); exit(1); } } @@ -1034,9 +1033,8 @@ void mips_malta_init(MachineState *machine) /* allocate RAM */ if (ram_size > (2048u << 20)) { - fprintf(stderr, - "qemu: Too much memory for this machine: %d MB, maximum 2048 MB\n", - ((unsigned int)ram_size / (1 << 20))); + error_report("Too much memory for this machine: %dMB, maximum 2048MB", + ((unsigned int)ram_size / (1 << 20))); exit(1); } diff --git a/hw/mips/mips_mipssim.c b/hw/mips/mips_mipssim.c index e5d3654586..e0ba5efc84 100644 --- a/hw/mips/mips_mipssim.c +++ b/hw/mips/mips_mipssim.c @@ -78,7 +78,7 @@ static int64_t load_kernel(void) if ((entry & ~0x7fffffffULL) == 0x80000000) entry = (int32_t)entry; } else { - error_report("qemu: could not load kernel '%s': %s", + error_report("could not load kernel '%s': %s", loaderparams.kernel_filename, load_elf_strerror(kernel_size)); exit(1); @@ -92,17 +92,16 @@ static int64_t load_kernel(void) if (initrd_size > 0) { initrd_offset = (kernel_high + ~INITRD_PAGE_MASK) & INITRD_PAGE_MASK; if (initrd_offset + initrd_size > loaderparams.ram_size) { - fprintf(stderr, - "qemu: memory too small for initial ram disk '%s'\n", - loaderparams.initrd_filename); + error_report("memory too small for initial ram disk '%s'", + loaderparams.initrd_filename); exit(1); } initrd_size = load_image_targphys(loaderparams.initrd_filename, 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("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 244bd41813..830ee7732c 100644 --- a/hw/mips/mips_r4k.c +++ b/hw/mips/mips_r4k.c @@ -98,7 +98,7 @@ static int64_t load_kernel(void) if ((entry & ~0x7fffffffULL) == 0x80000000) entry = (int32_t)entry; } else { - error_report("qemu: could not load kernel '%s': %s", + error_report("could not load kernel '%s': %s", loaderparams.kernel_filename, load_elf_strerror(kernel_size)); exit(1); @@ -112,9 +112,8 @@ static int64_t load_kernel(void) if (initrd_size > 0) { initrd_offset = (kernel_high + ~INITRD_PAGE_MASK) & INITRD_PAGE_MASK; if (initrd_offset + initrd_size > ram_size) { - fprintf(stderr, - "qemu: memory too small for initial ram disk '%s'\n", - loaderparams.initrd_filename); + error_report("memory too small for initial ram disk '%s'", + loaderparams.initrd_filename); exit(1); } initrd_size = load_image_targphys(loaderparams.initrd_filename, @@ -122,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("could not load initial ram disk '%s'", + loaderparams.initrd_filename); exit(1); } } @@ -196,9 +195,8 @@ void mips_r4k_init(MachineState *machine) /* allocate RAM */ if (ram_size > (256 << 20)) { - fprintf(stderr, - "qemu: Too much memory for this machine: %d MB, maximum 256 MB\n", - ((unsigned int)ram_size / (1 << 20))); + error_report("Too much memory for this machine: %dMB, maximum 256MB", + ((unsigned int)ram_size / (1 << 20))); exit(1); } memory_region_allocate_system_memory(ram, NULL, "mips_r4k.ram", ram_size);