All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>,
	qemu-block@nongnu.org
Subject: [Qemu-devel] [PATCH v2 13/15] blockdev: Make -drive format=help print to stdout
Date: Thu, 11 Apr 2019 16:52:54 +0200	[thread overview]
Message-ID: <20190411145256.8614-14-armbru@redhat.com> (raw)
In-Reply-To: <20190411145256.8614-1-armbru@redhat.com>

Command line help explicitly requested by the user should be printed
to stdout, not stderr.  We do elsewhere.  Adjust -drive to match: use
qemu_printf() instead of error_printf().  Plain printf() would be
wrong because we need to print to the current monitor for "drive_add
... format=help".

Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Max Reitz <mreitz@redhat.com>
Cc: qemu-block@nongnu.org
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 blockdev.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/blockdev.c b/blockdev.c
index 4775a07d93..79fbac8450 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -40,6 +40,7 @@
 #include "monitor/monitor.h"
 #include "qemu/error-report.h"
 #include "qemu/option.h"
+#include "qemu/qemu-print.h"
 #include "qemu/config-file.h"
 #include "qapi/qapi-commands-block.h"
 #include "qapi/qapi-commands-transaction.h"
@@ -301,7 +302,7 @@ DriveInfo *drive_get_next(BlockInterfaceType type)
 
 static void bdrv_format_print(void *opaque, const char *name)
 {
-    error_printf(" %s", name);
+    qemu_printf(" %s", name);
 }
 
 typedef struct {
@@ -530,11 +531,11 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts,
 
     if ((buf = qemu_opt_get(opts, "format")) != NULL) {
         if (is_help_option(buf)) {
-            error_printf("Supported formats:");
+            qemu_printf("Supported formats:");
             bdrv_iterate_format(bdrv_format_print, NULL, false);
-            error_printf("\nSupported formats (read-only):");
+            qemu_printf("\nSupported formats (read-only):");
             bdrv_iterate_format(bdrv_format_print, NULL, true);
-            error_printf("\n");
+            qemu_printf("\n");
             goto early_err;
         }
 
-- 
2.17.2

WARNING: multiple messages have this Message-ID (diff)
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-block@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] [PATCH v2 13/15] blockdev: Make -drive format=help print to stdout
Date: Thu, 11 Apr 2019 16:52:54 +0200	[thread overview]
Message-ID: <20190411145256.8614-14-armbru@redhat.com> (raw)
Message-ID: <20190411145254.unJk-v7Gof3Y-H5r4mZjKdij7hDOSlUxVLhWWKcqu_4@z> (raw)
In-Reply-To: <20190411145256.8614-1-armbru@redhat.com>

Command line help explicitly requested by the user should be printed
to stdout, not stderr.  We do elsewhere.  Adjust -drive to match: use
qemu_printf() instead of error_printf().  Plain printf() would be
wrong because we need to print to the current monitor for "drive_add
... format=help".

Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Max Reitz <mreitz@redhat.com>
Cc: qemu-block@nongnu.org
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 blockdev.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/blockdev.c b/blockdev.c
index 4775a07d93..79fbac8450 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -40,6 +40,7 @@
 #include "monitor/monitor.h"
 #include "qemu/error-report.h"
 #include "qemu/option.h"
+#include "qemu/qemu-print.h"
 #include "qemu/config-file.h"
 #include "qapi/qapi-commands-block.h"
 #include "qapi/qapi-commands-transaction.h"
@@ -301,7 +302,7 @@ DriveInfo *drive_get_next(BlockInterfaceType type)
 
 static void bdrv_format_print(void *opaque, const char *name)
 {
-    error_printf(" %s", name);
+    qemu_printf(" %s", name);
 }
 
 typedef struct {
@@ -530,11 +531,11 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts,
 
     if ((buf = qemu_opt_get(opts, "format")) != NULL) {
         if (is_help_option(buf)) {
-            error_printf("Supported formats:");
+            qemu_printf("Supported formats:");
             bdrv_iterate_format(bdrv_format_print, NULL, false);
-            error_printf("\nSupported formats (read-only):");
+            qemu_printf("\nSupported formats (read-only):");
             bdrv_iterate_format(bdrv_format_print, NULL, true);
-            error_printf("\n");
+            qemu_printf("\n");
             goto early_err;
         }
 
-- 
2.17.2



  parent reply	other threads:[~2019-04-11 14:53 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-11 14:52 [Qemu-devel] [PATCH v2 00/15] Clean up use of error_printf() Markus Armbruster
2019-04-11 14:52 ` [Qemu-devel] [PATCH v2 01/15] qemu-img: Use error_vreport() in error_exit() Markus Armbruster
2019-04-11 14:52   ` Markus Armbruster
2019-04-11 14:52 ` [Qemu-devel] [PATCH v2 02/15] block/ssh: Do not report read/write/flush errors to the user Markus Armbruster
2019-04-11 14:52   ` Markus Armbruster
2019-04-11 14:52 ` [Qemu-devel] [PATCH v2 03/15] char-pty: Drop "char device redirected to" message Markus Armbruster
2019-04-11 15:22   ` Paolo Bonzini
2019-04-11 15:37     ` Markus Armbruster
2019-04-11 15:37       ` Markus Armbruster
2019-04-17 18:09       ` Markus Armbruster
2019-04-17 18:09         ` Markus Armbruster
2019-04-11 15:23   ` Peter Krempa
2019-04-11 15:23     ` Peter Krempa
2019-04-11 14:52 ` [Qemu-devel] [PATCH v2 04/15] loader-fit: Wean off error_printf() Markus Armbruster
2019-04-11 14:52   ` Markus Armbruster
2019-04-11 14:52 ` [Qemu-devel] [PATCH v2 05/15] mips/boston: Report errors with error_report(), not error_printf() Markus Armbruster
2019-04-11 14:52   ` Markus Armbruster
2019-04-11 14:52 ` [Qemu-devel] [PATCH v2 06/15] pci: Report fatal " Markus Armbruster
2019-04-11 14:52   ` Markus Armbruster
2019-04-11 14:52 ` [Qemu-devel] [PATCH v2 07/15] hpet: Report warnings with warn_report(), " Markus Armbruster
2019-04-11 14:52   ` Markus Armbruster
2019-04-11 14:52 ` [Qemu-devel] [PATCH v2 08/15] vfio: " Markus Armbruster
2019-04-11 14:52 ` [Qemu-devel] [PATCH v2 09/15] s390x/kvm: " Markus Armbruster
2019-04-11 14:52 ` [Qemu-devel] [PATCH v2 10/15] vl: Make -machine $TYPE, help and -accel help print to stdout Markus Armbruster
2019-04-11 14:52 ` [Qemu-devel] [PATCH v2 11/15] monitor error: Make printf()-like functions return a value Markus Armbruster
2019-04-11 14:52 ` [Qemu-devel] [PATCH v2 12/15] qemu-print: New qemu_printf(), qemu_vprintf() etc Markus Armbruster
2019-04-11 14:52 ` Markus Armbruster [this message]
2019-04-11 14:52   ` [Qemu-devel] [PATCH v2 13/15] blockdev: Make -drive format=help print to stdout Markus Armbruster
2019-04-11 14:52 ` [Qemu-devel] [PATCH v2 14/15] char: Make -chardev help " Markus Armbruster
2019-04-11 14:52 ` [Qemu-devel] [PATCH v2 15/15] monitor: Simplify how -device/device_add print help Markus Armbruster
2019-04-17 18:11 ` [Qemu-devel] [PATCH v2 14.5/15] char-pty: Print "char device redirected" message to stdout Markus Armbruster
2019-04-17 18:21   ` no-reply

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=20190411145256.8614-14-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.