diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2006-02-01 06:05:07 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-01 11:53:12 -0500 |
commit | 853609b61ef88b414ffd1613741aa59894334320 (patch) | |
tree | 93def4ef8c820fb678bedf31f144b1d85942c181 | |
parent | e8730eabd45e47e392f230ab8720c4b8537901fc (diff) |
[PATCH] swsusp: use bytes as image size units
Make swsusp use bytes as the image size units, which is needed for future
compatibility.
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>
-rw-r--r-- | Documentation/power/interface.txt | 2 | ||||
-rw-r--r-- | Documentation/power/swsusp.txt | 2 | ||||
-rw-r--r-- | kernel/power/disk.c | 6 | ||||
-rw-r--r-- | kernel/power/power.h | 4 | ||||
-rw-r--r-- | kernel/power/swsusp.c | 8 |
5 files changed, 11 insertions, 11 deletions
diff --git a/Documentation/power/interface.txt b/Documentation/power/interface.txt index bd4ffb5bd49a..4117802af0f8 100644 --- a/Documentation/power/interface.txt +++ b/Documentation/power/interface.txt | |||
@@ -44,7 +44,7 @@ it. | |||
44 | /sys/power/image_size controls the size of the image created by | 44 | /sys/power/image_size controls the size of the image created by |
45 | the suspend-to-disk mechanism. It can be written a string | 45 | the suspend-to-disk mechanism. It can be written a string |
46 | representing a non-negative integer that will be used as an upper | 46 | representing a non-negative integer that will be used as an upper |
47 | limit of the image size, in megabytes. The suspend-to-disk mechanism will | 47 | limit of the image size, in bytes. The suspend-to-disk mechanism will |
48 | do its best to ensure the image size will not exceed that number. However, | 48 | do its best to ensure the image size will not exceed that number. However, |
49 | if this turns out to be impossible, it will try to suspend anyway using the | 49 | if this turns out to be impossible, it will try to suspend anyway using the |
50 | smallest image possible. In particular, if "0" is written to this file, the | 50 | smallest image possible. In particular, if "0" is written to this file, the |
diff --git a/Documentation/power/swsusp.txt b/Documentation/power/swsusp.txt index 08c79d4dc540..b28b7f04abb8 100644 --- a/Documentation/power/swsusp.txt +++ b/Documentation/power/swsusp.txt | |||
@@ -27,7 +27,7 @@ echo shutdown > /sys/power/disk; echo disk > /sys/power/state | |||
27 | 27 | ||
28 | echo platform > /sys/power/disk; echo disk > /sys/power/state | 28 | echo platform > /sys/power/disk; echo disk > /sys/power/state |
29 | 29 | ||
30 | If you want to limit the suspend image size to N megabytes, do | 30 | If you want to limit the suspend image size to N bytes, do |
31 | 31 | ||
32 | echo N > /sys/power/image_size | 32 | echo N > /sys/power/image_size |
33 | 33 | ||
diff --git a/kernel/power/disk.c b/kernel/power/disk.c index e24446f8d8cd..f2b3b0ea512a 100644 --- a/kernel/power/disk.c +++ b/kernel/power/disk.c | |||
@@ -367,14 +367,14 @@ power_attr(resume); | |||
367 | 367 | ||
368 | static ssize_t image_size_show(struct subsystem * subsys, char *buf) | 368 | static ssize_t image_size_show(struct subsystem * subsys, char *buf) |
369 | { | 369 | { |
370 | return sprintf(buf, "%u\n", image_size); | 370 | return sprintf(buf, "%lu\n", image_size); |
371 | } | 371 | } |
372 | 372 | ||
373 | static ssize_t image_size_store(struct subsystem * subsys, const char * buf, size_t n) | 373 | static ssize_t image_size_store(struct subsystem * subsys, const char * buf, size_t n) |
374 | { | 374 | { |
375 | unsigned int size; | 375 | unsigned long size; |
376 | 376 | ||
377 | if (sscanf(buf, "%u", &size) == 1) { | 377 | if (sscanf(buf, "%lu", &size) == 1) { |
378 | image_size = size; | 378 | image_size = size; |
379 | return n; | 379 | return n; |
380 | } | 380 | } |
diff --git a/kernel/power/power.h b/kernel/power/power.h index 7e8492fd1423..61beb5e0e927 100644 --- a/kernel/power/power.h +++ b/kernel/power/power.h | |||
@@ -51,8 +51,8 @@ extern const void __nosave_begin, __nosave_end; | |||
51 | extern unsigned int nr_copy_pages; | 51 | extern unsigned int nr_copy_pages; |
52 | extern struct pbe *pagedir_nosave; | 52 | extern struct pbe *pagedir_nosave; |
53 | 53 | ||
54 | /* Preferred image size in MB (default 500) */ | 54 | /* Preferred image size in bytes (default 500 MB) */ |
55 | extern unsigned int image_size; | 55 | extern unsigned long image_size; |
56 | 56 | ||
57 | extern asmlinkage int swsusp_arch_suspend(void); | 57 | extern asmlinkage int swsusp_arch_suspend(void); |
58 | extern asmlinkage int swsusp_arch_resume(void); | 58 | extern asmlinkage int swsusp_arch_resume(void); |
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c index 55a18d26abed..59c91c148e82 100644 --- a/kernel/power/swsusp.c +++ b/kernel/power/swsusp.c | |||
@@ -70,12 +70,12 @@ | |||
70 | #include "power.h" | 70 | #include "power.h" |
71 | 71 | ||
72 | /* | 72 | /* |
73 | * Preferred image size in MB (tunable via /sys/power/image_size). | 73 | * Preferred image size in bytes (tunable via /sys/power/image_size). |
74 | * When it is set to N, swsusp will do its best to ensure the image | 74 | * When it is set to N, swsusp will do its best to ensure the image |
75 | * size will not exceed N MB, but if that is impossible, it will | 75 | * size will not exceed N bytes, but if that is impossible, it will |
76 | * try to create the smallest image possible. | 76 | * try to create the smallest image possible. |
77 | */ | 77 | */ |
78 | unsigned int image_size = 500; | 78 | unsigned long image_size = 500 * 1024 * 1024; |
79 | 79 | ||
80 | #ifdef CONFIG_HIGHMEM | 80 | #ifdef CONFIG_HIGHMEM |
81 | unsigned int count_highmem_pages(void); | 81 | unsigned int count_highmem_pages(void); |
@@ -590,7 +590,7 @@ int swsusp_shrink_memory(void) | |||
590 | if (!tmp) | 590 | if (!tmp) |
591 | return -ENOMEM; | 591 | return -ENOMEM; |
592 | pages += tmp; | 592 | pages += tmp; |
593 | } else if (size > (image_size * 1024 * 1024) / PAGE_SIZE) { | 593 | } else if (size > image_size / PAGE_SIZE) { |
594 | tmp = shrink_all_memory(SHRINK_BITE); | 594 | tmp = shrink_all_memory(SHRINK_BITE); |
595 | pages += tmp; | 595 | pages += tmp; |
596 | } | 596 | } |