[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 08/45] hw/char: Replace fprintf(stderr, "*\n" wit
From: |
Alistair Francis |
Subject: |
[Qemu-devel] [PATCH v4 08/45] hw/char: Replace fprintf(stderr, "*\n" with error_report() |
Date: |
Wed, 8 Nov 2017 14:56:49 -0800 |
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 were then manually tweaked to pass checkpatch.
Some lines were manually converted to qemu_log_mask(LOG_UNIMP, and two
abort()'s were removed
Signed-off-by: Alistair Francis <address@hidden>
Cc: Paolo Bonzini <address@hidden>
---
V4:
- Remove abort()s from guest accessible code
- Use qemu_log_mask(LOG_UNIMP,
V2:
- Split hw patch into individual directories
hw/char/mcf_uart.c | 5 +++--
hw/char/sh_serial.c | 11 +++++------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/hw/char/mcf_uart.c b/hw/char/mcf_uart.c
index 56fa402b58..1861c9733e 100644
--- a/hw/char/mcf_uart.c
+++ b/hw/char/mcf_uart.c
@@ -6,6 +6,7 @@
* This code is licensed under the GPL
*/
#include "qemu/osdep.h"
+#include "include/qemu/log.h"
#include "hw/hw.h"
#include "hw/sysbus.h"
#include "hw/m68k/mcf.h"
@@ -174,7 +175,7 @@ static void mcf_do_command(mcf_uart_state *s, uint8_t cmd)
mcf_uart_do_tx(s);
break;
case 3: /* Reserved. */
- fprintf(stderr, "mcf_uart: Bad TX command\n");
+ qemu_log_mask(LOG_GUEST_ERROR, "mcf_uart: Bad TX command");
break;
}
@@ -189,7 +190,7 @@ static void mcf_do_command(mcf_uart_state *s, uint8_t cmd)
s->rx_enabled = 0;
break;
case 3: /* Reserved. */
- fprintf(stderr, "mcf_uart: Bad RX command\n");
+ qemu_log_mask(LOG_GUEST_ERROR, "mcf_uart: Bad RX command");
break;
}
}
diff --git a/hw/char/sh_serial.c b/hw/char/sh_serial.c
index 835b5378a0..fae2d31b4e 100644
--- a/hw/char/sh_serial.c
+++ b/hw/char/sh_serial.c
@@ -25,6 +25,7 @@
* THE SOFTWARE.
*/
#include "qemu/osdep.h"
+#include "include/qemu/log.h"
#include "hw/hw.h"
#include "hw/sh4/sh.h"
#include "chardev/char-fe.h"
@@ -190,9 +191,8 @@ static void sh_serial_write(void *opaque, hwaddr offs,
}
}
- fprintf(stderr, "sh_serial: unsupported write to 0x%02"
- HWADDR_PRIx "\n", offs);
- abort();
+ qemu_log_mask(LOG_UNIMP, "sh_serial: unsupported write to 0x%02"
+ HWADDR_PRIx "", offs);
}
static uint64_t sh_serial_read(void *opaque, hwaddr offs,
@@ -290,9 +290,8 @@ static uint64_t sh_serial_read(void *opaque, hwaddr offs,
#endif
if (ret & ~((1 << 16) - 1)) {
- fprintf(stderr, "sh_serial: unsupported read from 0x%02"
- HWADDR_PRIx "\n", offs);
- abort();
+ qemu_log_mask(LOG_UNIMP, "sh_serial: unsupported read from 0x%02"
+ HWADDR_PRIx "", offs);
}
return ret;
--
2.14.1
- [Qemu-devel] [PATCH v4 00/45] Remove some of the fprintf(stderr, "*, Alistair Francis, 2017/11/08
- [Qemu-devel] [PATCH v4 03/45] Fixes after renaming __FUNCTION__ to __func__, Alistair Francis, 2017/11/08
- [Qemu-devel] [PATCH v4 01/45] audio: Replace AUDIO_FUNC with __func__, Alistair Francis, 2017/11/08
- [Qemu-devel] [PATCH v4 04/45] tests: Replace fprintf(stderr, "*\n" with error_report(), Alistair Francis, 2017/11/08
- [Qemu-devel] [PATCH v4 07/45] hw/bt: Replace fprintf(stderr, "*\n" with error_report(), Alistair Francis, 2017/11/08
- [Qemu-devel] [PATCH v4 06/45] hw/block: Replace fprintf(stderr, "*\n" with error_report(), Alistair Francis, 2017/11/08
- [Qemu-devel] [PATCH v4 05/45] hw/arm: Replace fprintf(stderr, "*\n" with error_report(), Alistair Francis, 2017/11/08
- [Qemu-devel] [PATCH v4 10/45] hw/cris: Replace fprintf(stderr, "*\n" with error_report(), Alistair Francis, 2017/11/08
- [Qemu-devel] [PATCH v4 08/45] hw/char: Replace fprintf(stderr, "*\n" with error_report(),
Alistair Francis <=
- [Qemu-devel] [PATCH v4 12/45] hw/dma: Replace fprintf(stderr, "*\n" with error_report(), Alistair Francis, 2017/11/08
- [Qemu-devel] [PATCH v4 11/45] hw/display: Replace fprintf(stderr, "*\n" with error_report(), Alistair Francis, 2017/11/08
- [Qemu-devel] [PATCH v4 09/45] hw/core: Replace fprintf(stderr, "*\n" with error_report(), Alistair Francis, 2017/11/08
- [Qemu-devel] [PATCH v4 14/45] hw/i2c: Replace fprintf(stderr, "*\n" with error_report(), Alistair Francis, 2017/11/08
- [Qemu-devel] [PATCH v4 13/45] hw/gpio: Replace fprintf(stderr, "*\n" with error_report(), Alistair Francis, 2017/11/08
- [Qemu-devel] [PATCH v4 16/45] hw/ide: Replace fprintf(stderr, "*\n" with error_report(), Alistair Francis, 2017/11/08
- [Qemu-devel] [PATCH v4 17/45] hw/input: Replace fprintf(stderr, "*\n" with error_report(), Alistair Francis, 2017/11/08