diff options
author | Kevin Wolf <kwolf@redhat.com> | 2010-06-29 12:37:54 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2010-07-06 17:05:49 +0200 |
commit | 9ac228e02cf16202547e7025ef300369e0db7781 (patch) | |
tree | cb76569469651db883fbaa4e57bb2c2cba73a491 /block/vdi.c | |
parent | e076f3383b08a563d76c8beb9a716788a3987df9 (diff) | |
download | qemu-9ac228e02cf16202547e7025ef300369e0db7781.zip qemu-9ac228e02cf16202547e7025ef300369e0db7781.tar.gz qemu-9ac228e02cf16202547e7025ef300369e0db7781.tar.bz2 |
qcow2/vdi: Change check to distinguish error cases
This distinguishes between harmless leaks and real corruption. Hopefully users
better understand what qemu-img check wants to tell them.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/vdi.c')
-rw-r--r-- | block/vdi.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/block/vdi.c b/block/vdi.c index ee8cc7b..f72633c 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -291,11 +291,10 @@ static void vdi_header_print(VdiHeader *header) } #endif -static int vdi_check(BlockDriverState *bs) +static int vdi_check(BlockDriverState *bs, BdrvCheckResult *res) { /* TODO: additional checks possible. */ BDRVVdiState *s = (BDRVVdiState *)bs->opaque; - int n_errors = 0; uint32_t blocks_allocated = 0; uint32_t block; uint32_t *bmap; @@ -315,11 +314,12 @@ static int vdi_check(BlockDriverState *bs) } else { fprintf(stderr, "ERROR: block index %" PRIu32 " also used by %" PRIu32 "\n", bmap[bmap_entry], bmap_entry); + res->corruptions++; } } else { fprintf(stderr, "ERROR: block index %" PRIu32 " too large, is %" PRIu32 "\n", block, bmap_entry); - n_errors++; + res->corruptions++; } } } @@ -327,12 +327,12 @@ static int vdi_check(BlockDriverState *bs) fprintf(stderr, "ERROR: allocated blocks mismatch, is %" PRIu32 ", should be %" PRIu32 "\n", blocks_allocated, s->header.blocks_allocated); - n_errors++; + res->corruptions++; } qemu_free(bmap); - return n_errors; + return 0; } static int vdi_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) |