[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [RFC PATCH 12/41] block: Require .bdrv_child_perm() with ch
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [RFC PATCH 12/41] block: Require .bdrv_child_perm() with child nodes |
Date: |
Mon, 13 Feb 2017 18:22:34 +0100 |
All block drivers that can have child nodes implement .bdrv_child_perm()
now. Make this officially a requirement by asserting that only drivers
without children can omit .bdrv_child_perm().
Signed-off-by: Kevin Wolf <address@hidden>
---
block.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/block.c b/block.c
index 8e99bb5..682548a 100644
--- a/block.c
+++ b/block.c
@@ -1307,8 +1307,9 @@ static int bdrv_check_perm(BlockDriverState *bs, uint64_t
cumulative_perms,
cumulative_shared_perms, errp);
}
- /* Drivers may not have .bdrv_child_perm() */
+ /* Drivers that never have children can omit .bdrv_child_perm() */
if (!drv->bdrv_child_perm) {
+ assert(QLIST_EMPTY(&bs->children));
return 0;
}
@@ -1342,8 +1343,9 @@ static void bdrv_set_perm(BlockDriverState *bs, uint64_t
cumulative_perms,
drv->bdrv_set_perm(bs, cumulative_perms, cumulative_shared_perms);
}
- /* Drivers may not have .bdrv_child_perm() */
+ /* Drivers that never have children can omit .bdrv_child_perm() */
if (!drv->bdrv_child_perm) {
+ assert(QLIST_EMPTY(&bs->children));
return;
}
--
1.8.3.1
- Re: [Qemu-block] [RFC PATCH 09/41] block: Default .bdrv_child_perm() for format drivers, (continued)
Re: [Qemu-block] [RFC PATCH 09/41] block: Default .bdrv_child_perm() for format drivers, Max Reitz, 2017/02/15
[Qemu-block] [RFC PATCH 10/41] block: Request child permissions in format drivers, Kevin Wolf, 2017/02/13
[Qemu-block] [RFC PATCH 11/41] vvfat: Implement .bdrv_child_perm(), Kevin Wolf, 2017/02/13
[Qemu-block] [RFC PATCH 12/41] block: Require .bdrv_child_perm() with child nodes,
Kevin Wolf <=
[Qemu-block] [RFC PATCH 13/41] block: Request real permissions in bdrv_attach_child(), Kevin Wolf, 2017/02/13
[Qemu-block] [RFC PATCH 14/41] block: Add permissions to BlockBackend, Kevin Wolf, 2017/02/13
[Qemu-block] [RFC PATCH 15/41] block: Add permissions to blk_new(), Kevin Wolf, 2017/02/13
[Qemu-block] [RFC PATCH 17/41] block: Request real permissions in blk_new_open(), Kevin Wolf, 2017/02/13
[Qemu-block] [RFC PATCH 16/41] block: Add error parameter to blk_insert_bs(), Kevin Wolf, 2017/02/13