[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 36/41] char: use error_report()
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 36/41] char: use error_report() |
Date: |
Fri, 27 Jan 2017 14:45:44 +0100 |
From: Marc-André Lureau <address@hidden>
Prefer error_report() over fprintf(stderr..)
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
qemu-char.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/qemu-char.c b/qemu-char.c
index c82d6d2..113c4a8 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -451,8 +451,8 @@ int qemu_chr_fe_get_msgfd(CharBackend *be)
int fd;
int res = (qemu_chr_fe_get_msgfds(be, &fd, 1) == 1) ? fd : -1;
if (s && qemu_chr_replay(s)) {
- fprintf(stderr,
- "Replay: get msgfd is not supported for serial devices yet\n");
+ error_report("Replay: get msgfd is not supported "
+ "for serial devices yet");
exit(1);
}
return res;
@@ -1680,8 +1680,8 @@ static Chardev *qemu_chr_open_pty(const CharDriver
*driver,
ret->pty = g_strdup(pty_name);
ret->has_pty = true;
- fprintf(stderr, "char device redirected to %s (label %s)\n",
- pty_name, id);
+ error_report("char device redirected to %s (label %s)",
+ pty_name, id);
s = (PtyChardev *)chr;
s->ioc = QIO_CHANNEL(qio_channel_file_new_fd(master_fd));
@@ -3383,8 +3383,8 @@ static int tcp_chr_wait_connected(Chardev *chr, Error
**errp)
* in TLS and telnet cases, only wait for an accepted socket */
while (!s->ioc) {
if (s->is_listen) {
- fprintf(stderr, "QEMU waiting for connection on: %s\n",
- chr->filename);
+ error_report("QEMU waiting for connection on: %s",
+ chr->filename);
qio_channel_set_blocking(QIO_CHANNEL(s->listen_ioc), true, NULL);
tcp_chr_accept(QIO_CHANNEL(s->listen_ioc), G_IO_IN, chr);
qio_channel_set_blocking(QIO_CHANNEL(s->listen_ioc), false, NULL);
@@ -4146,16 +4146,19 @@ Chardev *qemu_chr_new_from_opts(QemuOpts *opts,
}
if (is_help_option(name)) {
- fprintf(stderr, "Available chardev backend types:\n");
+ GString *str = g_string_new("");
for (i = 0; i < ARRAY_SIZE(backends); i++) {
cd = backends[i];
if (cd) {
- fprintf(stderr, "%s\n", ChardevBackendKind_lookup[cd->kind]);
+ g_string_append_printf(str, "\n%s",
ChardevBackendKind_lookup[cd->kind]);
if (cd->alias) {
- fprintf(stderr, "%s\n", cd->alias);
+ g_string_append_printf(str, "\n%s", cd->alias);
}
}
}
+
+ error_report("Available chardev backend types: %s", str->str);
+ g_string_free(str, true);
exit(0);
}
@@ -4267,8 +4270,8 @@ Chardev *qemu_chr_new(const char *label, const char
*filename)
qemu_chr_set_feature(chr, QEMU_CHAR_FEATURE_REPLAY);
}
if (qemu_chr_replay(chr) && chr->driver->chr_ioctl) {
- fprintf(stderr,
- "Replay: ioctl is not supported for serial devices yet\n");
+ error_report("Replay: ioctl is not supported "
+ "for serial devices yet");
}
replay_register_char_driver(chr);
}
--
1.8.3.1
- [Qemu-devel] [PULL 22/41] qemu-options: stdio is available on win32, (continued)
- [Qemu-devel] [PULL 22/41] qemu-options: stdio is available on win32, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 28/41] char: fold single-user functions in caller, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 30/41] char: use a feature bit for replay, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 29/41] char: introduce generic qemu_chr_get_kind(), Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 32/41] bt: use qemu_chr_alloc(), Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 27/41] char: move callbacks in CharDriver, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 35/41] spice-char: improve error reporting, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 37/41] gtk: overwrite the console.c char driver, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 34/41] char: rename TCPChardev and NetChardev, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 38/41] baum: use a common prefix for chr callbacks, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 36/41] char: use error_report(),
Paolo Bonzini <=
- [Qemu-devel] [PULL 31/41] char: allocate CharDriverState as a single object, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 39/41] vc: use a common prefix for chr callbacks, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 41/41] memory: don't sign-extend 32-bit writes, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 33/41] char: rename CharDriverState Chardev, Paolo Bonzini, 2017/01/27
- [Qemu-devel] [PULL 40/41] chardev: qom-ify, Paolo Bonzini, 2017/01/27
- Re: [Qemu-devel] [PULL 00/41] Misc changes for 2017-01-27, Peter Maydell, 2017/01/27