[PATCH 3/4] kexec/xen: switch to use xc_kexec_get_range for get_xen_vmcoreinfo.

David Vrabel david.vrabel at citrix.com
Wed Nov 6 09:55:21 EST 2013


From: Don Slutz <Don at CloudSwitch.com>

Signed-off-by: Don Slutz <Don at CloudSwitch.com>
Signed-off-by: David Vrabel <david.vrabel at citrix.com>
Reviewed-by: Daniel Kiper <daniel.kiper at oracle.com>
---
 kexec/crashdump-xen.c |   25 +++++++++++++++++++++++++
 kexec/crashdump.c     |    5 -----
 2 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/kexec/crashdump-xen.c b/kexec/crashdump-xen.c
index 8185423..79b68e0 100644
--- a/kexec/crashdump-xen.c
+++ b/kexec/crashdump-xen.c
@@ -164,6 +164,26 @@ unsigned long xen_architecture(struct crash_elf_info *elf_info)
 }
 
 #ifdef HAVE_LIBXENCTRL
+int get_xen_vmcoreinfo(uint64_t *addr, uint64_t *len)
+{
+	xc_interface *xc;
+	int ret = 0;
+
+	xc = xc_interface_open(NULL, NULL, 0);
+	if (!xc) {
+	        fprintf(stderr, "failed to open xen control interface.\n");
+	        return -1;
+	}
+
+	ret = xc_kexec_get_range(xc, KEXEC_RANGE_MA_VMCOREINFO, 0, len, addr);
+
+	xc_interface_close(xc);
+
+	if (ret < 0)
+	        return -1;
+	return 0;
+}
+
 int xen_get_nr_phys_cpus(void)
 {
 	xc_interface *xc;
@@ -206,6 +226,11 @@ out:
 	return cpu;
 }
 #else
+int get_xen_vmcoreinfo(uint64_t *addr, uint64_t *len)
+{
+	return -1;
+}
+
 int xen_get_nr_phys_cpus(void)
 {
 	return -1;
diff --git a/kexec/crashdump.c b/kexec/crashdump.c
index 8d88fdf..131e624 100644
--- a/kexec/crashdump.c
+++ b/kexec/crashdump.c
@@ -157,8 +157,3 @@ 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);
-}
-- 
1.7.2.5




More information about the kexec mailing list