summaryrefslogtreecommitdiff
path: root/kexec/crashdump.c
diff options
context:
space:
mode:
authorItsuro ODA <oda@valinux.co.jp>2008-03-31 13:26:04 +0900
committerSimon Horman <horms@verge.net.au>2008-04-02 16:34:15 +0900
commit1e1ee02f95e69890fb98d71cb512261ac9283623 (patch)
tree6fffe3dc10daa44ef08ef8224d884645ec010c8b /kexec/crashdump.c
parent9e959db12a671a71934a765d15aaf082f0a4f886 (diff)
extract vmcoreinfo from /proc/vmcore for Xen
This patch is for kexec-tools-testing-20080324. Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec/crashdump.c')
-rw-r--r--kexec/crashdump.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/kexec/crashdump.c b/kexec/crashdump.c
index b014dcd..e0ba36d 100644
--- a/kexec/crashdump.c
+++ b/kexec/crashdump.c
@@ -110,10 +110,8 @@ int get_crash_notes_per_cpu(int cpu, uint64_t *addr, uint64_t *len)
return 0;
}
-/* Returns the physical address of start of crash notes buffer for a kernel. */
-int get_kernel_vmcoreinfo(uint64_t *addr, uint64_t *len)
+static int get_vmcoreinfo(char *kdump_info, uint64_t *addr, uint64_t *len)
{
- char kdump_info[PATH_MAX];
char line[MAX_LINE];
int count;
FILE *fp;
@@ -122,9 +120,8 @@ int get_kernel_vmcoreinfo(uint64_t *addr, uint64_t *len)
*addr = 0;
*len = 0;
- sprintf(kdump_info, "/sys/kernel/vmcoreinfo");
if (!(fp = fopen(kdump_info, "r")))
- return 0;
+ return -1;
if (!fgets(line, sizeof(line), fp))
die("Cannot parse %s: %s\n", kdump_info, strerror(errno));
@@ -137,3 +134,14 @@ int get_kernel_vmcoreinfo(uint64_t *addr, uint64_t *len)
return 0;
}
+
+/* Returns the physical address of start of crash notes buffer for a kernel. */
+int get_kernel_vmcoreinfo(uint64_t *addr, uint64_t *len)
+{
+ return get_vmcoreinfo("/sys/kernel/vmcoreinfo", addr, len);
+}
+
+int get_xen_vmcoreinfo(uint64_t *addr, uint64_t *len)
+{
+ return get_vmcoreinfo("/sys/hypervisor/vmcoreinfo", addr, len);
+}