tpm: add TPMBackendCmd to hold the request state

This simplifies a bit locality handling, and argument passing, and
could pave the way to queuing requests (if that makes sense).

Signed-off-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:
Marc-André Lureau 2017-10-10 00:55:55 +02:00 committed by Stefan Berger
parent d1fd6b563d
commit 0e43b7e61c
6 changed files with 50 additions and 44 deletions

View file

@ -25,7 +25,7 @@ static void tpm_backend_worker_thread(gpointer data, gpointer user_data)
TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
assert(k->handle_request != NULL);
k->handle_request(s);
k->handle_request(s, (TPMBackendCmd *)data);
}
static void tpm_backend_thread_end(TPMBackend *s)
@ -76,9 +76,9 @@ bool tpm_backend_had_startup_error(TPMBackend *s)
return s->had_startup_error;
}
void tpm_backend_deliver_request(TPMBackend *s)
void tpm_backend_deliver_request(TPMBackend *s, TPMBackendCmd *cmd)
{
g_thread_pool_push(s->thread_pool, NULL, NULL);
g_thread_pool_push(s->thread_pool, cmd, NULL);
}
void tpm_backend_reset(TPMBackend *s)