qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [Qemu-devel] [PULL 36/41] char: use error_report()
Date: Fri, 27 Jan 2017 14:45:44 +0100	[thread overview]
Message-ID: <1485524749-118532-37-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1485524749-118532-1-git-send-email-pbonzini@redhat.com>

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Prefer error_report() over fprintf(stderr..)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 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

  parent reply	other threads:[~2017-01-27 13:46 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-27 13:45 [Qemu-devel] [PULL 00/41] Misc changes for 2017-01-27 Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 01/41] icount: update instruction counter on apic patching Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 02/41] replay: improve interrupt handling Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 03/41] replay: don't use rtc clock on loadvm phase Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 04/41] savevm: add public save_vmstate function Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 05/41] replay: save/load initial state Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 06/41] replay: exception replay fix Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 07/41] apic: save apic_delivered flag Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 08/41] memory: tune mtree_print_mr() to dump mr type Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 09/41] memory: hmp: add "-f" for "info mtree" Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 10/41] hw/isa/lpc_ich9: add SMI feature negotiation via fw_cfg Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 11/41] hw/isa/lpc_ich9: add broadcast SMI feature Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 12/41] hw/isa/lpc_ich9: negotiate SMI broadcast on pc-q35-2.9+ machine types Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 13/41] block/iscsi: avoid data corruption with cache=writeback Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 14/41] Introduce DEVICE_CATEGORY_CPU for CPU devices Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 15/41] hw/scsi: Fix debug message of cdb structure in scsi-generic Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 16/41] block: Fix target variable of BLKSECTGET ioctl Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 17/41] block: get max_transfer limit for char (scsi-generic) devices Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 18/41] x86-KVM: Supply TSC and APIC clock rates to guest like VMWare Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 19/41] pc: Enable vmware-cpuid-freq CPU option for 2.9+ machine types Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 20/41] block/iscsi: statically link qemu_iscsi_opts Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 21/41] tests: fix linking test-char on win32 Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 22/41] qemu-options: stdio is available " Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 23/41] char: add qemu_chr_fe_add_watch() Returns description Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 24/41] doc: fix spelling Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 25/41] char: use a const CharDriver Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 26/41] char: use a static array for backends Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 27/41] char: move callbacks in CharDriver Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 28/41] char: fold single-user functions in caller Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 29/41] char: introduce generic qemu_chr_get_kind() Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 30/41] char: use a feature bit for replay Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 31/41] char: allocate CharDriverState as a single object Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 32/41] bt: use qemu_chr_alloc() Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 33/41] char: rename CharDriverState Chardev Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 34/41] char: rename TCPChardev and NetChardev Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 35/41] spice-char: improve error reporting Paolo Bonzini
2017-01-27 13:45 ` Paolo Bonzini [this message]
2017-01-27 13:45 ` [Qemu-devel] [PULL 37/41] gtk: overwrite the console.c char driver Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 38/41] baum: use a common prefix for chr callbacks Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 39/41] vc: " Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 40/41] chardev: qom-ify Paolo Bonzini
2017-01-27 13:45 ` [Qemu-devel] [PULL 41/41] memory: don't sign-extend 32-bit writes Paolo Bonzini
2017-01-27 16:58 ` [Qemu-devel] [PULL 00/41] Misc changes for 2017-01-27 Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1485524749-118532-37-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).