diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2006-03-23 06:00:03 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-23 10:38:07 -0500 |
commit | 6e1819d615f24ce0726a7d0bd3dd0152d7b21654 (patch) | |
tree | abc68747446e8241a1a7103882b9f6b6e24fa274 /mm | |
parent | 543cc27d09643640cbc34189c03a40beb8227aef (diff) |
[PATCH] swsusp: userland interface
This patch introduces a user space interface for swsusp.
The interface is based on a special character device, called the snapshot
device, that allows user space processes to perform suspend and resume-related
operations with the help of some ioctls and the read()/write() functions.
Additionally it allows these processes to allocate free swap pages from a
selected swap partition, called the resume partition, so that they know which
sectors of the resume partition are available to them.
The interface uses the same low-level system memory snapshot-handling
functions that are used by the built-it swap-writing/reading code of swsusp.
The interface documentation is included in the patch.
The patch assumes that the major and minor numbers of the snapshot device will
be 10 (ie. misc device) and 231, the registration of which has already been
requested.
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 'mm')
-rw-r--r-- | mm/swapfile.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c index 4d11f9d84666..39aa9d129612 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c | |||
@@ -428,14 +428,16 @@ int swap_type_of(dev_t device) | |||
428 | { | 428 | { |
429 | int i; | 429 | int i; |
430 | 430 | ||
431 | if (!device) | ||
432 | return -EINVAL; | ||
433 | spin_lock(&swap_lock); | 431 | spin_lock(&swap_lock); |
434 | for (i = 0; i < nr_swapfiles; i++) { | 432 | for (i = 0; i < nr_swapfiles; i++) { |
435 | struct inode *inode; | 433 | struct inode *inode; |
436 | 434 | ||
437 | if (!(swap_info[i].flags & SWP_WRITEOK)) | 435 | if (!(swap_info[i].flags & SWP_WRITEOK)) |
438 | continue; | 436 | continue; |
437 | if (!device) { | ||
438 | spin_unlock(&swap_lock); | ||
439 | return i; | ||
440 | } | ||
439 | inode = swap_info->swap_file->f_dentry->d_inode; | 441 | inode = swap_info->swap_file->f_dentry->d_inode; |
440 | if (S_ISBLK(inode->i_mode) && | 442 | if (S_ISBLK(inode->i_mode) && |
441 | device == MKDEV(imajor(inode), iminor(inode))) { | 443 | device == MKDEV(imajor(inode), iminor(inode))) { |