diff options
Diffstat (limited to 'mkswap.c')
-rw-r--r-- | mkswap.c | 18 |
1 files changed, 2 insertions, 16 deletions
@@ -63,20 +63,6 @@ static int version = -1; | |||
63 | 63 | ||
64 | #define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r)) | 64 | #define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r)) |
65 | 65 | ||
66 | static int linux_version_code(void) | ||
67 | { | ||
68 | struct utsname my_utsname; | ||
69 | int p, q, r; | ||
70 | |||
71 | if (uname(&my_utsname) == 0) { | ||
72 | p = atoi(strtok(my_utsname.release, ".")); | ||
73 | q = atoi(strtok(NULL, ".")); | ||
74 | r = atoi(strtok(NULL, ".")); | ||
75 | return MAKE_VERSION(p, q, r); | ||
76 | } | ||
77 | return 0; | ||
78 | } | ||
79 | |||
80 | /* | 66 | /* |
81 | * The definition of the union swap_header uses the constant PAGE_SIZE. | 67 | * The definition of the union swap_header uses the constant PAGE_SIZE. |
82 | * Unfortunately, on some architectures this depends on the hardware model, | 68 | * Unfortunately, on some architectures this depends on the hardware model, |
@@ -345,7 +331,7 @@ int mkswap_main(int argc, char **argv) | |||
345 | if (version == -1) { | 331 | if (version == -1) { |
346 | if (PAGES <= V0_MAX_PAGES) | 332 | if (PAGES <= V0_MAX_PAGES) |
347 | version = 0; | 333 | version = 0; |
348 | else if (linux_version_code() < MAKE_VERSION(2, 1, 117)) | 334 | else if (get_kernel_revision() < MAKE_VERSION(2, 1, 117)) |
349 | version = 0; | 335 | version = 0; |
350 | else if (pagesize < 2048) | 336 | else if (pagesize < 2048) |
351 | version = 0; | 337 | version = 0; |
@@ -366,7 +352,7 @@ int mkswap_main(int argc, char **argv) | |||
366 | #else | 352 | #else |
367 | if (!version) | 353 | if (!version) |
368 | maxpages = V0_MAX_PAGES; | 354 | maxpages = V0_MAX_PAGES; |
369 | else if (linux_version_code() >= MAKE_VERSION(2, 2, 1)) | 355 | else if (get_kernel_revision() >= MAKE_VERSION(2, 2, 1)) |
370 | maxpages = V1_MAX_PAGES; | 356 | maxpages = V1_MAX_PAGES; |
371 | else { | 357 | else { |
372 | maxpages = V1_OLD_MAX_PAGES; | 358 | maxpages = V1_OLD_MAX_PAGES; |