aboutsummaryrefslogtreecommitdiff
path: root/block/block-backend.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/block-backend.c')
-rw-r--r--block/block-backend.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/block/block-backend.c b/block/block-backend.c
index 8d6fc77b26..9dcac9792f 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -395,6 +395,23 @@ BlockDriverState *blk_bs(BlockBackend *blk)
}
/*
+ * Returns true if @bs has an associated BlockBackend.
+ */
+bool bdrv_has_blk(BlockDriverState *bs)
+{
+ BdrvChild *child;
+ QLIST_FOREACH(child, &bs->parents, next_parent) {
+ if (child->role == &child_root) {
+ assert(bs->blk);
+ return true;
+ }
+ }
+
+ assert(!bs->blk);
+ return false;
+}
+
+/*
* Return @blk's DriveInfo if any, else null.
*/
DriveInfo *blk_legacy_dinfo(BlockBackend *blk)