qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [Qemu-devel] [PATCH 13/15] blockdev: Make -drive format


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH 13/15] blockdev: Make -drive format=help print to stdout
Date: Mon, 8 Apr 2019 13:01:07 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

On 4/8/19 10:36 AM, Markus Armbruster wrote:
> 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 <address@hidden>
> Cc: Max Reitz <address@hidden>
> Cc: address@hidden
> Signed-off-by: Markus Armbruster <address@hidden>

Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Tested-by: Philippe Mathieu-Daudé <address@hidden>

> ---
>  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;
>          }
>  
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]