summaryrefslogtreecommitdiffstats
path: root/block.c
diff options
context:
space:
mode:
authorKevin Wolf2010-06-29 11:43:13 +0200
committerKevin Wolf2010-07-06 17:05:48 +0200
commite076f3383b08a563d76c8beb9a716788a3987df9 (patch)
tree7c8fcc62f7f8e6ecef7baedffb7554de69e06ed2 /block.c
parentMerge remote branch 'kwolf/for-anthony' into staging (diff)
downloadqemu-e076f3383b08a563d76c8beb9a716788a3987df9.tar.gz
qemu-e076f3383b08a563d76c8beb9a716788a3987df9.tar.xz
qemu-e076f3383b08a563d76c8beb9a716788a3987df9.zip
qemu-img check: Distinguish different kinds of errors
People think that their images are corrupted when in fact there are just some leaked clusters. Differentiating several error cases should make the messages more comprehensible. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/block.c b/block.c
index dd6dd76c6d..b0ceef0438 100644
--- a/block.c
+++ b/block.c
@@ -710,15 +710,19 @@ DeviceState *bdrv_get_attached(BlockDriverState *bs)
/*
* Run consistency checks on an image
*
- * Returns the number of errors or -errno when an internal error occurs
+ * Returns 0 if the check could be completed (it doesn't mean that the image is
+ * free of errors) or -errno when an internal error occured. The results of the
+ * check are stored in res.
*/
-int bdrv_check(BlockDriverState *bs)
+int bdrv_check(BlockDriverState *bs, BdrvCheckResult *res)
{
if (bs->drv->bdrv_check == NULL) {
return -ENOTSUP;
}
- return bs->drv->bdrv_check(bs);
+ memset(res, 0, sizeof(*res));
+ res->corruptions = bs->drv->bdrv_check(bs);
+ return res->corruptions < 0 ? res->corruptions : 0;
}
/* commit COW file into the raw image */