diff options
author | Kevin Wolf <kwolf@redhat.com> | 2010-06-29 11:43:13 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2010-07-06 17:05:48 +0200 |
commit | e076f3383b08a563d76c8beb9a716788a3987df9 (patch) | |
tree | 7c8fcc62f7f8e6ecef7baedffb7554de69e06ed2 /block.c | |
parent | 734003e6153b3552b9406ef598a1e67aac4a899e (diff) |
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.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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 */ |