[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 02/21] block: introduce blk_replace_bs
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[PATCH 02/21] block: introduce blk_replace_bs |
Date: |
Mon, 17 May 2021 09:44:09 +0300 |
Add function to change bs inside blk.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.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 880e903293..aec05ef0a0 100644
--- a/include/sysemu/block-backend.h
+++ b/include/sysemu/block-backend.h
@@ -98,6 +98,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 de5496af66..b1abc6f3e6 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -870,6 +870,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.29.2
- [PATCH 00/21] block: publish backup-top filter, Vladimir Sementsov-Ogievskiy, 2021/05/17
- [PATCH] block/copy-on-read: use bdrv_drop_filter() and drop s->active, Vladimir Sementsov-Ogievskiy, 2021/05/17
- [PATCH 01/21] block: introduce bdrv_replace_child_bs(), Vladimir Sementsov-Ogievskiy, 2021/05/17
- Re: [PATCH 01/21] block: introduce bdrv_replace_child_bs(), Vladimir Sementsov-Ogievskiy, 2021/05/19
- Re: [PATCH 01/21] block: introduce bdrv_replace_child_bs(), Max Reitz, 2021/05/19
- Re: [PATCH 01/21] block: introduce bdrv_replace_child_bs(), Vladimir Sementsov-Ogievskiy, 2021/05/19
[PATCH 02/21] block: introduce blk_replace_bs,
Vladimir Sementsov-Ogievskiy <=
[PATCH 05/21] block: rename backup-top to copy-before-write, Vladimir Sementsov-Ogievskiy, 2021/05/17
[PATCH 03/21] qdev-properties: PropertyInfo: add realized_set_allowed field, Vladimir Sementsov-Ogievskiy, 2021/05/17
[PATCH 10/21] block/copy-before-write: relax permission requirements when no parents, Vladimir Sementsov-Ogievskiy, 2021/05/17