block: Make bdrv_is_inserted() return a bool
Make bdrv_is_inserted(), blk_is_inserted(), and the callback
BlockDriver.bdrv_is_inserted() return a bool.
Suggested-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
diff --git a/block.c b/block.c
index d1bf121..bdd3338 100644
--- a/block.c
+++ b/block.c
@@ -3140,14 +3140,16 @@
/**
* Return TRUE if the media is present
*/
-int bdrv_is_inserted(BlockDriverState *bs)
+bool bdrv_is_inserted(BlockDriverState *bs)
{
BlockDriver *drv = bs->drv;
- if (!drv)
- return 0;
- if (!drv->bdrv_is_inserted)
- return 1;
+ if (!drv) {
+ return false;
+ }
+ if (!drv->bdrv_is_inserted) {
+ return true;
+ }
return drv->bdrv_is_inserted(bs);
}