1 |
/* Add/remove paging devices |
/* Add/remove paging devices |
2 |
|
|
3 |
Copyright (C) 1997,98,99,2000,2001 Free Software Foundation, Inc. |
Copyright (C) 1997,98,99,2000,01,02 Free Software Foundation, Inc. |
4 |
Written by Miles Bader <miles@gnu.org> |
Written by Miles Bader <miles@gnu.org> |
5 |
This file is part of the GNU Hurd. |
This file is part of the GNU Hurd. |
6 |
|
|
65 |
#define inform_2_0(fmt, arg...) \ |
#define inform_2_0(fmt, arg...) \ |
66 |
verbose ("%s: Linux 2.0 swap signature, " fmt, name ,##arg) |
verbose ("%s: Linux 2.0 swap signature, " fmt, name ,##arg) |
67 |
#define inform_2_2(fmt, arg...) \ |
#define inform_2_2(fmt, arg...) \ |
68 |
verbose ("%s: Linux 2.2 swap signature v1, %uk swap-space" fmt, \ |
verbose ("%s: Linux 2.2 swap signature v1, %zuk swap-space" fmt, \ |
69 |
name, freepages * (LINUX_PAGE_SIZE / 1024) ,##arg) |
name, freepages * (LINUX_PAGE_SIZE / 1024) ,##arg) |
70 |
|
|
71 |
|
|
130 |
} |
} |
131 |
if (len < LINUX_PAGE_SIZE) |
if (len < LINUX_PAGE_SIZE) |
132 |
{ |
{ |
133 |
error (0, 0, "%s: short read %u reading Linux swap signature page", |
error (0, 0, "%s: short read %zu reading Linux swap signature page", |
134 |
name, len); |
name, len); |
135 |
return EINVAL; |
return EINVAL; |
136 |
} |
} |
184 |
/* The wasted pages were already marked "bad". */ |
/* The wasted pages were already marked "bad". */ |
185 |
bad -= waste; |
bad -= waste; |
186 |
if (bad > 0) |
if (bad > 0) |
187 |
inform_2_0 ("%dk swap-space (%dk bad, %dk wasted at end)", |
inform_2_0 ("%zdk swap-space (%zdk bad, %dk wasted at end)", |
188 |
freepages * (LINUX_PAGE_SIZE / 1024), |
freepages * (LINUX_PAGE_SIZE / 1024), |
189 |
bad * (LINUX_PAGE_SIZE / 1024), |
bad * (LINUX_PAGE_SIZE / 1024), |
190 |
waste * (LINUX_PAGE_SIZE / 1024)); |
waste * (LINUX_PAGE_SIZE / 1024)); |
191 |
else |
else |
192 |
inform_2_0 ("%dk swap-space (%dk wasted at end)", |
inform_2_0 ("%zdk swap-space (%dk wasted at end)", |
193 |
freepages * (LINUX_PAGE_SIZE / 1024), |
freepages * (LINUX_PAGE_SIZE / 1024), |
194 |
waste * (LINUX_PAGE_SIZE / 1024)); |
waste * (LINUX_PAGE_SIZE / 1024)); |
195 |
} |
} |
196 |
else if (bad > 0) |
else if (bad > 0) |
197 |
inform_2_0 ("%dk swap-space (excludes %dk marked bad)", |
inform_2_0 ("%zdk swap-space (excludes %zdk marked bad)", |
198 |
freepages * (LINUX_PAGE_SIZE / 1024), |
freepages * (LINUX_PAGE_SIZE / 1024), |
199 |
bad * (LINUX_PAGE_SIZE / 1024)); |
bad * (LINUX_PAGE_SIZE / 1024)); |
200 |
else |
else |
201 |
inform_2_0 ("%dk swap-space", freepages * (LINUX_PAGE_SIZE / 1024)); |
inform_2_0 ("%zdk swap-space", freepages * (LINUX_PAGE_SIZE / 1024)); |
202 |
} |
} |
203 |
/* Check for Linux 2.2 format. */ |
/* Check for Linux 2.2 format. */ |
204 |
else if (!memcmp ("SWAPSPACE2", buf + LINUX_PAGE_SIZE-10, 10)) |
else if (!memcmp ("SWAPSPACE2", buf + LINUX_PAGE_SIZE-10, 10)) |
261 |
size_t wastek = waste * (LINUX_PAGE_SIZE / 1024); |
size_t wastek = waste * (LINUX_PAGE_SIZE / 1024); |
262 |
if (badk && wastek) |
if (badk && wastek) |
263 |
inform_2_2 ("\ |
inform_2_2 ("\ |
264 |
(excludes %uk marked bad and %uk at end of partition)", |
(excludes %zuk marked bad and %zuk at end of partition)", |
265 |
badk, wastek); |
badk, wastek); |
266 |
else if (badk) |
else if (badk) |
267 |
inform_2_2 (" (excludes %uk marked bad)", badk); |
inform_2_2 (" (excludes %zuk marked bad)", badk); |
268 |
else if (wastek) |
else if (wastek) |
269 |
inform_2_2 (" (excludes %uk at end of partition)", wastek); |
inform_2_2 (" (excludes %zuk at end of partition)", wastek); |
270 |
else |
else |
271 |
inform_2_2 (""); |
inform_2_2 (""); |
272 |
} |
} |