aboutsummaryrefslogtreecommitdiff
path: root/block/vdi.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2010-06-29 12:37:54 +0200
committerKevin Wolf <kwolf@redhat.com>2010-07-06 17:05:49 +0200
commit9ac228e02cf16202547e7025ef300369e0db7781 (patch)
treecb76569469651db883fbaa4e57bb2c2cba73a491 /block/vdi.c
parente076f3383b08a563d76c8beb9a716788a3987df9 (diff)
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.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/block/vdi.c b/block/vdi.c
index ee8cc7b1aa..f72633cf19 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)