From: Vivek Goyal Date: Sat, 25 Jun 2005 21:58:12 +0000 (-0700) Subject: [PATCH] Kdump: Export crash notes section address through sysfs X-Git-Tag: v2.6.13-rc1~68^2~102 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=625f1c8219d95300ed32e4c67eb62a50ded095ba;p=linux-2.6 [PATCH] Kdump: Export crash notes section address through sysfs o Following patch exports kexec global variable "crash_notes" to user space through sysfs as kernel attribute in /sys/kernel. Signed-off-by: Maneesh Soni Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/arch/i386/kernel/crash.c b/arch/i386/kernel/crash.c index 59b92d2174..3645ad7ac2 100644 --- a/arch/i386/kernel/crash.c +++ b/arch/i386/kernel/crash.c @@ -26,8 +26,6 @@ #include #include -#define MAX_NOTE_BYTES 1024 -typedef u32 note_buf_t[MAX_NOTE_BYTES/4]; note_buf_t crash_notes[NR_CPUS]; diff --git a/arch/x86_64/kernel/crash.c b/arch/x86_64/kernel/crash.c index 7caf8a49d0..6183bcb852 100644 --- a/arch/x86_64/kernel/crash.c +++ b/arch/x86_64/kernel/crash.c @@ -20,9 +20,6 @@ #include #include -#define MAX_NOTE_BYTES 1024 -typedef u32 note_buf_t[MAX_NOTE_BYTES/4]; - note_buf_t crash_notes[NR_CPUS]; void machine_crash_shutdown(void) diff --git a/include/asm-i386/kexec.h b/include/asm-i386/kexec.h index a1599b55d6..6ed2a03e37 100644 --- a/include/asm-i386/kexec.h +++ b/include/asm-i386/kexec.h @@ -25,4 +25,9 @@ /* The native architecture */ #define KEXEC_ARCH KEXEC_ARCH_386 +#define MAX_NOTE_BYTES 1024 +typedef u32 note_buf_t[MAX_NOTE_BYTES/4]; + +extern note_buf_t crash_notes[]; + #endif /* _I386_KEXEC_H */ diff --git a/include/asm-x86_64/kexec.h b/include/asm-x86_64/kexec.h index dc33646dc7..42d2ff15c5 100644 --- a/include/asm-x86_64/kexec.h +++ b/include/asm-x86_64/kexec.h @@ -25,4 +25,9 @@ /* The native architecture */ #define KEXEC_ARCH KEXEC_ARCH_X86_64 +#define MAX_NOTE_BYTES 1024 +typedef u32 note_buf_t[MAX_NOTE_BYTES/4]; + +extern note_buf_t crash_notes[]; + #endif /* _X86_64_KEXEC_H */ diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c index 1f064a63f8..015fb69ad9 100644 --- a/kernel/ksysfs.c +++ b/kernel/ksysfs.c @@ -30,12 +30,25 @@ static ssize_t hotplug_seqnum_show(struct subsystem *subsys, char *page) KERNEL_ATTR_RO(hotplug_seqnum); #endif +#ifdef CONFIG_KEXEC +#include + +static ssize_t crash_notes_show(struct subsystem *subsys, char *page) +{ + return sprintf(page, "%p\n", (void *)crash_notes); +} +KERNEL_ATTR_RO(crash_notes); +#endif + decl_subsys(kernel, NULL, NULL); EXPORT_SYMBOL_GPL(kernel_subsys); static struct attribute * kernel_attrs[] = { #ifdef CONFIG_HOTPLUG &hotplug_seqnum_attr.attr, +#endif +#ifdef CONFIG_KEXEC + &crash_notes_attr.attr, #endif NULL };