[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 01/12] block: Improve empty format-specific info dump
From: |
Kevin Wolf |
Subject: |
Re: [PATCH v2 01/12] block: Improve empty format-specific info dump |
Date: |
Thu, 19 Jan 2023 15:00:58 +0100 |
Am 20.06.2022 um 18:26 hat Hanna Reitz geschrieben:
> When a block driver supports obtaining format-specific information, but
> that object only contains optional fields, it is possible that none of
> them are present, so that dump_qobject() (called by
> bdrv_image_info_specific_dump()) will not print anything.
>
> The callers of bdrv_image_info_specific_dump() put a header above this
> information ("Format specific information:\n"), which will look strange
> when there is nothing below. Modify bdrv_image_info_specific_dump() to
> print this header instead of its callers, and only if there is indeed
> something to be printed.
>
> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
> diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c
> index 2f0d8ac25a..084ec44d3b 100644
> --- a/qemu-io-cmds.c
> +++ b/qemu-io-cmds.c
> @@ -1819,8 +1819,8 @@ static int info_f(BlockBackend *blk, int argc, char
> **argv)
> return -EIO;
> }
> if (spec_info) {
> - printf("Format specific information:\n");
> - bdrv_image_info_specific_dump(spec_info);
> + bdrv_image_info_specific_dump(spec_info,
> + "Format specific information:\n");
> qapi_free_ImageInfoSpecific(spec_info);
> }
Interesting observation here: That qemu-io uses printf() instead of
qemu_printf() for the top level, but then dump_qobject() (which results
in qemu_printf()) for the format specific information, means that if you
use the 'qemu-io' HMP command, you'll get half of the output on stdout
and the other half in the monitor.
This series doesn't fix this, but the split makes a little more sense
after this patch at least...
Kevin
- Re: [PATCH v2 01/12] block: Improve empty format-specific info dump,
Kevin Wolf <=