[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-API] [PATCH] Add a method to trigger a sleep button push in a domain



# HG changeset patch
# User Paul Durrant <paul.durrant@xxxxxxxxxx>
# Date 1262711029 0
# Node ID bda191b339eb09cc526032aa9f135a0928e2926e
# Parent  aad2380e0a84178812a98ac2e902703eeb2e2d6e
Add a method to trigger a sleep button push in a domain

signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>

diff -r aad2380e0a84 -r bda191b339eb domain-trigger-sleep
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/domain-trigger-sleep      Tue Jan 05 17:03:49 2010 +0000
@@ -0,0 +1,74 @@
+diff -r 0cad02e3383b xc/xc.h
+--- a/xc/xc.h  Wed Dec 23 10:58:05 2009 +0000
++++ b/xc/xc.h  Wed Dec 23 11:00:17 2009 +0000
+@@ -185,6 +185,7 @@
+ int xc_domain_set_timer_mode(int handle, unsigned int domid, int mode);
+ int xc_domain_get_acpi_s_state(int handle, unsigned int domid);
+ int xc_domain_trigger_power(int handle, unsigned int domid);
++int xc_domain_trigger_sleep(int handle, unsigned int domid);
+ 
+ #if XEN_SYSCTL_INTERFACE_VERSION >= 6
+ #define SAFEDIV(a, b)                                 (((b) >= 0) ? (a) / (b) 
: (a))
+diff -r 0cad02e3383b xc/xc.ml
+--- a/xc/xc.ml Wed Dec 23 10:58:05 2009 +0000
++++ b/xc/xc.ml Wed Dec 23 11:00:17 2009 +0000
+@@ -254,6 +254,7 @@
+ external domain_get_acpi_s_state: handle -> domid -> int = 
"stub_xc_domain_get_acpi_s_state"
+ 
+ external domain_trigger_power: handle -> domid -> unit = 
"stub_xc_domain_trigger_power"
++external domain_trigger_sleep: handle -> domid -> unit = 
"stub_xc_domain_trigger_sleep"
+ 
+ (** check if some hvm domain got pv driver or not *)
+ external hvm_check_pvdriver: handle -> domid -> bool
+diff -r 0cad02e3383b xc/xc.mli
+--- a/xc/xc.mli        Wed Dec 23 10:58:05 2009 +0000
++++ b/xc/xc.mli        Wed Dec 23 11:00:17 2009 +0000
+@@ -168,6 +168,8 @@
+ 
+ external domain_trigger_power: handle -> domid -> unit
+   = "stub_xc_domain_trigger_power"
++external domain_trigger_sleep: handle -> domid -> unit
++  = "stub_xc_domain_trigger_sleep"
+ 
+ external hvm_check_pvdriver : handle -> domid -> bool
+   = "stub_xc_hvm_check_pvdriver"
+diff -r 0cad02e3383b xc/xc_lib.c
+--- a/xc/xc_lib.c      Wed Dec 23 10:58:05 2009 +0000
++++ b/xc/xc_lib.c      Wed Dec 23 11:00:17 2009 +0000
+@@ -1562,6 +1562,19 @@
+     return ret;
+ }
+ 
++int xc_domain_trigger_sleep(int handle, unsigned int domid)
++{
++    int ret;
++
++    DECLARE_DOMCTL(XEN_DOMCTL_sendtrigger, domid);
++    domctl.u.sendtrigger.trigger = XEN_DOMCTL_SENDTRIGGER_SLEEP;
++
++      ret = do_domctl(handle, &domctl);
++      if (ret != 0)
++              xc_error_set("sleep button failed: %s", xc_error_get());
++    return ret;
++}
++
+ /*
+  * Local variables:
+  *  indent-tabs-mode: t
+diff -r 0cad02e3383b xc/xc_stubs.c
+--- a/xc/xc_stubs.c    Wed Dec 23 10:58:05 2009 +0000
++++ b/xc/xc_stubs.c    Wed Dec 23 11:00:17 2009 +0000
+@@ -1216,6 +1216,13 @@
+       CAMLreturn(Val_unit);
+ }
+ 
++CAMLprim value stub_xc_domain_trigger_sleep(value handle, value domid)
++{
++      CAMLparam2(handle, domid);
++      xc_domain_trigger_sleep(_H(handle), _D(domid));
++      CAMLreturn(Val_unit);
++}
++
+ /*
+  * Local variables:
+  *  indent-tabs-mode: t
diff -r aad2380e0a84 -r bda191b339eb series
--- a/series    Tue Dec 22 16:22:25 2009 +0000
+++ b/series    Tue Jan 05 17:03:49 2010 +0000
@@ -1,2 +1,3 @@
 dummy
 domain-trigger-power
+domain-trigger-sleep

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.