ia64/xen-unstable
changeset 10522:9ec0b4f10b4f
Some fine-tuning in the virtual TPM scripts for hotpluging. The changes
enable a virtual TPM to save its state between reboots of the virtual
TPM implementation.
Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
Signed-off-by: Vincent Scarlata <vincent.r.scarlata@intel.com>
enable a virtual TPM to save its state between reboots of the virtual
TPM implementation.
Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
Signed-off-by: Vincent Scarlata <vincent.r.scarlata@intel.com>
author | emellor@leeni.uk.xensource.com |
---|---|
date | Sat Jun 24 23:44:18 2006 +0100 (2006-06-24) |
parents | 28a752998a23 |
children | 1e2ea40078f2 |
files | tools/examples/vtpm tools/examples/vtpm-common.sh |
line diff
1.1 --- a/tools/examples/vtpm Sat Jun 24 23:39:05 2006 +0100 1.2 +++ b/tools/examples/vtpm Sat Jun 24 23:44:18 2006 +0100 1.3 @@ -9,15 +9,9 @@ case "$command" in 1.4 add) 1.5 vtpm_create_instance 1.6 ;; 1.7 - online) 1.8 - vtpm_create_instance 1.9 - ;; 1.10 remove) 1.11 vtpm_remove_instance 1.12 ;; 1.13 - offline) 1.14 - vtpm_remove_instance 1.15 - ;; 1.16 esac 1.17 1.18 if [ $vtpm_fatal_error -eq 0 ]; then
2.1 --- a/tools/examples/vtpm-common.sh Sat Jun 24 23:39:05 2006 +0100 2.2 +++ b/tools/examples/vtpm-common.sh Sat Jun 24 23:44:18 2006 +0100 2.3 @@ -23,7 +23,7 @@ dir=$(dirname "$0") 2.4 VTPMDB="/etc/xen/vtpm.db" 2.5 2.6 #In the vtpm-impl file some commands should be defined: 2.7 -# vtpm_create, vtpm_setup, vtpm_reset, etc. (see below) 2.8 +# vtpm_create, vtpm_setup, vtpm_start, etc. (see below) 2.9 #This should be indicated by setting VTPM_IMPL_DEFINED. 2.10 if [ -r "$dir/vtpm-impl" ]; then 2.11 . "$dir/vtpm-impl" 2.12 @@ -36,7 +36,7 @@ if [ -z "$VTPM_IMPL_DEFINED" ]; then 2.13 function vtpm_setup() { 2.14 true 2.15 } 2.16 - function vtpm_reset() { 2.17 + function vtpm_start() { 2.18 true 2.19 } 2.20 function vtpm_suspend() { 2.21 @@ -256,22 +256,22 @@ function vtpm_create_instance () { 2.22 else 2.23 instance=$(vtpmdb_get_free_instancenum) 2.24 fi 2.25 - if [ "$reason" == "create" ]; then 2.26 - vtpm_create $instance 2.27 - else 2.28 - vtpm_resume $instance $domname 2.29 - fi 2.30 + 2.31 + vtpm_create $instance 2.32 + 2.33 if [ $vtpm_fatal_error -eq 0 ]; then 2.34 vtpmdb_add_instance $domname $instance 2.35 fi 2.36 + else 2.37 + if [ "$reason" == "resume" ]; then 2.38 + vtpm_resume $instance 2.39 + else 2.40 + vtpm_start $instance 2.41 + fi 2.42 fi 2.43 2.44 release_lock vtpmdb 2.45 2.46 - if [ $vtpm_fatal_error -eq 0 -a \ 2.47 - "$reason" == "create" ]; then 2.48 - vtpm_reset $instance 2.49 - fi 2.50 xenstore_write $XENBUS_PATH/instance $instance 2.51 } 2.52 2.53 @@ -283,19 +283,17 @@ function vtpm_remove_instance () { 2.54 local instance reason domname 2.55 domname=$(xenstore_read "$XENBUS_PATH"/domain) 2.56 2.57 - if [ "$doname" != "" ]; then 2.58 + if [ "$domname" != "" ]; then 2.59 claim_lock vtpmdb 2.60 2.61 instance=$(vtpmdb_find_instance $domname) 2.62 2.63 if [ "$instance" != "0" ]; then 2.64 - if [ "$reason" == "suspend" ]; then 2.65 - vtpm_suspend $instance 2.66 - fi 2.67 + vtpm_suspend $instance 2.68 fi 2.69 + 2.70 + release_lock vtpmdb 2.71 fi 2.72 - 2.73 - release_lock vtpmdb 2.74 } 2.75 2.76