From: Stefan Berger Subject: [PATCH][vTPM] Script patch Date: Thu, 22 Jun 2006 19:01:11 -0400 Message-ID: <1151017271.11980.3.camel@941e-2.watson.ibm.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-j5LDKeg233kD3QQyjVDl" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel Cc: Ewan Mellor List-Id: xen-devel@lists.xenproject.org --=-j5LDKeg233kD3QQyjVDl Content-Type: text/plain Content-Transfer-Encoding: 7bit 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 Signed-off-by: Vincent Scarlata --=-j5LDKeg233kD3QQyjVDl Content-Disposition: attachment; filename=vtpm_scripts_fix.diff Content-Type: text/x-patch; name=vtpm_scripts_fix.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit Index: root/xen-unstable.hg/tools/examples/vtpm-common.sh =================================================================== --- root.orig/xen-unstable.hg/tools/examples/vtpm-common.sh +++ root/xen-unstable.hg/tools/examples/vtpm-common.sh @@ -23,7 +23,7 @@ dir=$(dirname "$0") 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 + vtpm_suspend $instance fi - fi - release_lock vtpmdb + release_lock vtpmdb + fi } Index: root/xen-unstable.hg/tools/examples/vtpm =================================================================== --- root.orig/xen-unstable.hg/tools/examples/vtpm +++ root/xen-unstable.hg/tools/examples/vtpm @@ -9,15 +9,9 @@ case "$command" in add) vtpm_create_instance ;; - online) - vtpm_create_instance - ;; remove) vtpm_remove_instance ;; - offline) - vtpm_remove_instance - ;; esac if [ $vtpm_fatal_error -eq 0 ]; then --=-j5LDKeg233kD3QQyjVDl Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-j5LDKeg233kD3QQyjVDl--