summaryrefslogtreecommitdiff
path: root/kexec/crashdump.c
diff options
context:
space:
mode:
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);
+}