[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 07/12] block: Remove check_new_perm from bdrv_replace
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 07/12] block: Remove check_new_perm from bdrv_replace_child() |
Date: |
Mon, 13 Mar 2017 15:55:03 +0100 |
All callers pass false now, so the parameter can go away again.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
block.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/block.c b/block.c
index b404ef2..dd38e71 100644
--- a/block.c
+++ b/block.c
@@ -1756,8 +1756,18 @@ static void bdrv_replace_child_noperm(BdrvChild *child,
}
}
-static void bdrv_replace_child(BdrvChild *child, BlockDriverState *new_bs,
- bool check_new_perm)
+/*
+ * Updates @child to change its reference to point to @new_bs, including
+ * checking and applying the necessary permisson updates both to the old node
+ * and to @new_bs.
+ *
+ * NULL is passed as @new_bs for removing the reference before freeing @child.
+ *
+ * If @new_bs is not NULL, bdrv_check_perm() must be called beforehand, as this
+ * function uses bdrv_set_perm() to update the permissions according to the new
+ * reference that @new_bs gets.
+ */
+static void bdrv_replace_child(BdrvChild *child, BlockDriverState *new_bs)
{
BlockDriverState *old_bs = child->bs;
uint64_t perm, shared_perm;
@@ -1775,9 +1785,6 @@ static void bdrv_replace_child(BdrvChild *child,
BlockDriverState *new_bs,
if (new_bs) {
bdrv_get_cumulative_perm(new_bs, &perm, &shared_perm);
- if (check_new_perm) {
- bdrv_check_perm(new_bs, perm, shared_perm, NULL, &error_abort);
- }
bdrv_set_perm(new_bs, perm, shared_perm);
}
}
@@ -1808,7 +1815,7 @@ BdrvChild *bdrv_root_attach_child(BlockDriverState
*child_bs,
};
/* This performs the matching bdrv_set_perm() for the above check. */
- bdrv_replace_child(child, child_bs, false);
+ bdrv_replace_child(child, child_bs);
return child;
}
@@ -1845,7 +1852,7 @@ static void bdrv_detach_child(BdrvChild *child)
child->next.le_prev = NULL;
}
- bdrv_replace_child(child, NULL, false);
+ bdrv_replace_child(child, NULL);
g_free(child->name);
g_free(child);
--
1.8.3.1
- [Qemu-devel] [PULL 00/12] Block layer fixes for 2.9.0-rc1, Kevin Wolf, 2017/03/13
- [Qemu-devel] [PULL 01/12] backup: allow target without .bdrv_get_info, Kevin Wolf, 2017/03/13
- [Qemu-devel] [PULL 02/12] file-posix: Consider max_segments for BlockLimits.max_transfer, Kevin Wolf, 2017/03/13
- [Qemu-devel] [PULL 04/12] backup: React to bdrv_is_allocated() errors, Kevin Wolf, 2017/03/13
- [Qemu-devel] [PULL 05/12] vvfat: React to bdrv_is_allocated() errors, Kevin Wolf, 2017/03/13
- [Qemu-devel] [PULL 06/12] migration: Document handling of bdrv_is_allocated() errors, Kevin Wolf, 2017/03/13
- [Qemu-devel] [PULL 07/12] block: Remove check_new_perm from bdrv_replace_child(),
Kevin Wolf <=
- [Qemu-devel] [PULL 10/12] block: Refresh filename after changing backing file, Kevin Wolf, 2017/03/13
- [Qemu-devel] [PULL 12/12] commit: Implement .bdrv_refresh_filename, Kevin Wolf, 2017/03/13
- [Qemu-devel] [PULL 11/12] mirror: Implement .bdrv_refresh_filename, Kevin Wolf, 2017/03/13
- [Qemu-devel] [PULL 08/12] block: Request block status from *file for BDRV_BLOCK_RAW, Kevin Wolf, 2017/03/13
- [Qemu-devel] [PULL 09/12] commit: Implement bdrv_commit_top.bdrv_co_get_block_status, Kevin Wolf, 2017/03/13
- [Qemu-devel] [PULL 03/12] block: Drop unmaintained 'archipelago' driver, Kevin Wolf, 2017/03/13
- Re: [Qemu-devel] [PULL 00/12] Block layer fixes for 2.9.0-rc1, Peter Maydell, 2017/03/13