aboutsummaryrefslogtreecommitdiff
path: root/include/block
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2016-06-23 16:37:26 -0600
committerKevin Wolf <kwolf@redhat.com>2016-07-05 16:46:26 +0200
commit5411541270f1d9e8eb1fb442fa4908c4398d5d88 (patch)
tree12d876f78a7e64b1ce98a05795b1f79653e1aa91 /include/block
parent8cc9c6e92bed8459bffaf5a22af8560f2cd8042b (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 'include/block')
-rw-r--r--include/block/block.h8
-rw-r--r--include/block/block_int.h13
2 files changed, 11 insertions, 10 deletions
diff --git a/include/block/block.h b/include/block/block.h
index 733a8ec2ec..211a0f2c41 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -362,8 +362,8 @@ int bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
int bdrv_is_allocated_above(BlockDriverState *top, BlockDriverState *base,
int64_t sector_num, int nb_sectors, int *pnum);
-int bdrv_is_read_only(BlockDriverState *bs);
-int bdrv_is_sg(BlockDriverState *bs);
+bool bdrv_is_read_only(BlockDriverState *bs);
+bool bdrv_is_sg(BlockDriverState *bs);
bool bdrv_is_inserted(BlockDriverState *bs);
int bdrv_media_changed(BlockDriverState *bs);
void bdrv_lock_medium(BlockDriverState *bs, bool locked);
@@ -390,8 +390,8 @@ BlockDriverState *bdrv_first(BdrvNextIterator *it);
BlockDriverState *bdrv_next(BdrvNextIterator *it);
BlockDriverState *bdrv_next_monitor_owned(BlockDriverState *bs);
-int bdrv_is_encrypted(BlockDriverState *bs);
-int bdrv_key_required(BlockDriverState *bs);
+bool bdrv_is_encrypted(BlockDriverState *bs);
+bool bdrv_key_required(BlockDriverState *bs);
int bdrv_set_key(BlockDriverState *bs, const char *key);
void bdrv_add_key(BlockDriverState *bs, const char *key, Error **errp);
int bdrv_query_missing_keys(void);
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 8f061ebf79..0432ba57b6 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -429,14 +429,15 @@ struct BdrvChild {
struct BlockDriverState {
int64_t total_sectors; /* if we are reading a disk image, give its
size in sectors */
- int read_only; /* if true, the media is read only */
int open_flags; /* flags used to open the file, re-used for re-open */
- int encrypted; /* if true, the media is encrypted */
- int valid_key; /* if true, a valid encryption key has been set */
- int sg; /* if true, the device is a /dev/sg* */
- int copy_on_read; /* if true, copy read backing sectors into image
+ bool read_only; /* if true, the media is read only */
+ bool encrypted; /* if true, the media is encrypted */
+ bool valid_key; /* if true, a valid encryption key has been set */
+ bool sg; /* if true, the device is a /dev/sg* */
+ bool probed; /* if true, format was probed rather than specified */
+
+ int copy_on_read; /* if nonzero, copy read backing sectors into image.
note this is a reference count */
- bool probed;
BlockDriver *drv; /* NULL means no media */
void *opaque;