[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 22/64] block: Drop bdrv_is_encrypted()
From: |
Kevin Wolf |
Subject: |
[PULL 22/64] block: Drop bdrv_is_encrypted() |
Date: |
Mon, 7 Sep 2020 13:08:54 +0200 |
From: Max Reitz <mreitz@redhat.com>
The original purpose of bdrv_is_encrypted() was to inquire whether a BDS
can be used without the user entering a password or not. It has not
been used for that purpose for quite some time.
Actually, it is not even fit for that purpose, because to answer that
question, it would have recursively query all of the given node's
children.
So now we have to decide in which direction we want to fix
bdrv_is_encrypted(): Recursively query all children, or drop it and just
use bs->encrypted to get the current node's status?
Nowadays, its only purpose is to report through bdrv_query_image_info()
whether the given image is encrypted or not. For this purpose, it is
probably more interesting to see whether a given node itself is
encrypted or not (otherwise, a management application cannot discern for
certain which nodes are really encrypted and which just have encrypted
children).
Suggested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
---
include/block/block.h | 1 -
block.c | 8 --------
block/qapi.c | 2 +-
3 files changed, 1 insertion(+), 10 deletions(-)
diff --git a/include/block/block.h b/include/block/block.h
index 6e36154061..2c09b93d07 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -532,7 +532,6 @@ BlockDriverState *bdrv_next(BdrvNextIterator *it);
void bdrv_next_cleanup(BdrvNextIterator *it);
BlockDriverState *bdrv_next_monitor_owned(BlockDriverState *bs);
-bool bdrv_is_encrypted(BlockDriverState *bs);
void bdrv_iterate_format(void (*it)(void *opaque, const char *name),
void *opaque, bool read_only);
const char *bdrv_get_node_name(const BlockDriverState *bs);
diff --git a/block.c b/block.c
index edef6273b8..f5eabaa032 100644
--- a/block.c
+++ b/block.c
@@ -5065,14 +5065,6 @@ bool bdrv_is_sg(BlockDriverState *bs)
return bs->sg;
}
-bool bdrv_is_encrypted(BlockDriverState *bs)
-{
- if (bs->backing && bs->backing->bs->encrypted) {
- return true;
- }
- return bs->encrypted;
-}
-
const char *bdrv_get_format_name(BlockDriverState *bs)
{
return bs->drv ? bs->drv->format_name : NULL;
diff --git a/block/qapi.c b/block/qapi.c
index afd9f3b4a7..4807a2b344 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -288,7 +288,7 @@ void bdrv_query_image_info(BlockDriverState *bs,
info->virtual_size = size;
info->actual_size = bdrv_get_allocated_file_size(bs);
info->has_actual_size = info->actual_size >= 0;
- if (bdrv_is_encrypted(bs)) {
+ if (bs->encrypted) {
info->encrypted = true;
info->has_encrypted = true;
}
--
2.25.4
- [PULL 16/64] block/nvme: Use an array of EventNotifier, (continued)
- [PULL 16/64] block/nvme: Use an array of EventNotifier, Kevin Wolf, 2020/09/07
- [PULL 17/64] block: Add child access functions, Kevin Wolf, 2020/09/07
- [PULL 19/64] block: bdrv_cow_child() for bdrv_has_zero_init(), Kevin Wolf, 2020/09/07
- [PULL 18/64] block: Add chain helper functions, Kevin Wolf, 2020/09/07
- [PULL 20/64] block: bdrv_set_backing_hd() is about bs->backing, Kevin Wolf, 2020/09/07
- [PULL 21/64] block: Include filters when freezing backing chain, Kevin Wolf, 2020/09/07
- [PULL 23/64] block: Add bdrv_supports_compressed_writes(), Kevin Wolf, 2020/09/07
- [PULL 24/64] throttle: Support compressed writes, Kevin Wolf, 2020/09/07
- [PULL 25/64] copy-on-read: Support compressed writes, Kevin Wolf, 2020/09/07
- [PULL 26/64] block: Use bdrv_filter_(bs|child) where obvious, Kevin Wolf, 2020/09/07
- [PULL 22/64] block: Drop bdrv_is_encrypted(),
Kevin Wolf <=
- [PULL 27/64] block: Use CAFs in block status functions, Kevin Wolf, 2020/09/07
- [PULL 28/64] stream: Deal with filters, Kevin Wolf, 2020/09/07
- [PULL 29/64] block: Use CAFs when working with backing chains, Kevin Wolf, 2020/09/07
- [PULL 32/64] block: Flush all children in generic code, Kevin Wolf, 2020/09/07
- [PULL 31/64] block: Re-evaluate backing file handling in reopen, Kevin Wolf, 2020/09/07
- [PULL 34/64] block: Iterate over children in refresh_limits, Kevin Wolf, 2020/09/07
- [PULL 38/64] block: Use CAFs for debug breakpoints, Kevin Wolf, 2020/09/07
- [PULL 33/64] vmdk: Drop vmdk_co_flush(), Kevin Wolf, 2020/09/07
- [PULL 30/64] block: Use bdrv_cow_child() in bdrv_co_truncate(), Kevin Wolf, 2020/09/07
- [PULL 35/64] block: Use CAFs in bdrv_refresh_filename(), Kevin Wolf, 2020/09/07