#include <linux/suspend.h>
#include <linux/reboot.h>
#include <linux/string.h>
#include <linux/device.h>
#include <linux/miscdevice.h>
#include <linux/mm.h>
#include <linux/swap.h>
#include <linux/swapops.h>
#include <linux/pm.h>
#include <linux/fs.h>
#include <linux/compat.h>
#include <linux/console.h>
#include <linux/cpu.h>
#include <linux/freezer.h>
#include <linux/uaccess.h>
#include "power.h"
static bool need_wait;
static struct snapshot_data { … } snapshot_state;
int is_hibernate_resume_dev(dev_t dev)
{ … }
static int snapshot_open(struct inode *inode, struct file *filp)
{ … }
static int snapshot_release(struct inode *inode, struct file *filp)
{ … }
static ssize_t snapshot_read(struct file *filp, char __user *buf,
size_t count, loff_t *offp)
{ … }
static ssize_t snapshot_write(struct file *filp, const char __user *buf,
size_t count, loff_t *offp)
{ … }
struct compat_resume_swap_area { … } __packed;
static int snapshot_set_swap_area(struct snapshot_data *data,
void __user *argp)
{ … }
static long snapshot_ioctl(struct file *filp, unsigned int cmd,
unsigned long arg)
{ … }
#ifdef CONFIG_COMPAT
static long
snapshot_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ … }
#endif
static const struct file_operations snapshot_fops = …;
static struct miscdevice snapshot_device = …;
static int __init snapshot_device_init(void)
{
return misc_register(&snapshot_device);
};
device_initcall(snapshot_device_init);