diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-10-31 12:13:10 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-10-31 12:13:10 -0400 |
commit | 7b3b6e42032e94a6132a85642e95106f5346650e (patch) | |
tree | 8b2262291341d8a9f9b1e7e3c63a3289bb6c6de6 /include/linux/crash_dump.h | |
parent | 04172c0b9ea5861e5cba7909da5297b3aedac9e1 (diff) | |
parent | 0173a3265b228da319ceb9c1ec6a5682fd1b2d92 (diff) |
Merge commit 'v2.6.28-rc2' into topic/asoc
Diffstat (limited to 'include/linux/crash_dump.h')
-rw-r--r-- | include/linux/crash_dump.h | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h index 025e4f575103..2dac064d8359 100644 --- a/include/linux/crash_dump.h +++ b/include/linux/crash_dump.h | |||
@@ -8,17 +8,12 @@ | |||
8 | #include <linux/proc_fs.h> | 8 | #include <linux/proc_fs.h> |
9 | 9 | ||
10 | #define ELFCORE_ADDR_MAX (-1ULL) | 10 | #define ELFCORE_ADDR_MAX (-1ULL) |
11 | #define ELFCORE_ADDR_ERR (-2ULL) | ||
11 | 12 | ||
12 | #ifdef CONFIG_PROC_VMCORE | ||
13 | extern unsigned long long elfcorehdr_addr; | 13 | extern unsigned long long elfcorehdr_addr; |
14 | #else | ||
15 | static const unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX; | ||
16 | #endif | ||
17 | 14 | ||
18 | extern ssize_t copy_oldmem_page(unsigned long, char *, size_t, | 15 | extern ssize_t copy_oldmem_page(unsigned long, char *, size_t, |
19 | unsigned long, int); | 16 | unsigned long, int); |
20 | extern const struct file_operations proc_vmcore_operations; | ||
21 | extern struct proc_dir_entry *proc_vmcore; | ||
22 | 17 | ||
23 | /* Architecture code defines this if there are other possible ELF | 18 | /* Architecture code defines this if there are other possible ELF |
24 | * machine types, e.g. on bi-arch capable hardware. */ | 19 | * machine types, e.g. on bi-arch capable hardware. */ |
@@ -28,10 +23,43 @@ extern struct proc_dir_entry *proc_vmcore; | |||
28 | 23 | ||
29 | #define vmcore_elf_check_arch(x) (elf_check_arch(x) || vmcore_elf_check_arch_cross(x)) | 24 | #define vmcore_elf_check_arch(x) (elf_check_arch(x) || vmcore_elf_check_arch_cross(x)) |
30 | 25 | ||
26 | /* | ||
27 | * is_kdump_kernel() checks whether this kernel is booting after a panic of | ||
28 | * previous kernel or not. This is determined by checking if previous kernel | ||
29 | * has passed the elf core header address on command line. | ||
30 | * | ||
31 | * This is not just a test if CONFIG_CRASH_DUMP is enabled or not. It will | ||
32 | * return 1 if CONFIG_CRASH_DUMP=y and if kernel is booting after a panic of | ||
33 | * previous kernel. | ||
34 | */ | ||
35 | |||
31 | static inline int is_kdump_kernel(void) | 36 | static inline int is_kdump_kernel(void) |
32 | { | 37 | { |
33 | return (elfcorehdr_addr != ELFCORE_ADDR_MAX) ? 1 : 0; | 38 | return (elfcorehdr_addr != ELFCORE_ADDR_MAX) ? 1 : 0; |
34 | } | 39 | } |
40 | |||
41 | /* is_vmcore_usable() checks if the kernel is booting after a panic and | ||
42 | * the vmcore region is usable. | ||
43 | * | ||
44 | * This makes use of the fact that due to alignment -2ULL is not | ||
45 | * a valid pointer, much in the vain of IS_ERR(), except | ||
46 | * dealing directly with an unsigned long long rather than a pointer. | ||
47 | */ | ||
48 | |||
49 | static inline int is_vmcore_usable(void) | ||
50 | { | ||
51 | return is_kdump_kernel() && elfcorehdr_addr != ELFCORE_ADDR_ERR ? 1 : 0; | ||
52 | } | ||
53 | |||
54 | /* vmcore_unusable() marks the vmcore as unusable, | ||
55 | * without disturbing the logic of is_kdump_kernel() | ||
56 | */ | ||
57 | |||
58 | static inline void vmcore_unusable(void) | ||
59 | { | ||
60 | if (is_kdump_kernel()) | ||
61 | elfcorehdr_addr = ELFCORE_ADDR_ERR; | ||
62 | } | ||
35 | #else /* !CONFIG_CRASH_DUMP */ | 63 | #else /* !CONFIG_CRASH_DUMP */ |
36 | static inline int is_kdump_kernel(void) { return 0; } | 64 | static inline int is_kdump_kernel(void) { return 0; } |
37 | #endif /* CONFIG_CRASH_DUMP */ | 65 | #endif /* CONFIG_CRASH_DUMP */ |