debuggers.hg

view xen/common/shutdown.c @ 22676:e8acb9753ff1

Use bool_t for various boolean variables

... decreasing cache footprint. As a prerequisite this requires making
cmdline_parse() a little more flexible.

Also remove a few variables altogether, and adjust sections
annotations for several others.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Keir Fraser <keir@xen.org>
author Keir Fraser <keir@xen.org>
date Fri Dec 24 10:10:45 2010 +0000 (2010-12-24)
parents 06c384172152
children
line source
1 #include <xen/config.h>
2 #include <xen/init.h>
3 #include <xen/lib.h>
4 #include <xen/sched.h>
5 #include <xen/domain.h>
6 #include <xen/delay.h>
7 #include <xen/shutdown.h>
8 #include <xen/console.h>
9 #include <xen/kexec.h>
10 #include <asm/debugger.h>
11 #include <public/sched.h>
13 /* opt_noreboot: If true, machine will need manual reset on error. */
14 bool_t __read_mostly opt_noreboot;
15 boolean_param("noreboot", opt_noreboot);
17 static void maybe_reboot(void)
18 {
19 if ( opt_noreboot )
20 {
21 printk("'noreboot' set - not rebooting.\n");
22 machine_halt();
23 }
24 else
25 {
26 printk("rebooting machine in 5 seconds.\n");
27 watchdog_disable();
28 machine_restart(5000);
29 }
30 }
32 void dom0_shutdown(u8 reason)
33 {
34 switch ( reason )
35 {
36 case SHUTDOWN_poweroff:
37 {
38 printk("Domain 0 halted: halting machine.\n");
39 machine_halt();
40 break; /* not reached */
41 }
43 case SHUTDOWN_crash:
44 {
45 debugger_trap_immediate();
46 printk("Domain 0 crashed: ");
47 maybe_reboot();
48 break; /* not reached */
49 }
51 case SHUTDOWN_reboot:
52 {
53 printk("Domain 0 shutdown: rebooting machine.\n");
54 machine_restart(0);
55 break; /* not reached */
56 }
58 case SHUTDOWN_watchdog:
59 {
60 printk("Domain 0 shutdown: watchdog rebooting machine.\n");
61 kexec_crash();
62 machine_restart(0);
63 break; /* not reached */
64 }
66 default:
67 {
68 printk("Domain 0 shutdown (unknown reason %u): ", reason);
69 maybe_reboot();
70 break; /* not reached */
71 }
72 }
73 }