mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
block/qapi: Human-readable ImageInfoSpecific dump
Add a function for generically dumping the ImageInfoSpecific information in a human-readable format to block/qapi.c. Use this function in bdrv_image_info_dump and qemu-io-cmds.c:info_f to allow qemu-img info resp. qemu-io -c info to print that format specific information. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
eae041fe6f
commit
a8d8ecb77f
3 changed files with 132 additions and 0 deletions
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include "qemu-io.h"
|
||||
#include "block/block_int.h"
|
||||
#include "block/qapi.h"
|
||||
#include "qemu/main-loop.h"
|
||||
|
||||
#define CMD_NOFILE_OK 0x01
|
||||
|
@ -1678,6 +1679,7 @@ static const cmdinfo_t length_cmd = {
|
|||
static int info_f(BlockDriverState *bs, int argc, char **argv)
|
||||
{
|
||||
BlockDriverInfo bdi;
|
||||
ImageInfoSpecific *spec_info;
|
||||
char s1[64], s2[64];
|
||||
int ret;
|
||||
|
||||
|
@ -1699,6 +1701,13 @@ static int info_f(BlockDriverState *bs, int argc, char **argv)
|
|||
printf("cluster size: %s\n", s1);
|
||||
printf("vm state offset: %s\n", s2);
|
||||
|
||||
spec_info = bdrv_get_specific_info(bs);
|
||||
if (spec_info) {
|
||||
printf("Format specific information:\n");
|
||||
bdrv_image_info_specific_dump(fprintf, stdout, spec_info);
|
||||
qapi_free_ImageInfoSpecific(spec_info);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue