From 5b91704469c0f801e0219f26458356872c4145ab Mon Sep 17 00:00:00 2001 From: Wenchao Xia Date: Sat, 25 May 2013 11:09:45 +0800 Subject: block: dump snapshot and image info to specified output bdrv_snapshot_dump() and bdrv_image_info_dump() do not dump to a buffer now, some internal buffers are still used for format control, which have no chance to be truncated. As a result, these two functions have no more issue of truncation, and they can be used by both qemu and qemu-img with correct parameter specified. Signed-off-by: Wenchao Xia Signed-off-by: Kevin Wolf --- qemu-img.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'qemu-img.c') diff --git a/qemu-img.c b/qemu-img.c index 5d1e480..82c7977 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -1554,16 +1554,17 @@ static void dump_snapshots(BlockDriverState *bs) { QEMUSnapshotInfo *sn_tab, *sn; int nb_sns, i; - char buf[256]; nb_sns = bdrv_snapshot_list(bs, &sn_tab); if (nb_sns <= 0) return; printf("Snapshot list:\n"); - printf("%s\n", bdrv_snapshot_dump(buf, sizeof(buf), NULL)); + bdrv_snapshot_dump(fprintf, stdout, NULL); + printf("\n"); for(i = 0; i < nb_sns; i++) { sn = &sn_tab[i]; - printf("%s\n", bdrv_snapshot_dump(buf, sizeof(buf), sn)); + bdrv_snapshot_dump(fprintf, stdout, sn); + printf("\n"); } g_free(sn_tab); } @@ -1613,7 +1614,7 @@ static void dump_human_image_info_list(ImageInfoList *list) } delim = true; - bdrv_image_info_dump(elem->value); + bdrv_image_info_dump(fprintf, stdout, elem->value); } } -- cgit v1.1