summaryrefslogtreecommitdiffstats
path: root/block/block-backend.c
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy2021-05-27 17:40:54 +0200
committerKevin Wolf2021-06-02 14:23:20 +0200
commit307261b243df2edde538f3ed5c9d80e168529355 (patch)
tree1658e2f592d19d9fbf5edcd75f98451a12bceffc /block/block-backend.c
parentblock/vvfat: fix vvfat_child_perm crash (diff)
downloadqemu-307261b243df2edde538f3ed5c9d80e168529355.tar.gz
qemu-307261b243df2edde538f3ed5c9d80e168529355.tar.xz
qemu-307261b243df2edde538f3ed5c9d80e168529355.zip
block: consistently use bdrv_is_read_only()
It's better to use accessor function instead of bs->read_only directly. In some places use bdrv_is_writable() instead of checking both BDRV_O_RDWR set and BDRV_O_INACTIVE not set. In bdrv_open_common() it's a bit strange to add one more variable, but we are going to drop bs->read_only in the next patch, so new ro local variable substitutes it here. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20210527154056.70294-2-vsementsov@virtuozzo.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/block-backend.c')
-rw-r--r--block/block-backend.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/block-backend.c b/block/block-backend.c
index de5496af66..21b834e9df 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -2269,7 +2269,7 @@ void blk_update_root_state(BlockBackend *blk)
assert(blk->root);
blk->root_state.open_flags = blk->root->bs->open_flags;
- blk->root_state.read_only = blk->root->bs->read_only;
+ blk->root_state.read_only = bdrv_is_read_only(blk->root->bs);
blk->root_state.detect_zeroes = blk->root->bs->detect_zeroes;
}