From 39dc3e4a4e3a485c8a8688bd29476fdbf95b0bb5 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 17 Sep 2021 16:31:16 +0200 Subject: qapi: Convert simple union TpmTypeOptions to flat one Simple unions predate flat unions. Having both complicates the QAPI schema language and the QAPI generator. We haven't been using simple unions in new code for a long time, because they are less flexible and somewhat awkward on the wire. To prepare for their removal, convert simple union TpmTypeOptions to an equivalent flat one, with existing enum TpmType replacing implicit enum TpmTypeOptionsKind. Adds some boilerplate to the schema, which is a bit ugly, but a lot easier to maintain than the simple union feature. Cc: Stefan Berger Signed-off-by: Markus Armbruster Acked-by: Stefan Berger Reviewed-by: Eric Blake Message-Id: <20210917143134.412106-6-armbru@redhat.com> [Indentation tidied up] --- backends/tpm/tpm_emulator.c | 2 +- backends/tpm/tpm_passthrough.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'backends') diff --git a/backends/tpm/tpm_emulator.c b/backends/tpm/tpm_emulator.c index f8095d23d5..87d061e9bb 100644 --- a/backends/tpm/tpm_emulator.c +++ b/backends/tpm/tpm_emulator.c @@ -623,7 +623,7 @@ static TpmTypeOptions *tpm_emulator_get_tpm_options(TPMBackend *tb) TPMEmulator *tpm_emu = TPM_EMULATOR(tb); TpmTypeOptions *options = g_new0(TpmTypeOptions, 1); - options->type = TPM_TYPE_OPTIONS_KIND_EMULATOR; + options->type = TPM_TYPE_EMULATOR; options->u.emulator.data = QAPI_CLONE(TPMEmulatorOptions, tpm_emu->options); return options; diff --git a/backends/tpm/tpm_passthrough.c b/backends/tpm/tpm_passthrough.c index 21b7459183..d5558fae6c 100644 --- a/backends/tpm/tpm_passthrough.c +++ b/backends/tpm/tpm_passthrough.c @@ -321,7 +321,7 @@ static TpmTypeOptions *tpm_passthrough_get_tpm_options(TPMBackend *tb) { TpmTypeOptions *options = g_new0(TpmTypeOptions, 1); - options->type = TPM_TYPE_OPTIONS_KIND_PASSTHROUGH; + options->type = TPM_TYPE_PASSTHROUGH; options->u.passthrough.data = QAPI_CLONE(TPMPassthroughOptions, TPM_PASSTHROUGH(tb)->options); -- cgit v1.2.3-55-g7522