[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v5 10/42] block: Use CAF in bdrv_is_encrypted()
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PATCH v5 10/42] block: Use CAF in bdrv_is_encrypted() |
Date: |
Thu, 13 Jun 2019 00:09:32 +0200 |
bdrv_is_encrypted() should not only check the BDS's backing child, but
any filtered child: If a filter's child is encrypted, the filter node
itself naturally is encrypted, too. Furthermore, we need to recurse
down the chain.
(CAF means child access function.)
Signed-off-by: Max Reitz <address@hidden>
---
block.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/block.c b/block.c
index 45882a3470..567a0f82c8 100644
--- a/block.c
+++ b/block.c
@@ -4574,10 +4574,14 @@ bool bdrv_is_sg(BlockDriverState *bs)
bool bdrv_is_encrypted(BlockDriverState *bs)
{
- if (bs->backing && bs->backing->bs->encrypted) {
+ BlockDriverState *filtered = bdrv_filtered_bs(bs);
+ if (bs->encrypted) {
return true;
}
- return bs->encrypted;
+ if (filtered && bdrv_is_encrypted(filtered)) {
+ return true;
+ }
+ return false;
}
const char *bdrv_get_format_name(BlockDriverState *bs)
--
2.21.0
- [Qemu-devel] [PATCH v5 03/42] throttle: Support compressed writes, (continued)
- [Qemu-devel] [PATCH v5 06/42] qcow2: Implement .bdrv_storage_child(), Max Reitz, 2019/06/12
- [Qemu-devel] [PATCH v5 10/42] block: Use CAF in bdrv_is_encrypted(),
Max Reitz <=
- [Qemu-devel] [PATCH v5 08/42] block: bdrv_set_backing_hd() is about bs->backing, Max Reitz, 2019/06/12
- [Qemu-devel] [PATCH v5 09/42] block: Include filters when freezing backing chain, Max Reitz, 2019/06/12
- [Qemu-devel] [PATCH v5 07/42] block: *filtered_cow_child() for *has_zero_init(), Max Reitz, 2019/06/12
- [Qemu-devel] [PATCH v5 11/42] block: Add bdrv_supports_compressed_writes(), Max Reitz, 2019/06/12