diff options
author | Eric Blake <eblake@redhat.com> | 2016-06-23 16:37:26 -0600 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2016-07-05 16:46:26 +0200 |
commit | 5411541270f1d9e8eb1fb442fa4908c4398d5d88 (patch) | |
tree | 12d876f78a7e64b1ce98a05795b1f79653e1aa91 /block.c | |
parent | 8cc9c6e92bed8459bffaf5a22af8560f2cd8042b (diff) |
block: Use bool as appropriate for BDS members
Using int for values that are only used as booleans is confusing.
While at it, rearrange a couple of members so that all the bools
are contiguous.
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r-- | block.c | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -2183,9 +2183,9 @@ static void bdrv_close(BlockDriverState *bs) bs->backing_file[0] = '\0'; bs->backing_format[0] = '\0'; bs->total_sectors = 0; - bs->encrypted = 0; - bs->valid_key = 0; - bs->sg = 0; + bs->encrypted = false; + bs->valid_key = false; + bs->sg = false; QDECREF(bs->options); QDECREF(bs->explicit_options); bs->options = NULL; @@ -2643,30 +2643,30 @@ void bdrv_get_geometry(BlockDriverState *bs, uint64_t *nb_sectors_ptr) *nb_sectors_ptr = nb_sectors < 0 ? 0 : nb_sectors; } -int bdrv_is_read_only(BlockDriverState *bs) +bool bdrv_is_read_only(BlockDriverState *bs) { return bs->read_only; } -int bdrv_is_sg(BlockDriverState *bs) +bool bdrv_is_sg(BlockDriverState *bs) { return bs->sg; } -int bdrv_is_encrypted(BlockDriverState *bs) +bool bdrv_is_encrypted(BlockDriverState *bs) { if (bs->backing && bs->backing->bs->encrypted) { - return 1; + return true; } return bs->encrypted; } -int bdrv_key_required(BlockDriverState *bs) +bool bdrv_key_required(BlockDriverState *bs) { BdrvChild *backing = bs->backing; if (backing && backing->bs->encrypted && !backing->bs->valid_key) { - return 1; + return true; } return (bs->encrypted && !bs->valid_key); } @@ -2688,10 +2688,10 @@ int bdrv_set_key(BlockDriverState *bs, const char *key) } ret = bs->drv->bdrv_set_key(bs, key); if (ret < 0) { - bs->valid_key = 0; + bs->valid_key = false; } else if (!bs->valid_key) { /* call the change callback now, we skipped it on open */ - bs->valid_key = 1; + bs->valid_key = true; bdrv_parent_cb_change_media(bs, true); } return ret; |