aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os/kernel.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibaut@ens-lyon.org>2013-01-09 08:43:53 +0000
committerSamuel Thibault <samuel.thibaut@ens-lyon.org>2013-01-09 08:43:53 +0000
commit4813ceb154c194395dda8c6817e1f06c000470d2 (patch)
tree9dc921acbd3ffcba03cc929d8f41e251efec0879 /extras/mini-os/kernel.c
parentcc4707100aad115c0f384f576c020c6255e77ffb (diff)
downloadxen-4813ceb154c194395dda8c6817e1f06c000470d2.tar.gz
xen-4813ceb154c194395dda8c6817e1f06c000470d2.tar.bz2
xen-4813ceb154c194395dda8c6817e1f06c000470d2.zip
mini-os: Notify shutdown through weak function call instead of wake queue
To allow for more flexibility, this notifies domain shutdown through a function rather than a wake queue, to let the application use a wake queue only if it wishes. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Committed-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'extras/mini-os/kernel.c')
-rw-r--r--extras/mini-os/kernel.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/extras/mini-os/kernel.c b/extras/mini-os/kernel.c
index 0313ec8715..e9402b911d 100644
--- a/extras/mini-os/kernel.c
+++ b/extras/mini-os/kernel.c
@@ -48,12 +48,6 @@
uint8_t xen_features[XENFEAT_NR_SUBMAPS * 32];
-#ifdef CONFIG_XENBUS
-unsigned int do_shutdown = 0;
-unsigned int shutdown_reason;
-DECLARE_WAIT_QUEUE_HEAD(shutdown_queue);
-#endif
-
void setup_xen_features(void)
{
xen_feature_info_t fi;
@@ -71,12 +65,19 @@ void setup_xen_features(void)
}
#ifdef CONFIG_XENBUS
+/* This should be overridden by the application we are linked against. */
+__attribute__((weak)) void app_shutdown(unsigned reason)
+{
+ printk("Shutdown requested: %d\n", reason);
+}
+
static void shutdown_thread(void *p)
{
const char *path = "control/shutdown";
const char *token = path;
xenbus_event_queue events = NULL;
char *shutdown, *err;
+ unsigned int shutdown_reason;
xenbus_watch_path_token(XBT_NIL, path, token, &events);
while ((err = xenbus_read(XBT_NIL, path, &shutdown)) != NULL)
{
@@ -94,10 +95,7 @@ static void shutdown_thread(void *p)
else
/* Unknown */
shutdown_reason = SHUTDOWN_crash;
- wmb();
- do_shutdown = 1;
- wmb();
- wake_up(&shutdown_queue);
+ app_shutdown(shutdown_reason);
}
#endif