[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 25/30] qapi tpm: Elide redundant has_FOO in generated C
From: |
Markus Armbruster |
Subject: |
[PULL 25/30] qapi tpm: Elide redundant has_FOO in generated C |
Date: |
Wed, 14 Dec 2022 08:47:16 +0100 |
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/tpm.json.
Said commit explains the transformation in more detail. The invariant
violations mentioned there do not occur here.
Cc: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Message-Id: <20221104160712.3005652-26-armbru@redhat.com>
---
backends/tpm/tpm_passthrough.c | 2 --
monitor/hmp-cmds.c | 8 ++++----
scripts/qapi/schema.py | 1 -
3 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/backends/tpm/tpm_passthrough.c b/backends/tpm/tpm_passthrough.c
index 5a2f74db1b..179697a3a9 100644
--- a/backends/tpm/tpm_passthrough.c
+++ b/backends/tpm/tpm_passthrough.c
@@ -259,12 +259,10 @@ tpm_passthrough_handle_device_opts(TPMPassthruState
*tpm_pt, QemuOpts *opts)
value = qemu_opt_get(opts, "cancel-path");
if (value) {
tpm_pt->options->cancel_path = g_strdup(value);
- tpm_pt->options->has_cancel_path = true;
}
value = qemu_opt_get(opts, "path");
if (value) {
- tpm_pt->options->has_path = true;
tpm_pt->options->path = g_strdup(value);
}
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index a41f94a34a..3ada344d77 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -864,10 +864,10 @@ void hmp_info_tpm(Monitor *mon, const QDict *qdict)
case TPM_TYPE_PASSTHROUGH:
tpo = ti->options->u.passthrough.data;
monitor_printf(mon, "%s%s%s%s",
- tpo->has_path ? ",path=" : "",
- tpo->has_path ? tpo->path : "",
- tpo->has_cancel_path ? ",cancel-path=" : "",
- tpo->has_cancel_path ? tpo->cancel_path : "");
+ tpo->path ? ",path=" : "",
+ tpo->path ?: "",
+ tpo->cancel_path ? ",cancel-path=" : "",
+ tpo->cancel_path ?: "");
break;
case TPM_TYPE_EMULATOR:
teo = ti->options->u.emulator.data;
diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py
index 0544037e71..f0726af876 100644
--- a/scripts/qapi/schema.py
+++ b/scripts/qapi/schema.py
@@ -759,7 +759,6 @@ def need_has(self):
assert self.type
# Temporary hack to support dropping the has_FOO in reviewable chunks
opt_out = [
- 'qapi/tpm.json',
'qapi/transaction.json',
'qapi/ui.json',
'qapi/virtio.json',
--
2.37.3
- [PULL 11/30] qapi chardev: Elide redundant has_FOO in generated C, (continued)
- [PULL 11/30] qapi chardev: Elide redundant has_FOO in generated C, Markus Armbruster, 2022/12/14
- [PULL 28/30] qapi virtio: Elide redundant has_FOO in generated C, Markus Armbruster, 2022/12/14
- [PULL 16/30] qapi migration: Elide redundant has_FOO in generated C, Markus Armbruster, 2022/12/14
- [PULL 07/30] qapi audio: Elide redundant has_FOO in generated C, Markus Armbruster, 2022/12/14
- [PULL 22/30] qapi rocker: Elide redundant has_FOO in generated C, Markus Armbruster, 2022/12/14
- [PULL 12/30] qapi crypto: Elide redundant has_FOO in generated C, Markus Armbruster, 2022/12/14
- [PULL 02/30] qapi: Tidy up whitespace in generated code, Markus Armbruster, 2022/12/14
- [PULL 19/30] qapi pci: Elide redundant has_FOO in generated C, Markus Armbruster, 2022/12/14
- [PULL 15/30] qapi machine: Elide redundant has_FOO in generated C, Markus Armbruster, 2022/12/14
- [PULL 17/30] qapi misc: Elide redundant has_FOO in generated C, Markus Armbruster, 2022/12/14
- [PULL 25/30] qapi tpm: Elide redundant has_FOO in generated C,
Markus Armbruster <=
- [PULL 10/30] qapi block: Elide redundant has_FOO in generated C, Markus Armbruster, 2022/12/14
- [PULL 06/30] qapi acpi: Elide redundant has_FOO in generated C, Markus Armbruster, 2022/12/14
- [PULL 08/30] blockdev: Clean up abuse of DriveBackup member format, Markus Armbruster, 2022/12/14
- [PULL 23/30] qapi run-state: Elide redundant has_FOO in generated C, Markus Armbruster, 2022/12/14
- [PULL 27/30] qapi ui: Elide redundant has_FOO in generated C, Markus Armbruster, 2022/12/14
- [PULL 13/30] qapi dump: Elide redundant has_FOO in generated C, Markus Armbruster, 2022/12/14
- [PULL 29/30] qapi qga: Elide redundant has_FOO in generated C, Markus Armbruster, 2022/12/14
- [PULL 14/30] qapi job: Elide redundant has_FOO in generated C, Markus Armbruster, 2022/12/14
- [PULL 26/30] qapi transaction: Elide redundant has_FOO in generated C, Markus Armbruster, 2022/12/14
- [PULL 21/30] qapi replay: Elide redundant has_FOO in generated C, Markus Armbruster, 2022/12/14