[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 22/56] block: introduce blk_replace_bs
From: |
Hanna Reitz |
Subject: |
[PULL 22/56] block: introduce blk_replace_bs |
Date: |
Wed, 1 Sep 2021 17:15:45 +0200 |
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Add function to change bs inside blk.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20210824083856.17408-3-vsementsov@virtuozzo.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
---
include/sysemu/block-backend.h | 1 +
block/block-backend.c | 8 ++++++++
2 files changed, 9 insertions(+)
diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h
index 9ac5f7bbd3..29d4fdbf63 100644
--- a/include/sysemu/block-backend.h
+++ b/include/sysemu/block-backend.h
@@ -102,6 +102,7 @@ BlockBackend *blk_by_public(BlockBackendPublic *public);
BlockDriverState *blk_bs(BlockBackend *blk);
void blk_remove_bs(BlockBackend *blk);
int blk_insert_bs(BlockBackend *blk, BlockDriverState *bs, Error **errp);
+int blk_replace_bs(BlockBackend *blk, BlockDriverState *new_bs, Error **errp);
bool bdrv_has_blk(BlockDriverState *bs);
bool bdrv_is_root_node(BlockDriverState *bs);
int blk_set_perm(BlockBackend *blk, uint64_t perm, uint64_t shared_perm,
diff --git a/block/block-backend.c b/block/block-backend.c
index deb55c272e..6140d133e2 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -869,6 +869,14 @@ int blk_insert_bs(BlockBackend *blk, BlockDriverState *bs,
Error **errp)
return 0;
}
+/*
+ * Change BlockDriverState associated with @blk.
+ */
+int blk_replace_bs(BlockBackend *blk, BlockDriverState *new_bs, Error **errp)
+{
+ return bdrv_replace_child_bs(blk->root, new_bs, errp);
+}
+
/*
* Sets the permission bitmasks that the user of the BlockBackend needs.
*/
--
2.31.1
- [PULL 13/56] qemu-iotests: insert valgrind command line as wrapper for qemu binary, (continued)
- [PULL 13/56] qemu-iotests: insert valgrind command line as wrapper for qemu binary, Hanna Reitz, 2021/09/01
- [PULL 14/56] docs/devel/testing: add -valgrind option to the debug section of QEMU iotests, Hanna Reitz, 2021/09/01
- [PULL 16/56] docs/devel/testing: add -p option to the debug section of QEMU iotests, Hanna Reitz, 2021/09/01
- [PULL 17/56] block/monitor: Consolidate hmp_handle_error calls to reduce redundant code, Hanna Reitz, 2021/09/01
- [PULL 18/56] raw-format: drop WRITE and RESIZE child perms when possible, Hanna Reitz, 2021/09/01
- [PULL 15/56] qemu-iotests: add option to show qemu binary logs on stdout, Hanna Reitz, 2021/09/01
- [PULL 19/56] iotests: use with-statement for open() calls, Hanna Reitz, 2021/09/01
- [PULL 21/56] block: introduce bdrv_replace_child_bs(), Hanna Reitz, 2021/09/01
- [PULL 20/56] iotests: use subprocess.DEVNULL instead of open("/dev/null"), Hanna Reitz, 2021/09/01
- [PULL 23/56] qdev-properties: PropertyInfo: add realized_set_allowed field, Hanna Reitz, 2021/09/01
- [PULL 22/56] block: introduce blk_replace_bs,
Hanna Reitz <=
- [PULL 24/56] qdev: allow setting drive property for realized device, Hanna Reitz, 2021/09/01
- [PULL 25/56] block: rename backup-top to copy-before-write, Hanna Reitz, 2021/09/01
- [PULL 26/56] block-copy: move detecting fleecing scheme to block-copy, Hanna Reitz, 2021/09/01
- [PULL 28/56] block/backup: set copy_range and compress after filter insertion, Hanna Reitz, 2021/09/01
- [PULL 27/56] block/block-copy: introduce block_copy_set_copy_opts(), Hanna Reitz, 2021/09/01
- [PULL 31/56] block/copy-before-write: drop extra bdrv_unref on failure path, Hanna Reitz, 2021/09/01
- [PULL 29/56] block/backup: move cluster size calculation to block-copy, Hanna Reitz, 2021/09/01
- [PULL 33/56] block/copy-before-write: bdrv_cbw_append(): replace child at last, Hanna Reitz, 2021/09/01
- [PULL 30/56] block/copy-before-write: relax permission requirements when no parents, Hanna Reitz, 2021/09/01
- [PULL 32/56] block/copy-before-write: use file child instead of backing, Hanna Reitz, 2021/09/01