summaryrefslogtreecommitdiffstats
path: root/kernel/power/user.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2006-12-07 05:34:15 +0100
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-07 17:39:27 +0100
commit37b2ba12df88f0e29f2d52aaf1ab22789377d5b5 (patch)
tree38a05add5793bb82be9afdb9fa81d48ccf70da1f /kernel/power/user.c
parent[PATCH] swsusp: document support for swap files (diff)
downloadlinux-37b2ba12df88f0e29f2d52aaf1ab22789377d5b5.tar.xz
linux-37b2ba12df88f0e29f2d52aaf1ab22789377d5b5.zip
[PATCH] swsusp: add ioctl for swap files support
To be able to use swap files as suspend storage from the userland suspend tools we need an additional ioctl() that will allow us to provide the kernel with both the swap header's offset and the identification of the resume partition. The new ioctl() should be regarded as a replacement for the SNAPSHOT_SET_SWAP_FILE ioctl() that from now on will be considered as obsolete, but has to stay for backwards compatibility of the interface. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/power/user.c')
-rw-r--r--kernel/power/user.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/kernel/power/user.c b/kernel/power/user.c
index f0b7ef8bdd74..05c58a2c0dd4 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -343,6 +343,37 @@ OutS3:
}
break;
+ case SNAPSHOT_SET_SWAP_AREA:
+ if (data->bitmap) {
+ error = -EPERM;
+ } else {
+ struct resume_swap_area swap_area;
+ dev_t swdev;
+
+ error = copy_from_user(&swap_area, (void __user *)arg,
+ sizeof(struct resume_swap_area));
+ if (error) {
+ error = -EFAULT;
+ break;
+ }
+
+ /*
+ * User space encodes device types as two-byte values,
+ * so we need to recode them
+ */
+ swdev = old_decode_dev(swap_area.dev);
+ if (swdev) {
+ offset = swap_area.offset;
+ data->swap = swap_type_of(swdev, offset);
+ if (data->swap < 0)
+ error = -ENODEV;
+ } else {
+ data->swap = -1;
+ error = -EINVAL;
+ }
+ }
+ break;
+
default:
error = -ENOTTY;