X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=tpm.c;h=9a7c7114d388cf984e907e7b77db4f761440ee8f;hb=b1a419ec79c2451fd7b6acfb415a02881ad77844;hp=963b7ee0d82e2de1ed196b6005194d46fe023d14;hpb=27215a22ddade35e83cc8bb4f49a5bd91b98ca19;p=mirror_qemu.git diff --git a/tpm.c b/tpm.c index 963b7ee0d8..9a7c7114d3 100644 --- a/tpm.c +++ b/tpm.c @@ -11,13 +11,13 @@ * * Based on net.c */ -#include "config-host.h" +#include "qemu/osdep.h" -#include "monitor/monitor.h" #include "qapi/qmp/qerror.h" #include "sysemu/tpm_backend.h" #include "sysemu/tpm.h" #include "qemu/config-file.h" +#include "qemu/error-report.h" #include "qmp-commands.h" static QLIST_HEAD(, TPMBackend) tpm_backends = @@ -32,7 +32,7 @@ static TPMDriverOps const *be_drivers[TPM_MAX_DRIVERS] = { }; static enum TpmModel tpm_models[TPM_MAX_MODELS] = { - TPM_MODEL_MAX, + TPM_MODEL__MAX, }; int tpm_register_model(enum TpmModel model) @@ -40,7 +40,7 @@ int tpm_register_model(enum TpmModel model) int i; for (i = 0; i < TPM_MAX_MODELS; i++) { - if (tpm_models[i] == TPM_MODEL_MAX) { + if (tpm_models[i] == TPM_MODEL__MAX) { tpm_models[i] = model; return 0; } @@ -140,21 +140,21 @@ static int configure_tpm(QemuOpts *opts) id = qemu_opts_id(opts); if (id == NULL) { - qerror_report(QERR_MISSING_PARAMETER, "id"); + error_report(QERR_MISSING_PARAMETER, "id"); return 1; } value = qemu_opt_get(opts, "type"); if (!value) { - qerror_report(QERR_MISSING_PARAMETER, "type"); + error_report(QERR_MISSING_PARAMETER, "type"); tpm_display_backend_drivers(); return 1; } be = tpm_get_backend_driver(value); if (be == NULL) { - qerror_report(QERR_INVALID_PARAMETER_VALUE, "type", - "a TPM backend type"); + error_report(QERR_INVALID_PARAMETER_VALUE, + "type", "a TPM backend type"); tpm_display_backend_drivers(); return 1; } @@ -182,7 +182,7 @@ static int configure_tpm(QemuOpts *opts) return 0; } -static int tpm_init_tpmdev(QemuOpts *opts, void *dummy) +static int tpm_init_tpmdev(void *dummy, QemuOpts *opts, Error **errp) { return configure_tpm(opts); } @@ -208,12 +208,11 @@ void tpm_cleanup(void) int tpm_init(void) { if (qemu_opts_foreach(qemu_find_opts("tpmdev"), - tpm_init_tpmdev, NULL, 1) != 0) { + tpm_init_tpmdev, NULL, NULL)) { return -1; } atexit(tpm_cleanup); - return 0; } @@ -229,7 +228,7 @@ int tpm_config_parse(QemuOptsList *opts_list, const char *optarg) tpm_display_backend_drivers(); return -1; } - opts = qemu_opts_parse(opts_list, optarg, 1); + opts = qemu_opts_parse_noisily(opts_list, optarg, true); if (!opts) { return -1; } @@ -261,9 +260,9 @@ static TPMInfo *qmp_query_tpm_inst(TPMBackend *drv) switch (drv->ops->type) { case TPM_TYPE_PASSTHROUGH: - res->options->kind = TPM_TYPE_OPTIONS_KIND_PASSTHROUGH; + res->options->type = TPM_TYPE_OPTIONS_KIND_PASSTHROUGH; tpo = g_new0(TPMPassthroughOptions, 1); - res->options->passthrough = tpo; + res->options->u.passthrough.data = tpo; if (drv->path) { tpo->path = g_strdup(drv->path); tpo->has_path = true; @@ -273,7 +272,7 @@ static TPMInfo *qmp_query_tpm_inst(TPMBackend *drv) tpo->has_cancel_path = true; } break; - case TPM_TYPE_MAX: + case TPM_TYPE__MAX: break; } @@ -312,7 +311,7 @@ TpmTypeList *qmp_query_tpm_types(Error **errp) unsigned int i = 0; TpmTypeList *head = NULL, *prev = NULL, *cur_item; - for (i = 0; i < TPM_TYPE_MAX; i++) { + for (i = 0; i < TPM_TYPE__MAX; i++) { if (!tpm_driver_find_by_type(i)) { continue; } @@ -336,7 +335,7 @@ TpmModelList *qmp_query_tpm_models(Error **errp) unsigned int i = 0; TpmModelList *head = NULL, *prev = NULL, *cur_item; - for (i = 0; i < TPM_MODEL_MAX; i++) { + for (i = 0; i < TPM_MODEL__MAX; i++) { if (!tpm_model_is_registered(i)) { continue; }