#define pr_fmt(fmt) …
#include <linux/kernel.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/reboot.h>
#include <linux/sysrq.h>
#include <linux/stop_machine.h>
#include <linux/freezer.h>
#include <linux/syscore_ops.h>
#include <linux/export.h>
#include <xen/xen.h>
#include <xen/xenbus.h>
#include <xen/grant_table.h>
#include <xen/events.h>
#include <xen/hvc-console.h>
#include <xen/page.h>
#include <xen/xen-ops.h>
#include <asm/xen/hypercall.h>
#include <asm/xen/hypervisor.h>
enum shutdown_state { … };
static enum shutdown_state shutting_down = …;
struct suspend_info { … };
static RAW_NOTIFIER_HEAD(xen_resume_notifier);
void xen_resume_notifier_register(struct notifier_block *nb)
{ … }
EXPORT_SYMBOL_GPL(…);
void xen_resume_notifier_unregister(struct notifier_block *nb)
{ … }
EXPORT_SYMBOL_GPL(…);
#ifdef CONFIG_HIBERNATE_CALLBACKS
static int xen_suspend(void *data)
{ … }
static void do_suspend(void)
{ … }
#endif
struct shutdown_handler { … };
static int poweroff_nb(struct notifier_block *cb, unsigned long code, void *unused)
{ … }
static void do_poweroff(void)
{ … }
static void do_reboot(void)
{ … }
static const struct shutdown_handler shutdown_handlers[] = …;
static void shutdown_handler(struct xenbus_watch *watch,
const char *path, const char *token)
{ … }
#ifdef CONFIG_MAGIC_SYSRQ
static void sysrq_handler(struct xenbus_watch *watch, const char *path,
const char *token)
{ … }
static struct xenbus_watch sysrq_watch = …;
#endif
static struct xenbus_watch shutdown_watch = …;
static struct notifier_block xen_reboot_nb = …;
static int setup_shutdown_watcher(void)
{ … }
static int shutdown_event(struct notifier_block *notifier,
unsigned long event,
void *data)
{ … }
int xen_setup_shutdown_event(void)
{ … }
EXPORT_SYMBOL_GPL(…);
subsys_initcall(xen_setup_shutdown_event);