Introduce bdrv_check (Kevin Wolf)

From: Kevin Wolf <kwolf@redhat.com>

Introduce a new bdrv_check function pointer for block drivers. Modify qcow2 to
return an error status in check_refcounts(), so it can implement bdrv_check.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7214 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
aliguori 2009-04-21 23:11:50 +00:00
parent 8ddbc04f06
commit e97fc193e1
4 changed files with 70 additions and 19 deletions

14
block.c
View file

@ -506,6 +506,20 @@ void bdrv_delete(BlockDriverState *bs)
qemu_free(bs);
}
/*
* Run consistency checks on an image
*
* Returns the number of errors or -errno when an internal error occurs
*/
int bdrv_check(BlockDriverState *bs)
{
if (bs->drv->bdrv_check == NULL) {
return -ENOTSUP;
}
return bs->drv->bdrv_check(bs);
}
/* commit COW file into the raw image */
int bdrv_commit(BlockDriverState *bs)
{