block: change some function return type to bool

Signed-off-by: Li Qiang <liq3ea@163.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Li Qiang 2018-10-13 01:52:31 -07:00 committed by Kevin Wolf
parent 6f8f015c0c
commit 967105651b
2 changed files with 7 additions and 7 deletions

View File

@ -1708,7 +1708,7 @@ void blk_error_action(BlockBackend *blk, BlockErrorAction action,
} }
} }
int blk_is_read_only(BlockBackend *blk) bool blk_is_read_only(BlockBackend *blk)
{ {
BlockDriverState *bs = blk_bs(blk); BlockDriverState *bs = blk_bs(blk);
@ -1719,18 +1719,18 @@ int blk_is_read_only(BlockBackend *blk)
} }
} }
int blk_is_sg(BlockBackend *blk) bool blk_is_sg(BlockBackend *blk)
{ {
BlockDriverState *bs = blk_bs(blk); BlockDriverState *bs = blk_bs(blk);
if (!bs) { if (!bs) {
return 0; return false;
} }
return bdrv_is_sg(bs); return bdrv_is_sg(bs);
} }
int blk_enable_write_cache(BlockBackend *blk) bool blk_enable_write_cache(BlockBackend *blk)
{ {
return blk->enable_write_cache; return blk->enable_write_cache;
} }

View File

@ -166,9 +166,9 @@ BlockErrorAction blk_get_error_action(BlockBackend *blk, bool is_read,
int error); int error);
void blk_error_action(BlockBackend *blk, BlockErrorAction action, void blk_error_action(BlockBackend *blk, BlockErrorAction action,
bool is_read, int error); bool is_read, int error);
int blk_is_read_only(BlockBackend *blk); bool blk_is_read_only(BlockBackend *blk);
int blk_is_sg(BlockBackend *blk); bool blk_is_sg(BlockBackend *blk);
int blk_enable_write_cache(BlockBackend *blk); bool blk_enable_write_cache(BlockBackend *blk);
void blk_set_enable_write_cache(BlockBackend *blk, bool wce); void blk_set_enable_write_cache(BlockBackend *blk, bool wce);
void blk_invalidate_cache(BlockBackend *blk, Error **errp); void blk_invalidate_cache(BlockBackend *blk, Error **errp);
bool blk_is_inserted(BlockBackend *blk); bool blk_is_inserted(BlockBackend *blk);