# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID 9ec0b4f10b4f588f5e7764a6a64e5fcd0f9af0f1
# Parent 28a752998a233198ace62e3c96b1de636cacf2b6
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@xxxxxxxxxx>
Signed-off-by: Vincent Scarlata <vincent.r.scarlata@xxxxxxxxx>
---
tools/examples/vtpm | 6 ------
tools/examples/vtpm-common.sh | 36 +++++++++++++++++-------------------
2 files changed, 17 insertions(+), 25 deletions(-)
diff -r 28a752998a23 -r 9ec0b4f10b4f tools/examples/vtpm
--- a/tools/examples/vtpm Sat Jun 24 23:39:05 2006 +0100
+++ b/tools/examples/vtpm Sat Jun 24 23:44:18 2006 +0100
@@ -9,13 +9,7 @@ case "$command" in
add)
vtpm_create_instance
;;
- online)
- vtpm_create_instance
- ;;
remove)
- vtpm_remove_instance
- ;;
- offline)
vtpm_remove_instance
;;
esac
diff -r 28a752998a23 -r 9ec0b4f10b4f tools/examples/vtpm-common.sh
--- a/tools/examples/vtpm-common.sh Sat Jun 24 23:39:05 2006 +0100
+++ b/tools/examples/vtpm-common.sh Sat Jun 24 23:44:18 2006 +0100
@@ -23,7 +23,7 @@ VTPMDB="/etc/xen/vtpm.db"
VTPMDB="/etc/xen/vtpm.db"
#In the vtpm-impl file some commands should be defined:
-# vtpm_create, vtpm_setup, vtpm_reset, etc. (see below)
+# vtpm_create, vtpm_setup, vtpm_start, etc. (see below)
#This should be indicated by setting VTPM_IMPL_DEFINED.
if [ -r "$dir/vtpm-impl" ]; then
. "$dir/vtpm-impl"
@@ -36,7 +36,7 @@ if [ -z "$VTPM_IMPL_DEFINED" ]; then
function vtpm_setup() {
true
}
- function vtpm_reset() {
+ function vtpm_start() {
true
}
function vtpm_suspend() {
@@ -256,22 +256,22 @@ function vtpm_create_instance () {
else
instance=$(vtpmdb_get_free_instancenum)
fi
- if [ "$reason" == "create" ]; then
- vtpm_create $instance
- else
- vtpm_resume $instance $domname
- fi
+
+ vtpm_create $instance
+
if [ $vtpm_fatal_error -eq 0 ]; then
vtpmdb_add_instance $domname $instance
fi
+ else
+ if [ "$reason" == "resume" ]; then
+ vtpm_resume $instance
+ else
+ vtpm_start $instance
+ fi
fi
release_lock vtpmdb
- if [ $vtpm_fatal_error -eq 0 -a \
- "$reason" == "create" ]; then
- vtpm_reset $instance
- fi
xenstore_write $XENBUS_PATH/instance $instance
}
@@ -283,19 +283,17 @@ function vtpm_remove_instance () {
local instance reason domname
domname=$(xenstore_read "$XENBUS_PATH"/domain)
- if [ "$doname" != "" ]; then
+ if [ "$domname" != "" ]; then
claim_lock vtpmdb
instance=$(vtpmdb_find_instance $domname)
if [ "$instance" != "0" ]; then
- if [ "$reason" == "suspend" ]; then
- vtpm_suspend $instance
- fi
- fi
- fi
-
- release_lock vtpmdb
+ vtpm_suspend $instance
+ fi
+
+ release_lock vtpmdb
+ fi
}
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|