diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2006-03-23 06:00:00 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-23 10:38:07 -0500 |
commit | 61159a314bca6408320c3173c1282c64f5cdaa76 (patch) | |
tree | 8e1b7627443da0fd52b2fac66366dde9f7871f1e /kernel/power/power.h | |
parent | f577eb30afdc68233f25d4d82b04102129262365 (diff) |
[PATCH] swsusp: separate swap-writing/reading code
Move the swap-writing/reading code of swsusp to a separate file.
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/power.h')
-rw-r--r-- | kernel/power/power.h | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/kernel/power/power.h b/kernel/power/power.h index ea7132ed029b..089c84bed895 100644 --- a/kernel/power/power.h +++ b/kernel/power/power.h | |||
@@ -41,8 +41,8 @@ extern struct pbe *pagedir_nosave; | |||
41 | 41 | ||
42 | /* Preferred image size in bytes (default 500 MB) */ | 42 | /* Preferred image size in bytes (default 500 MB) */ |
43 | extern unsigned long image_size; | 43 | extern unsigned long image_size; |
44 | |||
45 | extern int in_suspend; | 44 | extern int in_suspend; |
45 | extern dev_t swsusp_resume_device; | ||
46 | 46 | ||
47 | extern asmlinkage int swsusp_arch_suspend(void); | 47 | extern asmlinkage int swsusp_arch_suspend(void); |
48 | extern asmlinkage int swsusp_arch_resume(void); | 48 | extern asmlinkage int swsusp_arch_resume(void); |
@@ -65,3 +65,32 @@ struct snapshot_handle { | |||
65 | extern int snapshot_read_next(struct snapshot_handle *handle, size_t count); | 65 | extern int snapshot_read_next(struct snapshot_handle *handle, size_t count); |
66 | extern int snapshot_write_next(struct snapshot_handle *handle, size_t count); | 66 | extern int snapshot_write_next(struct snapshot_handle *handle, size_t count); |
67 | int snapshot_image_loaded(struct snapshot_handle *handle); | 67 | int snapshot_image_loaded(struct snapshot_handle *handle); |
68 | |||
69 | /** | ||
70 | * The bitmap is used for tracing allocated swap pages | ||
71 | * | ||
72 | * The entire bitmap consists of a number of bitmap_page | ||
73 | * structures linked with the help of the .next member. | ||
74 | * Thus each page can be allocated individually, so we only | ||
75 | * need to make 0-order memory allocations to create | ||
76 | * the bitmap. | ||
77 | */ | ||
78 | |||
79 | #define BITMAP_PAGE_SIZE (PAGE_SIZE - sizeof(void *)) | ||
80 | #define BITMAP_PAGE_CHUNKS (BITMAP_PAGE_SIZE / sizeof(long)) | ||
81 | #define BITS_PER_CHUNK (sizeof(long) * 8) | ||
82 | #define BITMAP_PAGE_BITS (BITMAP_PAGE_CHUNKS * BITS_PER_CHUNK) | ||
83 | |||
84 | struct bitmap_page { | ||
85 | unsigned long chunks[BITMAP_PAGE_CHUNKS]; | ||
86 | struct bitmap_page *next; | ||
87 | }; | ||
88 | |||
89 | extern void free_bitmap(struct bitmap_page *bitmap); | ||
90 | extern struct bitmap_page *alloc_bitmap(unsigned int nr_bits); | ||
91 | extern unsigned long alloc_swap_page(int swap, struct bitmap_page *bitmap); | ||
92 | extern void free_all_swap_pages(int swap, struct bitmap_page *bitmap); | ||
93 | |||
94 | extern int swsusp_shrink_memory(void); | ||
95 | extern int swsusp_suspend(void); | ||
96 | extern int swsusp_resume(void); | ||