thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-Convert-stderr-message-calling-error_get_pretty-to-e.patch

218e99
From a52fe59a941e8cfa7b94ecc743ffcfcf0e1bcda7 Mon Sep 17 00:00:00 2001
218e99
From: Laszlo Ersek <lersek@redhat.com>
218e99
Date: Wed, 28 Aug 2013 15:50:45 +0200
218e99
Subject: [PATCH 28/28] Convert stderr message calling error_get_pretty() to error_report()
218e99
218e99
RH-Author: Laszlo Ersek <lersek@redhat.com>
218e99
Message-id: <1377705045-1054-3-git-send-email-lersek@redhat.com>
218e99
Patchwork-id: 53887
218e99
O-Subject: [RHEL-7 qemu-kvm PATCH v3 2/2] Convert stderr message calling error_get_pretty() to error_report()
218e99
Bugzilla: 906937
218e99
RH-Acked-by: Michal Novotny <minovotn@redhat.com>
218e99
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
218e99
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
218e99
Convert stderr messages calling error_get_pretty()
218e99
to error_report().
218e99
218e99
Timestamp is prepended by -msg timstamp option with it.
218e99
218e99
Per Markus's comment below, A conversion from fprintf() to
218e99
error_report() is always an improvement, regardless of
218e99
error_get_pretty().
218e99
218e99
http://marc.info/?l=qemu-devel&m=137513283408601&w=2
218e99
218e99
But, it is not reasonable to convert them at one time
218e99
because fprintf() is used everwhere in qemu.
218e99
218e99
So, it should be done step by step with avoiding regression.
218e99
218e99
Signed-off-by: Seiji Aguchi <seiji.aguchi@hds.com>
218e99
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
218e99
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
218e99
(cherry picked from commit 4a44d85e28bd282f53ccf0fa933dd71b8744a229)
218e99
218e99
Conflicts:
218e99
218e99
	hw/char/serial.c
218e99
218e99
RHEL-7 notes:
218e99
218e99
- I dropped the "hw/char/serial.c" hunks because they depend on
218e99
  upstream commit db895a1e ("isa: Use realizefn for ISADevice"):
218e99
218e99
  -    serial_init_core(s);
218e99
  +    serial_realize_core(s, &err;;
218e99
218e99
  Upstream commit db895a1e was first tagged in v1.6.0-rc0 and we don't
218e99
  have it.
218e99
218e99
  Instead, I replaced the fprintf(stderr, ...) call in serial_init_core()
218e99
  with a matching error_report() call, following Stefan's review of v2
218e99
  2/2.
218e99
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
218e99
---
218e99
 arch_init.c                 |    4 ++--
218e99
 hw/char/serial.c            |    3 ++-
218e99
 hw/i386/pc.c                |    6 +++---
218e99
 qemu-char.c                 |    2 +-
218e99
 target-i386/cpu.c           |    2 +-
218e99
 target-ppc/translate_init.c |    3 ++-
218e99
 vl.c                        |    9 +++++----
218e99
 7 files changed, 16 insertions(+), 13 deletions(-)
218e99
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
---
218e99
 arch_init.c                 |    4 ++--
218e99
 hw/char/serial.c            |    3 ++-
218e99
 hw/i386/pc.c                |    6 +++---
218e99
 qemu-char.c                 |    2 +-
218e99
 target-i386/cpu.c           |    2 +-
218e99
 target-ppc/translate_init.c |    3 ++-
218e99
 vl.c                        |    9 +++++----
218e99
 7 files changed, 16 insertions(+), 13 deletions(-)
218e99
218e99
diff --git a/arch_init.c b/arch_init.c
218e99
index 30edd5f..cd2bb5a 100644
218e99
--- a/arch_init.c
218e99
+++ b/arch_init.c
218e99
@@ -1069,8 +1069,8 @@ void do_acpitable_option(const QemuOpts *opts)
218e99
 
218e99
     acpi_table_add(opts, &err;;
218e99
     if (err) {
218e99
-        fprintf(stderr, "Wrong acpi table provided: %s\n",
218e99
-                error_get_pretty(err));
218e99
+        error_report("Wrong acpi table provided: %s",
218e99
+                     error_get_pretty(err));
218e99
         error_free(err);
218e99
         exit(1);
218e99
     }
218e99
diff --git a/hw/char/serial.c b/hw/char/serial.c
218e99
index 66b6348..0c472e2 100644
218e99
--- a/hw/char/serial.c
218e99
+++ b/hw/char/serial.c
218e99
@@ -27,6 +27,7 @@
218e99
 #include "sysemu/char.h"
218e99
 #include "qemu/timer.h"
218e99
 #include "exec/address-spaces.h"
218e99
+#include "qemu/error-report.h"
218e99
 
218e99
 //#define DEBUG_SERIAL
218e99
 
218e99
@@ -673,7 +674,7 @@ static void serial_reset(void *opaque)
218e99
 void serial_init_core(SerialState *s)
218e99
 {
218e99
     if (!s->chr) {
218e99
-        fprintf(stderr, "Can't create serial device, empty char device\n");
218e99
+        error_report("Can't create serial device, empty char device");
218e99
 	exit(1);
218e99
     }
218e99
 
218e99
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
218e99
index a7ecfb0..71b7a26 100644
218e99
--- a/hw/i386/pc.c
218e99
+++ b/hw/i386/pc.c
218e99
@@ -968,7 +968,7 @@ void pc_cpus_init(const char *cpu_model, DeviceState *icc_bridge)
218e99
         cpu = pc_new_cpu(cpu_model, x86_cpu_apic_id_from_index(i),
218e99
                          icc_bridge, &error);
218e99
         if (error) {
218e99
-            fprintf(stderr, "%s\n", error_get_pretty(error));
218e99
+            error_report("%s", error_get_pretty(error));
218e99
             error_free(error);
218e99
             exit(1);
218e99
         }
218e99
@@ -1007,8 +1007,8 @@ void pc_acpi_init(const char *default_dsdt)
218e99
 
218e99
         acpi_table_add(opts, &err;;
218e99
         if (err) {
218e99
-            fprintf(stderr, "WARNING: failed to load %s: %s\n", filename,
218e99
-                    error_get_pretty(err));
218e99
+            error_report("WARNING: failed to load %s: %s", filename,
218e99
+                         error_get_pretty(err));
218e99
             error_free(err);
218e99
         }
218e99
         g_free(arg);
218e99
diff --git a/qemu-char.c b/qemu-char.c
218e99
index ccc9912..566267a 100644
218e99
--- a/qemu-char.c
218e99
+++ b/qemu-char.c
218e99
@@ -3334,7 +3334,7 @@ CharDriverState *qemu_chr_new(const char *label, const char *filename, void (*in
218e99
 
218e99
     chr = qemu_chr_new_from_opts(opts, init, &err;;
218e99
     if (error_is_set(&err)) {
218e99
-        fprintf(stderr, "%s\n", error_get_pretty(err));
218e99
+        error_report("%s", error_get_pretty(err));
218e99
         error_free(err);
218e99
     }
218e99
     if (chr && qemu_opt_get_bool(opts, "mux", 0)) {
218e99
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
218e99
index 0ad8259..355375b 100644
218e99
--- a/target-i386/cpu.c
218e99
+++ b/target-i386/cpu.c
218e99
@@ -1847,7 +1847,7 @@ X86CPU *cpu_x86_init(const char *cpu_model)
218e99
 
218e99
 out:
218e99
     if (error) {
218e99
-        fprintf(stderr, "%s\n", error_get_pretty(error));
218e99
+        error_report("%s", error_get_pretty(error));
218e99
         error_free(error);
218e99
         if (cpu != NULL) {
218e99
             object_unref(OBJECT(cpu));
218e99
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
218e99
index 2e2bffa..5a12c0e 100644
218e99
--- a/target-ppc/translate_init.c
218e99
+++ b/target-ppc/translate_init.c
218e99
@@ -27,6 +27,7 @@
218e99
 #include "cpu-models.h"
218e99
 #include "mmu-hash32.h"
218e99
 #include "mmu-hash64.h"
218e99
+#include "qemu/error-report.h"
218e99
 
218e99
 //#define PPC_DUMP_CPU
218e99
 //#define PPC_DEBUG_SPR
218e99
@@ -8027,7 +8028,7 @@ PowerPCCPU *cpu_ppc_init(const char *cpu_model)
218e99
 
218e99
     object_property_set_bool(OBJECT(cpu), true, "realized", &err;;
218e99
     if (err != NULL) {
218e99
-        fprintf(stderr, "%s\n", error_get_pretty(err));
218e99
+        error_report("%s", error_get_pretty(err));
218e99
         error_free(err);
218e99
         object_unref(OBJECT(cpu));
218e99
         return NULL;
218e99
diff --git a/vl.c b/vl.c
218e99
index 0ce554d..51c04e7 100644
218e99
--- a/vl.c
218e99
+++ b/vl.c
218e99
@@ -2363,7 +2363,7 @@ static int chardev_init_func(QemuOpts *opts, void *opaque)
218e99
 
218e99
     qemu_chr_new_from_opts(opts, NULL, &local_err);
218e99
     if (error_is_set(&local_err)) {
218e99
-        fprintf(stderr, "%s\n", error_get_pretty(local_err));
218e99
+        error_report("%s", error_get_pretty(local_err));
218e99
         error_free(local_err);
218e99
         return -1;
218e99
     }
218e99
@@ -4393,8 +4393,8 @@ int main(int argc, char **argv, char **envp)
218e99
         vnc_display_init(ds);
218e99
         vnc_display_open(ds, vnc_display, &local_err);
218e99
         if (local_err != NULL) {
218e99
-            fprintf(stderr, "Failed to start VNC server on `%s': %s\n",
218e99
-                    vnc_display, error_get_pretty(local_err));
218e99
+            error_report("Failed to start VNC server on `%s': %s",
218e99
+                         vnc_display, error_get_pretty(local_err));
218e99
             error_free(local_err);
218e99
             exit(1);
218e99
         }
218e99
@@ -4437,7 +4437,8 @@ int main(int argc, char **argv, char **envp)
218e99
         Error *local_err = NULL;
218e99
         qemu_start_incoming_migration(incoming, &local_err);
218e99
         if (local_err) {
218e99
-            fprintf(stderr, "-incoming %s: %s\n", incoming, error_get_pretty(local_err));
218e99
+            error_report("-incoming %s: %s", incoming,
218e99
+                         error_get_pretty(local_err));
218e99
             error_free(local_err);
218e99
             exit(1);
218e99
         }
218e99
-- 
218e99
1.7.1
218e99