summary refs log tree commit diff stats
path: root/scripts/qapi-event.py
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2017-08-24 10:45:59 +0200
committerMarkus Armbruster <armbru@redhat.com>2017-09-04 13:09:13 +0200
commit00bbf50a50e6d6e1a4542db1c1205291395c4105 (patch)
treebe3ffb2ba802bd2ccff2d71f932e74aa4f186cdd /scripts/qapi-event.py
parenta9a72aeefbd3ef8bcbbeeccaf174ee10db2978ac (diff)
downloadfocaccia-qemu-00bbf50a50e6d6e1a4542db1c1205291395c4105.tar.gz
focaccia-qemu-00bbf50a50e6d6e1a4542db1c1205291395c4105.zip
tpm: Clean up model registration & lookup
We have a strict separation between enum TpmModel and tpm_models[]:

* TpmModel may have any number of members.  It just happens to have one.

* tpm_register_model() uses the first empty slot in tpm_models[].

  If you register more than tpm_models[] has space,
  tpn_register_model() fails.  Its caller silently ignores the
  failure.

  Register the same TpmModel more than once has no effect other than
  wasting tpm_models[] slots: tpm_model_is_registered() is happy with
  the first one it finds.

Since we only ever register one model, and tpm_models[] has space for
just that one, this contraption even works.

Turn tpm_models[] into a straight map from enum TpmType to bool.  Much
simpler.

Cc: Stefan Berger <stefanb@us.ibm.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1503564371-26090-5-git-send-email-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
[Commit message typo fixed]
Diffstat (limited to 'scripts/qapi-event.py')
0 files changed, 0 insertions, 0 deletions