[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 07/38] block/quorum: Implement bdrv_is_inserted()
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PATCH v3 07/38] block/quorum: Implement bdrv_is_inserted() |
Date: |
Wed, 3 Jun 2015 21:43:48 +0200 |
bdrv_is_inserted() should be invoked recursively on the children of
quorum.
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
block/quorum.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/block/quorum.c b/block/quorum.c
index f91ef75..61fdcd0 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -1061,6 +1061,20 @@ static void quorum_refresh_filename(BlockDriverState *bs)
bs->full_open_options = opts;
}
+static bool quorum_is_inserted(BlockDriverState *bs)
+{
+ BDRVQuorumState *s = bs->opaque;
+ int i;
+
+ for (i = 0; i < s->num_children; i++) {
+ if (!bdrv_is_inserted(s->bs[i])) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
static BlockDriver bdrv_quorum = {
.format_name = "quorum",
.protocol_name = "quorum",
@@ -1084,6 +1098,8 @@ static BlockDriver bdrv_quorum = {
.is_filter = true,
.bdrv_recurse_is_first_non_filter = quorum_recurse_is_first_non_filter,
+
+ .bdrv_is_inserted = quorum_is_inserted,
};
static void bdrv_quorum_init(void)
--
2.4.1
- [Qemu-devel] [PATCH v3 05/38] block: Add blk_is_available(), (continued)
- [Qemu-devel] [PATCH v3 05/38] block: Add blk_is_available(), Max Reitz, 2015/06/03
- [Qemu-devel] [PATCH v3 04/38] block: Make bdrv_is_inserted() return a bool, Max Reitz, 2015/06/03
- [Qemu-devel] [PATCH v3 06/38] block: Make bdrv_is_inserted() recursive, Max Reitz, 2015/06/03
- [Qemu-devel] [PATCH v3 08/38] block: Invoke change media CB before NULLing drv, Max Reitz, 2015/06/03
- [Qemu-devel] [PATCH v3 07/38] block/quorum: Implement bdrv_is_inserted(),
Max Reitz <=
- [Qemu-devel] [PATCH v3 10/38] hw/usb-storage: Check whether BB is inserted, Max Reitz, 2015/06/03
- [Qemu-devel] [PATCH v3 09/38] hw/block/fdc: Implement tray status, Max Reitz, 2015/06/03