diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2010-09-07 11:25:30 -0700 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2010-09-08 11:02:28 -0700 |
commit | 3cab31db10dd74aa148ad20aaa3455723bf45138 (patch) | |
tree | 35452a78331a34c3487596c50b29b3901727ee41 /kexec/arch/x86_64 | |
parent | ebeb4da62f8b51c63a46349b219a5605ee8d79bd (diff) |
kexec: Move kernel_version into the kexec core
I'm not pleased with the hacks that we use kernel_version
for but kernel_version itself is reasonable code and might
be needed elsewhere, so move kernel_version into the kexec
core.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'kexec/arch/x86_64')
-rw-r--r-- | kexec/arch/x86_64/arch_init.c | 55 |
1 files changed, 1 insertions, 54 deletions
diff --git a/kexec/arch/x86_64/arch_init.c b/kexec/arch/x86_64/arch_init.c index 79fb642..4cffbf6 100644 --- a/kexec/arch/x86_64/arch_init.c +++ b/kexec/arch/x86_64/arch_init.c @@ -1,3 +1,4 @@ +#include "../../kexec.h" #include <errno.h> #include <string.h> #include <sys/utsname.h> @@ -7,60 +8,6 @@ #include "crashdump-x86_64.h" -#define KERNEL_VERSION(major, minor, patch) \ - (((major) << 16) | ((minor) << 8) | patch) - -long kernel_version(void) -{ - struct utsname utsname; - unsigned long major, minor, patch; - char *p; - - if (uname(&utsname) < 0) { - fprintf(stderr, "uname failed: %s\n", strerror(errno)); - return -1; - } - - p = utsname.release; - major = strtoul(p, &p, 10); - if (major == ULONG_MAX) { - fprintf(stderr, "strtoul failed: %s\n", strerror(errno)); - return -1; - } - - if (*p++ != '.') { - fprintf(stderr, "Unsupported utsname.release: %s\n", - utsname.release); - return -1; - } - - minor = strtoul(p, &p, 10); - if (major == ULONG_MAX) { - fprintf(stderr, "strtoul failed: %s\n", strerror(errno)); - return -1; - } - - if (*p++ != '.') { - fprintf(stderr, "Unsupported utsname.release: %s\n", - utsname.release); - return -1; - } - - patch = strtoul(p, &p, 10); - if (major == ULONG_MAX) { - fprintf(stderr, "strtoul failed: %s\n", strerror(errno)); - return -1; - } - - if (major >= 256 || minor >= 256 || patch >= 256) { - fprintf(stderr, "Unsupported utsname.release: %s\n", - utsname.release); - return -1; - } - - return KERNEL_VERSION(major, minor, patch); -} - #define PAGE_OFFSET_PRE_2_6_27 0xffff810000000000UL #define PAGE_OFFSET 0xffff880000000000UL |