[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH RESEND 14/50] block: Make some BB functions fall bac
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PATCH RESEND 14/50] block: Make some BB functions fall back to BBRS |
Date: |
Tue, 27 Jan 2015 14:45:47 -0500 |
If there is no BDS tree attached to a BlockBackend, functions that can
do so should fall back to the BlockBackendRootState structure (which are
blk_is_read_only() and blk_get_flags(), because the read-only status and
the "open flags" are part of the BBRS).
Signed-off-by: Max Reitz <address@hidden>
---
block/block-backend.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/block/block-backend.c b/block/block-backend.c
index 7be03ee..62be370 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -829,7 +829,11 @@ void blk_error_action(BlockBackend *blk, BlockErrorAction
action,
int blk_is_read_only(BlockBackend *blk)
{
- return bdrv_is_read_only(blk->bs);
+ if (blk->bs) {
+ return bdrv_is_read_only(blk->bs);
+ } else {
+ return blk->root_state.read_only;
+ }
}
int blk_is_sg(BlockBackend *blk)
@@ -874,7 +878,11 @@ void blk_eject(BlockBackend *blk, bool eject_flag)
int blk_get_flags(BlockBackend *blk)
{
- return bdrv_get_flags(blk->bs);
+ if (blk->bs) {
+ return bdrv_get_flags(blk->bs);
+ } else {
+ return blk->root_state.open_flags;
+ }
}
void blk_set_guest_block_size(BlockBackend *blk, int align)
--
2.1.0
- [Qemu-devel] [PATCH RESEND 44/50] block: Inquire tray state before tray-moved events, (continued)
- [Qemu-devel] [PATCH RESEND 44/50] block: Inquire tray state before tray-moved events, Max Reitz, 2015/01/27
- [Qemu-devel] [PATCH RESEND 49/50] iotests: More options for VM.add_drive(), Max Reitz, 2015/01/27
- [Qemu-devel] [PATCH RESEND 50/50] iotests: Add test for change-related QMP commands, Max Reitz, 2015/01/27
- [Qemu-devel] [PATCH RESEND 48/50] hmp: Add read-only option to change command, Max Reitz, 2015/01/27
- [Qemu-devel] [PATCH RESEND 03/50] hw/block/fdc: Implement tray status, Max Reitz, 2015/01/27
- [Qemu-devel] [PATCH RESEND 17/50] block: Respect empty BB in bdrv_lookup_bs(), Max Reitz, 2015/01/27
- [Qemu-devel] [PATCH RESEND 37/50] block: Add blk_remove_bs(), Max Reitz, 2015/01/27
- [Qemu-devel] [PATCH RESEND 20/50] blockdev: Check blk_is_available() in sn-del-int-sync, Max Reitz, 2015/01/27
- [Qemu-devel] [PATCH RESEND 14/50] block: Make some BB functions fall back to BBRS,
Max Reitz <=
- [Qemu-devel] [PATCH RESEND 01/50] blockdev: Allow creation of BDS trees without BB, Max Reitz, 2015/01/27
- [Qemu-devel] [PATCH RESEND 22/50] blockdev: Check BB validity in drive-backup TA, Max Reitz, 2015/01/27
- [Qemu-devel] [PATCH RESEND 13/50] block: Add BlockBackendRootState, Max Reitz, 2015/01/27
- [Qemu-devel] [PATCH RESEND 24/50] blockdev: Check BB validity in block-stream, Max Reitz, 2015/01/27