diff mbox series

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

Message ID 20220330212902.590099-36-vsementsov@openvz.org
State New
Headers show
Series Transactional block-graph modifying API | expand

Commit Message

Vladimir Sementsov-Ogievskiy March 30, 2022, 9:28 p.m. UTC
To be reused soon.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@openvz.org>
---
 block.c                      | 13 +++++++++++++
 blockdev.c                   | 14 --------------
 include/block/block_int-io.h |  1 +
 3 files changed, 14 insertions(+), 14 deletions(-)
diff mbox series

Patch

diff --git a/block.c b/block.c
index 17c057a962..9e1be402e2 100644
--- a/block.c
+++ b/block.c
@@ -8039,6 +8039,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 3afd2ceea8..abd0600d15 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -3672,20 +3672,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-io.h b/include/block/block_int-io.h
index bb454200e5..0ce5eaf9a2 100644
--- a/include/block/block_int-io.h
+++ b/include/block/block_int-io.h
@@ -122,6 +122,7 @@  int coroutine_fn bdrv_co_copy_range_to(BdrvChild *src, int64_t src_offset,
 
 int refresh_total_sectors(BlockDriverState *bs, int64_t hint);
 
+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);