mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
[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 <[email protected]> Acked-by: Pavel Machek <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
543cc27d09
commit
6e1819d615
7 changed files with 475 additions and 7 deletions
|
|
@ -428,14 +428,16 @@ int swap_type_of(dev_t device)
|
|||
{
|
||||
int i;
|
||||
|
||||
if (!device)
|
||||
return -EINVAL;
|
||||
spin_lock(&swap_lock);
|
||||
for (i = 0; i < nr_swapfiles; i++) {
|
||||
struct inode *inode;
|
||||
|
||||
if (!(swap_info[i].flags & SWP_WRITEOK))
|
||||
continue;
|
||||
if (!device) {
|
||||
spin_unlock(&swap_lock);
|
||||
return i;
|
||||
}
|
||||
inode = swap_info->swap_file->f_dentry->d_inode;
|
||||
if (S_ISBLK(inode->i_mode) &&
|
||||
device == MKDEV(imajor(inode), iminor(inode))) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue