aboutsummaryrefslogtreecommitdiff
path: root/block/qcow.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2022-11-04 17:06:52 +0100
committerMarkus Armbruster <armbru@redhat.com>2022-12-14 20:03:25 +0100
commit54fde4ff0621c22b15cbaaa3c74301cc0dbd1c9e (patch)
tree373c23134aab19ba0edf43249e7722eea1d01d14 /block/qcow.c
parent8461b4d60153ba923c47b6e2f9e270c0e8d6d49c (diff)
qapi block: Elide redundant has_FOO in generated C
The has_FOO for pointer-valued FOO are redundant, except for arrays. They are also a nuisance to work with. Recent commit "qapi: Start to elide redundant has_FOO in generated C" provided the means to elide them step by step. This is the step for qapi/block*.json. Said commit explains the transformation in more detail. There is one instance of the invariant violation mentioned there: qcow2_signal_corruption() passes false, "" when node_name is an empty string. Take care to pass NULL then. The previous two commits cleaned up two more. Additionally, helper bdrv_latency_histogram_stats() loses its output parameters and returns a value instead. Cc: Kevin Wolf <kwolf@redhat.com> Cc: Hanna Reitz <hreitz@redhat.com> Cc: qemu-block@nongnu.org Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20221104160712.3005652-11-armbru@redhat.com> [Fixes for #ifndef LIBRBD_SUPPORTS_ENCRYPTION and MacOS squashed in]
Diffstat (limited to 'block/qcow.c')
-rw-r--r--block/qcow.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/block/qcow.c b/block/qcow.c
index daa38839ab..8bffc41531 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -825,7 +825,7 @@ static int coroutine_fn qcow_co_create(BlockdevCreateOptions *opts,
return -EINVAL;
}
- if (qcow_opts->has_encrypt &&
+ if (qcow_opts->encrypt &&
qcow_opts->encrypt->format != Q_CRYPTO_BLOCK_FORMAT_QCOW)
{
error_setg(errp, "Unsupported encryption format");
@@ -853,7 +853,7 @@ static int coroutine_fn qcow_co_create(BlockdevCreateOptions *opts,
header.size = cpu_to_be64(total_size);
header_size = sizeof(header);
backing_filename_len = 0;
- if (qcow_opts->has_backing_file) {
+ if (qcow_opts->backing_file) {
if (strcmp(qcow_opts->backing_file, "fat:")) {
header.backing_file_offset = cpu_to_be64(header_size);
backing_filename_len = strlen(qcow_opts->backing_file);
@@ -861,7 +861,7 @@ static int coroutine_fn qcow_co_create(BlockdevCreateOptions *opts,
header_size += backing_filename_len;
} else {
/* special backing file for vvfat */
- qcow_opts->has_backing_file = false;
+ qcow_opts->backing_file = NULL;
}
header.cluster_bits = 9; /* 512 byte cluster to avoid copying
unmodified sectors */
@@ -876,7 +876,7 @@ static int coroutine_fn qcow_co_create(BlockdevCreateOptions *opts,
header.l1_table_offset = cpu_to_be64(header_size);
- if (qcow_opts->has_encrypt) {
+ if (qcow_opts->encrypt) {
header.crypt_method = cpu_to_be32(QCOW_CRYPT_AES);
crypto = qcrypto_block_create(qcow_opts->encrypt, "encrypt.",
@@ -895,7 +895,7 @@ static int coroutine_fn qcow_co_create(BlockdevCreateOptions *opts,
goto exit;
}
- if (qcow_opts->has_backing_file) {
+ if (qcow_opts->backing_file) {
ret = blk_co_pwrite(qcow_blk, sizeof(header), backing_filename_len,
qcow_opts->backing_file, 0);
if (ret < 0) {