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 v3 12/15] blockdev: Make -drive format=help print to stdout Date: Wed, 17 Apr 2019 21:06:38 +0200 [thread overview] Message-ID: <20190417190641.26814-13-armbru@redhat.com> (raw) In-Reply-To: <20190417190641.26814-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 v3 12/15] blockdev: Make -drive format=help print to stdout Date: Wed, 17 Apr 2019 21:06:38 +0200 [thread overview] Message-ID: <20190417190641.26814-13-armbru@redhat.com> (raw) Message-ID: <20190417190638.voSjkcsSDJ07jH5hh4fLV1dOhI9JpXTwvrrJ37PNO08@z> (raw) In-Reply-To: <20190417190641.26814-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
next prev parent reply other threads:[~2019-04-17 19:06 UTC|newest] Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-04-17 19:06 [Qemu-devel] [PATCH v3 00/15] Clean up use of error_printf() Markus Armbruster 2019-04-17 19:06 ` [Qemu-devel] [PATCH v3 01/15] qemu-img: Use error_vreport() in error_exit() Markus Armbruster 2019-04-17 19:06 ` Markus Armbruster 2019-04-17 19:06 ` [Qemu-devel] [PATCH v3 02/15] block/ssh: Do not report read/write/flush errors to the user Markus Armbruster 2019-04-17 19:06 ` Markus Armbruster 2019-04-17 19:06 ` [Qemu-devel] [PATCH v3 03/15] loader-fit: Wean off error_printf() Markus Armbruster 2019-04-17 19:06 ` Markus Armbruster 2019-04-17 19:06 ` [Qemu-devel] [PATCH v3 04/15] mips/boston: Report errors with error_report(), not error_printf() Markus Armbruster 2019-04-17 19:06 ` Markus Armbruster 2019-04-17 19:06 ` [Qemu-devel] [PATCH v3 05/15] pci: Report fatal " Markus Armbruster 2019-04-17 19:06 ` Markus Armbruster 2019-04-17 19:06 ` [Qemu-devel] [PATCH v3 06/15] hpet: Report warnings with warn_report(), " Markus Armbruster 2019-04-17 19:06 ` Markus Armbruster 2019-04-17 19:06 ` [Qemu-devel] [PATCH v3 07/15] vfio: " Markus Armbruster 2019-04-17 22:05 ` Alex Williamson 2019-04-18 6:18 ` Markus Armbruster 2019-04-18 16:36 ` Alex Williamson 2019-04-18 20:25 ` Markus Armbruster 2019-04-17 19:06 ` [Qemu-devel] [PATCH v3 08/15] s390x/kvm: " Markus Armbruster 2019-04-17 19:06 ` [Qemu-devel] [PATCH v3 09/15] vl: Make -machine $TYPE, help and -accel help print to stdout Markus Armbruster 2019-04-17 19:06 ` [Qemu-devel] [PATCH v3 10/15] monitor error: Make printf()-like functions return a value Markus Armbruster 2019-04-17 19:06 ` [Qemu-devel] [PATCH v3 11/15] qemu-print: New qemu_printf(), qemu_vprintf() etc Markus Armbruster 2019-04-17 19:06 ` Markus Armbruster [this message] 2019-04-17 19:06 ` [Qemu-devel] [PATCH v3 12/15] blockdev: Make -drive format=help print to stdout Markus Armbruster 2019-04-17 19:06 ` [Qemu-devel] [PATCH v3 13/15] char: Make -chardev help " Markus Armbruster 2019-04-17 19:06 ` [Qemu-devel] [PATCH v3 14/15] char-pty: Print "char device redirected" message " Markus Armbruster 2019-04-17 19:31 ` Eric Blake 2019-04-17 19:06 ` [Qemu-devel] [PATCH v3 15/15] monitor: Simplify how -device/device_add print help Markus Armbruster
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=20190417190641.26814-13-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: linkBe 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.