Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 42712
b: refs/heads/master
c: 9a154d9
h: refs/heads/master
v: v3
  • Loading branch information
Rafael J. Wysocki authored and Linus Torvalds committed Dec 7, 2006
1 parent 88bb81f commit ace7739
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 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: 3aef83e0ef1ffb8ea3bea97be46821a45c952173
refs/heads/master: 9a154d9d95b7b9845938242f5c62505b3cab5bcd
15 changes: 15 additions & 0 deletions trunk/kernel/power/disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
static int noresume = 0;
char resume_file[256] = CONFIG_PM_STD_PARTITION;
dev_t swsusp_resume_device;
sector_t swsusp_resume_block;

/**
* power_down - Shut machine down for hibernate.
Expand Down Expand Up @@ -423,11 +424,25 @@ static int __init resume_setup(char *str)
return 1;
}

static int __init resume_offset_setup(char *str)
{
unsigned long long offset;

if (noresume)
return 1;

if (sscanf(str, "%llu", &offset) == 1)
swsusp_resume_block = offset;

return 1;
}

static int __init noresume_setup(char *str)
{
noresume = 1;
return 1;
}

__setup("noresume", noresume_setup);
__setup("resume_offset=", resume_offset_setup);
__setup("resume=", resume_setup);
1 change: 1 addition & 0 deletions trunk/kernel/power/power.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ extern const void __nosave_begin, __nosave_end;
extern unsigned long image_size;
extern int in_suspend;
extern dev_t swsusp_resume_device;
extern sector_t swsusp_resume_block;

extern asmlinkage int swsusp_arch_suspend(void);
extern asmlinkage int swsusp_arch_resume(void);
Expand Down
15 changes: 10 additions & 5 deletions trunk/kernel/power/swap.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,14 @@ static int mark_swapfiles(sector_t start)
{
int error;

bio_read_page(0, &swsusp_header, NULL);
bio_read_page(swsusp_resume_block, &swsusp_header, NULL);
if (!memcmp("SWAP-SPACE",swsusp_header.sig, 10) ||
!memcmp("SWAPSPACE2",swsusp_header.sig, 10)) {
memcpy(swsusp_header.orig_sig,swsusp_header.sig, 10);
memcpy(swsusp_header.sig,SWSUSP_SIG, 10);
swsusp_header.image = start;
error = bio_write_page(0, &swsusp_header, NULL);
error = bio_write_page(swsusp_resume_block,
&swsusp_header, NULL);
} else {
printk(KERN_ERR "swsusp: Swap header not found!\n");
error = -ENODEV;
Expand All @@ -184,7 +185,7 @@ static int swsusp_swap_check(void) /* This is called before saving image */
{
int res;

res = swap_type_of(swsusp_resume_device, 0);
res = swap_type_of(swsusp_resume_device, swsusp_resume_block);
if (res < 0)
return res;

Expand Down Expand Up @@ -610,12 +611,16 @@ int swsusp_check(void)
if (!IS_ERR(resume_bdev)) {
set_blocksize(resume_bdev, PAGE_SIZE);
memset(&swsusp_header, 0, sizeof(swsusp_header));
if ((error = bio_read_page(0, &swsusp_header, NULL)))
error = bio_read_page(swsusp_resume_block,
&swsusp_header, NULL);
if (error)
return error;

if (!memcmp(SWSUSP_SIG, swsusp_header.sig, 10)) {
memcpy(swsusp_header.sig, swsusp_header.orig_sig, 10);
/* Reset swap signature now */
error = bio_write_page(0, &swsusp_header, NULL);
error = bio_write_page(swsusp_resume_block,
&swsusp_header, NULL);
} else {
return -EINVAL;
}
Expand Down

0 comments on commit ace7739

Please sign in to comment.