diff mbox series

[v4,35/45] block: make bdrv_find_child() function public

Message ID 20220329204107.411011-36-v.sementsov-og@mail.ru (mailing list archive)
State New, archived
Headers show
Series Transactional block-graph modifying API | expand

Commit Message

Vladimir Sementsov-Ogievskiy March 29, 2022, 8:40 p.m. UTC
To be reused soon.

Signed-off-by: Vladimir Sementsov-Ogievskiy <v.sementsov-og@mail.ru>
---
 block.c                   | 13 +++++++++++++
 blockdev.c                | 14 --------------
 include/block/block_int.h |  1 +
 3 files changed, 14 insertions(+), 14 deletions(-)
diff mbox series

Patch

diff --git a/block.c b/block.c
index d4d0adc6c8..605eabc589 100644
--- a/block.c
+++ b/block.c
@@ -7762,6 +7762,19 @@  int bdrv_make_empty(BdrvChild *c, Error **errp)
     return 0;
 }
 
+BdrvChild *bdrv_find_child(BlockDriverState *parent_bs, const char *child_name)
+{
+    BdrvChild *child;
+
+    QLIST_FOREACH(child, &parent_bs->children, next) {
+        if (strcmp(child->name, child_name) == 0) {
+            return child;
+        }
+    }
+
+    return NULL;
+}
+
 /*
  * Return the child that @bs acts as an overlay for, and from which data may be
  * copied in COW or COR operations.  Usually this is the backing file.
diff --git a/blockdev.c b/blockdev.c
index d95e1e6922..b10e867676 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -3630,20 +3630,6 @@  out:
     tran_finalize(tran, ret);
 }
 
-static BdrvChild *bdrv_find_child(BlockDriverState *parent_bs,
-                                  const char *child_name)
-{
-    BdrvChild *child;
-
-    QLIST_FOREACH(child, &parent_bs->children, next) {
-        if (strcmp(child->name, child_name) == 0) {
-            return child;
-        }
-    }
-
-    return NULL;
-}
-
 void qmp_x_blockdev_change(const char *parent, bool has_child,
                            const char *child, bool has_node,
                            const char *node, Error **errp)
diff --git a/include/block/block_int.h b/include/block/block_int.h
index f6deb89f23..da3da8ac02 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -1462,6 +1462,7 @@  BdrvDirtyBitmap *block_dirty_bitmap_remove(const char *node, const char *name,
                                            BlockDriverState **bitmap_bs,
                                            Error **errp);
 
+BdrvChild *bdrv_find_child(BlockDriverState *parent_bs, const char *child_name);
 BdrvChild *bdrv_cow_child(BlockDriverState *bs);
 BdrvChild *bdrv_filter_child(BlockDriverState *bs);
 BdrvChild *bdrv_filter_or_cow_child(BlockDriverState *bs);