diff mbox series

[v6,3/7] block: make bdrv_find_child() function public

Message ID 20230222185552.913733-4-vsementsov@yandex-team.ru
State New
Headers show
Series blockdev-replace | expand

Commit Message

Vladimir Sementsov-Ogievskiy Feb. 22, 2023, 6:55 p.m. UTC
To be reused soon for blockdev-replace functionality.

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

Patch

diff --git a/include/block/block_int-io.h b/include/block/block_int-io.h
index 4430bf4c4a..8f76a33c96 100644
--- a/include/block/block_int-io.h
+++ b/include/block/block_int-io.h
@@ -127,6 +127,7 @@  int coroutine_fn bdrv_co_refresh_total_sectors(BlockDriverState *bs,
 int co_wrapper_mixed
 bdrv_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);
diff --git a/block.c b/block.c
index 0c807d15cd..c78de4d280 100644
--- a/block.c
+++ b/block.c
@@ -8005,6 +8005,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 d7b5c18f0a..461657edda 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -3617,20 +3617,6 @@  out:
     aio_context_release(aio_context);
 }
 
-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, const char *child,
                            const char *node, Error **errp)
 {