aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/power.h
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2006-03-23 05:59:59 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-23 10:38:07 -0500
commitf577eb30afdc68233f25d4d82b04102129262365 (patch)
tree25d3c2fa8dfbf42fd0d4776a36166736fcc1446a /kernel/power/power.h
parent2b322ce210aec74ae0d02938d3a01e29fe079469 (diff)
[PATCH] swsusp: low level interface
Introduce the low level interface that can be used for handling the snapshot of the system memory by the in-kernel swap-writing/reading code of swsusp and the userland interface code (to be introduced shortly). Also change the way in which swsusp records the allocated swap pages and, consequently, simplifies the in-kernel swap-writing/reading code (this is necessary for the userland interface too). To this end, it introduces two helper functions in mm/swapfile.c, so that the swsusp code does not refer directly to the swap internals. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Adrian Bunk <bunk@stusta.de> 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.h26
1 files changed, 18 insertions, 8 deletions
diff --git a/kernel/power/power.h b/kernel/power/power.h
index 388dba680841..ea7132ed029b 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -37,21 +37,31 @@ extern struct subsystem power_subsys;
37/* References to section boundaries */ 37/* References to section boundaries */
38extern const void __nosave_begin, __nosave_end; 38extern const void __nosave_begin, __nosave_end;
39 39
40extern unsigned int nr_copy_pages;
41extern struct pbe *pagedir_nosave; 40extern struct pbe *pagedir_nosave;
42 41
43/* Preferred image size in bytes (default 500 MB) */ 42/* Preferred image size in bytes (default 500 MB) */
44extern unsigned long image_size; 43extern unsigned long image_size;
45 44
45extern int in_suspend;
46
46extern asmlinkage int swsusp_arch_suspend(void); 47extern asmlinkage int swsusp_arch_suspend(void);
47extern asmlinkage int swsusp_arch_resume(void); 48extern asmlinkage int swsusp_arch_resume(void);
48 49
49extern unsigned int count_data_pages(void); 50extern unsigned int count_data_pages(void);
50extern void free_pagedir(struct pbe *pblist);
51extern void release_eaten_pages(void);
52extern struct pbe *alloc_pagedir(unsigned nr_pages, gfp_t gfp_mask, int safe_needed);
53extern void swsusp_free(void); 51extern void swsusp_free(void);
54extern int alloc_data_pages(struct pbe *pblist, gfp_t gfp_mask, int safe_needed); 52
55extern unsigned int snapshot_nr_pages(void); 53struct snapshot_handle {
56extern struct pbe *snapshot_pblist(void); 54 loff_t offset;
57extern void snapshot_pblist_set(struct pbe *pblist); 55 unsigned int page;
56 unsigned int page_offset;
57 unsigned int prev;
58 struct pbe *pbe;
59 void *buffer;
60 unsigned int buf_offset;
61};
62
63#define data_of(handle) ((handle).buffer + (handle).buf_offset)
64
65extern int snapshot_read_next(struct snapshot_handle *handle, size_t count);
66extern int snapshot_write_next(struct snapshot_handle *handle, size_t count);
67int snapshot_image_loaded(struct snapshot_handle *handle);