From patchwork Fri Feb 2 18:37:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 10198043 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CC53360388 for ; Fri, 2 Feb 2018 19:11:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC53F28F59 for ; Fri, 2 Feb 2018 19:11:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B085228F5B; Fri, 2 Feb 2018 19:11:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0C31628F59 for ; Fri, 2 Feb 2018 19:11:37 +0000 (UTC) Received: from localhost ([::1]:52858 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehgkK-0002YB-RM for patchwork-qemu-devel@patchwork.kernel.org; Fri, 02 Feb 2018 14:11:36 -0500 Received: from eggs.gnu.org ([208.118.235.92]:43543) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehgEz-0008U5-JK for qemu-devel@nongnu.org; Fri, 02 Feb 2018 13:40:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ehgDS-0005gL-44 for qemu-devel@nongnu.org; Fri, 02 Feb 2018 13:39:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34380) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ehgDR-0005eq-Pw for qemu-devel@nongnu.org; Fri, 02 Feb 2018 13:37:37 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D86FB87632; Fri, 2 Feb 2018 18:37:36 +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 3CF246F102; Fri, 2 Feb 2018 18:37:36 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 4F2EC1138663; Fri, 2 Feb 2018 19:37:31 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Fri, 2 Feb 2018 19:37:29 +0100 Message-Id: <20180202183731.29990-14-armbru@redhat.com> In-Reply-To: <20180202183731.29990-1-armbru@redhat.com> References: <20180202183731.29990-1-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 02 Feb 2018 18:37:37 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v7 13/15] hw/xen*: 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: Anthony Perard , Stefano Stabellini , alistair.francis@xilinx.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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. xen_pt_log() was left with an fprintf(stderr, Signed-off-by: Alistair Francis Cc: Stefano Stabellini Cc: Anthony Perard Conversions that aren't followed by exit() dropped, because they might be inappropriate. Signed-off-by: Markus Armbruster --- hw/xen/xen-common.c | 5 +++-- hw/xenpv/xen_machine_pv.c | 9 +++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/hw/xen/xen-common.c b/hw/xen/xen-common.c index 632a938dcc..afa1e3f404 100644 --- a/hw/xen/xen-common.c +++ b/hw/xen/xen-common.c @@ -9,6 +9,7 @@ */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/xen/xen_backend.h" #include "qmp-commands.h" #include "chardev/char.h" @@ -96,13 +97,13 @@ static void xenstore_record_dm_state(struct xs_handle *xs, const char *state) char path[50]; if (xs == NULL) { - fprintf(stderr, "xenstore connection not initialized\n"); + error_report("xenstore connection not initialized"); exit(1); } snprintf(path, sizeof (path), "device-model/%u/state", xen_domid); if (!xs_write(xs, XBT_NULL, path, state, strlen(state))) { - fprintf(stderr, "error recording dm state\n"); + error_report("error recording dm state"); exit(1); } } diff --git a/hw/xenpv/xen_machine_pv.c b/hw/xenpv/xen_machine_pv.c index 69a52a9f93..44d67b87c4 100644 --- a/hw/xenpv/xen_machine_pv.c +++ b/hw/xenpv/xen_machine_pv.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/hw.h" #include "hw/boards.h" #include "hw/xen/xen_backend.h" @@ -36,7 +37,7 @@ static void xen_init_pv(MachineState *machine) /* Initialize backend core & drivers */ if (xen_be_init() != 0) { - fprintf(stderr, "%s: xen backend core setup failed\n", __func__); + error_report("%s: xen backend core setup failed", __func__); exit(1); } @@ -51,18 +52,18 @@ static void xen_init_pv(MachineState *machine) const char *initrd_filename = machine->initrd_filename; if (xen_domain_build_pv(kernel_filename, initrd_filename, kernel_cmdline) < 0) { - fprintf(stderr, "xen pv domain creation failed\n"); + error_report("xen pv domain creation failed"); exit(1); } break; } #endif case XEN_EMULATE: - fprintf(stderr, "xen emulation not implemented (yet)\n"); + error_report("xen emulation not implemented (yet)"); exit(1); break; default: - fprintf(stderr, "unhandled xen_mode %d\n", xen_mode); + error_report("unhandled xen_mode %d", xen_mode); exit(1); break; }