diff options
Diffstat (limited to 'kernel/power/swap.c')
-rw-r--r-- | kernel/power/swap.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/kernel/power/swap.c b/kernel/power/swap.c index 8b1a1b837145..917aba100575 100644 --- a/kernel/power/swap.c +++ b/kernel/power/swap.c | |||
@@ -33,8 +33,9 @@ extern char resume_file[]; | |||
33 | #define SWSUSP_SIG "S1SUSPEND" | 33 | #define SWSUSP_SIG "S1SUSPEND" |
34 | 34 | ||
35 | struct swsusp_header { | 35 | struct swsusp_header { |
36 | char reserved[PAGE_SIZE - 20 - sizeof(sector_t)]; | 36 | char reserved[PAGE_SIZE - 20 - sizeof(sector_t) - sizeof(int)]; |
37 | sector_t image; | 37 | sector_t image; |
38 | unsigned int flags; /* Flags to pass to the "boot" kernel */ | ||
38 | char orig_sig[10]; | 39 | char orig_sig[10]; |
39 | char sig[10]; | 40 | char sig[10]; |
40 | } __attribute__((packed)); | 41 | } __attribute__((packed)); |
@@ -138,7 +139,7 @@ static int wait_on_bio_chain(struct bio **bio_chain) | |||
138 | * Saving part | 139 | * Saving part |
139 | */ | 140 | */ |
140 | 141 | ||
141 | static int mark_swapfiles(sector_t start) | 142 | static int mark_swapfiles(sector_t start, unsigned int flags) |
142 | { | 143 | { |
143 | int error; | 144 | int error; |
144 | 145 | ||
@@ -148,6 +149,7 @@ static int mark_swapfiles(sector_t start) | |||
148 | memcpy(swsusp_header->orig_sig,swsusp_header->sig, 10); | 149 | memcpy(swsusp_header->orig_sig,swsusp_header->sig, 10); |
149 | memcpy(swsusp_header->sig,SWSUSP_SIG, 10); | 150 | memcpy(swsusp_header->sig,SWSUSP_SIG, 10); |
150 | swsusp_header->image = start; | 151 | swsusp_header->image = start; |
152 | swsusp_header->flags = flags; | ||
151 | error = bio_write_page(swsusp_resume_block, | 153 | error = bio_write_page(swsusp_resume_block, |
152 | swsusp_header, NULL); | 154 | swsusp_header, NULL); |
153 | } else { | 155 | } else { |
@@ -369,6 +371,7 @@ static int enough_swap(unsigned int nr_pages) | |||
369 | 371 | ||
370 | /** | 372 | /** |
371 | * swsusp_write - Write entire image and metadata. | 373 | * swsusp_write - Write entire image and metadata. |
374 | * @flags: flags to pass to the "boot" kernel in the image header | ||
372 | * | 375 | * |
373 | * It is important _NOT_ to umount filesystems at this point. We want | 376 | * It is important _NOT_ to umount filesystems at this point. We want |
374 | * them synced (in case something goes wrong) but we DO not want to mark | 377 | * them synced (in case something goes wrong) but we DO not want to mark |
@@ -376,7 +379,7 @@ static int enough_swap(unsigned int nr_pages) | |||
376 | * correctly, we'll mark system clean, anyway.) | 379 | * correctly, we'll mark system clean, anyway.) |
377 | */ | 380 | */ |
378 | 381 | ||
379 | int swsusp_write(void) | 382 | int swsusp_write(unsigned int flags) |
380 | { | 383 | { |
381 | struct swap_map_handle handle; | 384 | struct swap_map_handle handle; |
382 | struct snapshot_handle snapshot; | 385 | struct snapshot_handle snapshot; |
@@ -415,7 +418,7 @@ int swsusp_write(void) | |||
415 | if (!error) { | 418 | if (!error) { |
416 | flush_swap_writer(&handle); | 419 | flush_swap_writer(&handle); |
417 | printk("S"); | 420 | printk("S"); |
418 | error = mark_swapfiles(start); | 421 | error = mark_swapfiles(start, flags); |
419 | printk("|\n"); | 422 | printk("|\n"); |
420 | } | 423 | } |
421 | } | 424 | } |
@@ -540,13 +543,20 @@ static int load_image(struct swap_map_handle *handle, | |||
540 | return error; | 543 | return error; |
541 | } | 544 | } |
542 | 545 | ||
543 | int swsusp_read(void) | 546 | /** |
547 | * swsusp_read - read the hibernation image. | ||
548 | * @flags_p: flags passed by the "frozen" kernel in the image header should | ||
549 | * be written into this memeory location | ||
550 | */ | ||
551 | |||
552 | int swsusp_read(unsigned int *flags_p) | ||
544 | { | 553 | { |
545 | int error; | 554 | int error; |
546 | struct swap_map_handle handle; | 555 | struct swap_map_handle handle; |
547 | struct snapshot_handle snapshot; | 556 | struct snapshot_handle snapshot; |
548 | struct swsusp_info *header; | 557 | struct swsusp_info *header; |
549 | 558 | ||
559 | *flags_p = swsusp_header->flags; | ||
550 | if (IS_ERR(resume_bdev)) { | 560 | if (IS_ERR(resume_bdev)) { |
551 | pr_debug("swsusp: block device not initialised\n"); | 561 | pr_debug("swsusp: block device not initialised\n"); |
552 | return PTR_ERR(resume_bdev); | 562 | return PTR_ERR(resume_bdev); |