Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 42708
b: refs/heads/master
c: 3592695
h: refs/heads/master
v: v3
  • Loading branch information
Stefan Seyfried authored and Linus Torvalds committed Dec 7, 2006
1 parent 054bf44 commit 3d568b9
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 074cec54d1049ab580ecd0026623b553e0e270c4
refs/heads/master: 3592695c363c3f3119621bdcf5ed852d6b9d1a5c
7 changes: 6 additions & 1 deletion trunk/kernel/power/power.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,12 @@ extern void snapshot_free_unused_memory(struct snapshot_handle *handle);
#define SNAPSHOT_FREE_SWAP_PAGES _IO(SNAPSHOT_IOC_MAGIC, 9)
#define SNAPSHOT_SET_SWAP_FILE _IOW(SNAPSHOT_IOC_MAGIC, 10, unsigned int)
#define SNAPSHOT_S2RAM _IO(SNAPSHOT_IOC_MAGIC, 11)
#define SNAPSHOT_IOC_MAXNR 11
#define SNAPSHOT_PMOPS _IOW(SNAPSHOT_IOC_MAGIC, 12, unsigned int)
#define SNAPSHOT_IOC_MAXNR 12

#define PMOPS_PREPARE 1
#define PMOPS_ENTER 2
#define PMOPS_FINISH 3

/**
* The bitmap is used for tracing allocated swap pages
Expand Down
28 changes: 28 additions & 0 deletions trunk/kernel/power/user.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include <linux/suspend.h>
#include <linux/syscalls.h>
#include <linux/reboot.h>
#include <linux/string.h>
#include <linux/device.h>
#include <linux/miscdevice.h>
Expand Down Expand Up @@ -313,6 +314,33 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
up(&pm_sem);
break;

case SNAPSHOT_PMOPS:
switch (arg) {

case PMOPS_PREPARE:
if (pm_ops->prepare) {
error = pm_ops->prepare(PM_SUSPEND_DISK);
}
break;

case PMOPS_ENTER:
kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
error = pm_ops->enter(PM_SUSPEND_DISK);
break;

case PMOPS_FINISH:
if (pm_ops && pm_ops->finish) {
pm_ops->finish(PM_SUSPEND_DISK);
}
break;

default:
printk(KERN_ERR "SNAPSHOT_PMOPS: invalid argument %ld\n", arg);
error = -EINVAL;

}
break;

default:
error = -ENOTTY;

Expand Down

0 comments on commit 3d568b9

Please sign in to comment.