[PATCH] Kdump: Export crash notes section address through sysfs
authorVivek Goyal <vgoyal@in.ibm.com>
Sat, 25 Jun 2005 21:58:12 +0000 (14:58 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sat, 25 Jun 2005 23:24:51 +0000 (16:24 -0700)
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 <maneesh@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/i386/kernel/crash.c
arch/x86_64/kernel/crash.c
include/asm-i386/kexec.h
include/asm-x86_64/kexec.h
kernel/ksysfs.c

index 59b92d217464753be8a8366996e22d9b78992ad6..3645ad7ac20056bfda2b801f4549366e6df33ee7 100644 (file)
@@ -26,8 +26,6 @@
 #include <asm/apic.h>
 #include <mach_ipi.h>
 
-#define MAX_NOTE_BYTES 1024
-typedef u32 note_buf_t[MAX_NOTE_BYTES/4];
 
 note_buf_t crash_notes[NR_CPUS];
 
index 7caf8a49d0cb490e5bd043dee378be9f894efa51..6183bcb852579ff615488e7a851dea429b670f0c 100644 (file)
@@ -20,9 +20,6 @@
 #include <asm/nmi.h>
 #include <asm/hw_irq.h>
 
-#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)
index a1599b55d62de63d037e492a8d32e2ccfe147ea6..6ed2a03e37b3495785179e224aac0f68dbd8b0ad 100644 (file)
@@ -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 */
index dc33646dc7ddb90cd82340a568a1a173f290ba4e..42d2ff15c592d41ab6058d5d543f008f1179a220 100644 (file)
@@ -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 */
index 1f064a63f8cfe7b7f575b82c38315bf5e79f2344..015fb69ad94da0724fcd7806aecf29405fbc7949 100644 (file)
@@ -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 <asm/kexec.h>
+
+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
 };