qemu-block
[Top][All Lists]
Advanced

[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: Hanna Czenczek
Subject: Re: [PATCH v2 01/12] block: Improve empty format-specific info dump
Date: Fri, 20 Jan 2023 14:35:48 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0

On 19.01.23 15:00, Kevin Wolf wrote:
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.

Hu.  I can’t find a single instance of qemu_printf() in qemu-io-cmds.c, but then I assume all printf()s there should really be qemu_printf()?

Hanna

This series doesn't fix this, but the split makes a little more sense
after this patch at least...

Kevin




reply via email to

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