Browse Source

blockdev: Make -drive format=help print to stdout

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>
Message-Id: <2019041719.26814-13-armbru@redhat.com>
master
Markus Armbruster 1 month ago
parent
commit
cdcd436120
1 changed files with 5 additions and 4 deletions
  1. 5
    4
      blockdev.c

+ 5
- 4
blockdev.c View File

@@ -40,6 +40,7 @@
40 40
 #include "monitor/monitor.h"
41 41
 #include "qemu/error-report.h"
42 42
 #include "qemu/option.h"
43
+#include "qemu/qemu-print.h"
43 44
 #include "qemu/config-file.h"
44 45
 #include "qapi/qapi-commands-block.h"
45 46
 #include "qapi/qapi-commands-transaction.h"
@@ -301,7 +302,7 @@ DriveInfo *drive_get_next(BlockInterfaceType type)
301 302
 
302 303
 static void bdrv_format_print(void *opaque, const char *name)
303 304
 {
304
-    error_printf(" %s", name);
305
+    qemu_printf(" %s", name);
305 306
 }
306 307
 
307 308
 typedef struct {
@@ -530,11 +531,11 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts,
530 531
 
531 532
     if ((buf = qemu_opt_get(opts, "format")) != NULL) {
532 533
         if (is_help_option(buf)) {
533
-            error_printf("Supported formats:");
534
+            qemu_printf("Supported formats:");
534 535
             bdrv_iterate_format(bdrv_format_print, NULL, false);
535
-            error_printf("\nSupported formats (read-only):");
536
+            qemu_printf("\nSupported formats (read-only):");
536 537
             bdrv_iterate_format(bdrv_format_print, NULL, true);
537
-            error_printf("\n");
538
+            qemu_printf("\n");
538 539
             goto early_err;
539 540
         }
540 541
 

Loading…
Cancel
Save