]> xenbits.xensource.com Git - people/liuw/stubdom.git/commitdiff
mini-os/tpmback: Replace UUID field with opaque pointer
authorDaniel De Graaf <dgdegra@tycho.nsa.gov>
Thu, 21 Mar 2013 20:11:21 +0000 (16:11 -0400)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 12 Apr 2013 13:28:17 +0000 (14:28 +0100)
Instead of only recording the UUID field, which may not be of interest
to all tpmback implementations, provide a user-settable opaque pointer
associated with the tpmback instance.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
vtpmmgr/init.c
vtpmmgr/vtpmmgr.c

index 00dd9f3516aa0d599084025e38fa358f9cf42073..33ac1525fcb542dfa3e5cedc5b8e31ec6e245e57 100644 (file)
@@ -436,6 +436,12 @@ egress:
    return status;
 }
 
+/* Set up the opaque field to contain a pointer to the UUID */
+static void set_opaque_to_uuid(domid_t domid, unsigned int handle)
+{
+   tpmback_set_opaque(domid, handle, tpmback_get_uuid(domid, handle));
+}
+
 TPM_RESULT vtpmmgr_init(int argc, char** argv) {
    TPM_RESULT status = TPM_SUCCESS;
 
@@ -462,7 +468,7 @@ TPM_RESULT vtpmmgr_init(int argc, char** argv) {
    }
 
    //Setup tpmback device
-   init_tpmback(NULL, NULL);
+   init_tpmback(set_opaque_to_uuid, NULL);
 
    //Setup tpm access
    switch(opts.tpmdriver) {
index 563f4e8c5827d59be755298c65d3dafbb4a60453..270ca8a93c5eec329c25852f71fb5d41950e3f40 100644 (file)
@@ -61,7 +61,7 @@ void main_loop(void) {
       tpmcmd->resp = respbuf;
 
       /* Process the command */
-      vtpmmgr_handle_cmd(tpmcmd->uuid, tpmcmd);
+      vtpmmgr_handle_cmd(tpmcmd->opaque, tpmcmd);
 
       /* Send response */
       tpmback_resp(tpmcmd);