[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [mini-os master] Save/Restore Support: Add fini_shutdown call to app exit flow.
commit 48d3b31ce47156d92255a2fe98334dd15a42a097 Author: Bruno Alvisio <bruno.alvisio@xxxxxxxxx> AuthorDate: Tue Mar 27 08:54:20 2018 -0700 Commit: Wei Liu <wei.liu2@xxxxxxxxxx> CommitDate: Tue Mar 27 17:19:36 2018 +0100 Save/Restore Support: Add fini_shutdown call to app exit flow. Instead of calling kernel_shutdown() in the exit flow, a call to fini_shutdown() is added to the existing exit flow. kernel_shutdown() is removed since it is not used in any part of mini-OS. Signed-off-by: Bruno Alvisio <bruno.alvisio@xxxxxxxxx> Reviewed-by: Juergen Gross <jgross@xxxxxxxx> --- include/shutdown.h | 3 +-- main.c | 4 ++++ shutdown.c | 51 +++++++++------------------------------------------ 3 files changed, 14 insertions(+), 44 deletions(-) diff --git a/include/shutdown.h b/include/shutdown.h index a5ec019..88993cb 100644 --- a/include/shutdown.h +++ b/include/shutdown.h @@ -4,8 +4,7 @@ #include <mini-os/hypervisor.h> void init_shutdown(start_info_t *si); - -void kernel_shutdown(int reason) __attribute__((noreturn)); +void fini_shutdown(void); void kernel_suspend(void); #endif diff --git a/main.c b/main.c index 4e42f53..a93bc9d 100644 --- a/main.c +++ b/main.c @@ -17,6 +17,7 @@ #include <unistd.h> #include <xenbus.h> #include <events.h> +#include <shutdown.h> #include <mini-os/lib.h> extern int main(int argc, char *argv[], char *envp[]); @@ -177,6 +178,9 @@ void _exit(int ret) #if defined(HAVE_LWIP) && defined(CONFIG_NETFRONT) stop_networking(); #endif +#ifdef CONFIG_XENBUS + fini_shutdown(); +#endif stop_kernel(); if (!ret) { /* No problem, just shutdown. */ diff --git a/shutdown.c b/shutdown.c index 510f6e1..c7c92cb 100644 --- a/shutdown.c +++ b/shutdown.c @@ -111,19 +111,6 @@ static void shutdown_thread(void *p) } } -static void fini_shutdown(void) -{ - char *err; - - end_shutdown_thread = 1; - xenbus_release_wait_for_watch(&events); - err = xenbus_unwatch_path_token(XBT_NIL, path, token); - if (err) { - free(err); - do_exit(); - } -} - void init_shutdown(start_info_t *si) { start_info_ptr = si; @@ -131,40 +118,20 @@ void init_shutdown(start_info_t *si) end_shutdown_thread = 0; create_thread("shutdown", shutdown_thread, NULL); } -#endif -void kernel_shutdown(int reason) +void fini_shutdown(void) { - char* reason_str = NULL; - - switch(reason) { - case SHUTDOWN_poweroff: - reason_str = "poweroff"; - break; - case SHUTDOWN_reboot: - reason_str = "reboot"; - break; - case SHUTDOWN_crash: - reason_str = "crash"; - break; - default: - do_exit(); - break; - } - - printk("MiniOS will shutdown (reason = %s) ...\n", reason_str); - -#ifdef CONFIG_XENBUS - fini_shutdown(); -#endif - - stop_kernel(); + char *err; - for ( ;; ) { - struct sched_shutdown sched_shutdown = { .reason = reason }; - HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown); + end_shutdown_thread = 1; + xenbus_release_wait_for_watch(&events); + err = xenbus_unwatch_path_token(XBT_NIL, path, token); + if (err) { + free(err); + do_exit(); } } +#endif void kernel_suspend(void) { -- generated by git-patchbot for /home/xen/git/mini-os.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |