tpm-backend: Made few interface methods optional

This allows backend implementations left optional interface methods.
For mandatory methods assertion checks added.

Took the opportunity to remove unused methods:
 - tpm_backend_get_desc()
 - TPMDriverOps->handle_startup_error

Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger<stefanb@linux.vnet.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
This commit is contained in:
Amarnath Valluri 2017-09-29 14:10:16 +03:00 committed by Stefan Berger
parent f35fe5cb97
commit 93330cf542
4 changed files with 28 additions and 62 deletions

View file

@ -47,6 +47,7 @@ struct TPMBackend {
TPMState *tpm_state;
GThreadPool *thread_pool;
TPMRecvDataCB *recv_data_callback;
bool had_startup_error;
char *id;
enum TpmModel fe_model;
@ -75,7 +76,7 @@ struct TPMDriverOps {
enum TpmType type;
const QemuOptDesc *opts;
/* get a descriptive text of the backend to display to the user */
const char *(*desc)(void);
const char *desc;
TPMBackend *(*create)(QemuOpts *opts, const char *id);
@ -83,8 +84,6 @@ struct TPMDriverOps {
int (*init)(TPMBackend *t);
/* start up the TPM on the backend */
int (*startup_tpm)(TPMBackend *t);
/* returns true if nothing will ever answer TPM requests */
bool (*had_startup_error)(TPMBackend *t);
size_t (*realloc_buffer)(TPMSizedBuffer *sb);
@ -108,14 +107,6 @@ struct TPMDriverOps {
*/
enum TpmType tpm_backend_get_type(TPMBackend *s);
/**
* tpm_backend_get_desc:
* @s: the backend
*
* Returns a human readable description of the backend.
*/
const char *tpm_backend_get_desc(TPMBackend *s);
/**
* tpm_backend_init:
* @s: the backend to initialized