summaryrefslogtreecommitdiffstats
path: root/kexec/crashdump-xen.c
diff options
context:
space:
mode:
Diffstat (limited to 'kexec/crashdump-xen.c')
-rw-r--r--kexec/crashdump-xen.c38
1 files changed, 5 insertions, 33 deletions
diff --git a/kexec/crashdump-xen.c b/kexec/crashdump-xen.c
index 2d6b2f9d..3f59a0dc 100644
--- a/kexec/crashdump-xen.c
+++ b/kexec/crashdump-xen.c
@@ -162,21 +162,15 @@ 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;
+ uint64_t end;
int ret = 0;
- xc = xc_interface_open(NULL, NULL, 0);
- if (!xc) {
- fprintf(stderr, "failed to open xen control interface.\n");
+ ret = xen_get_kexec_range(KEXEC_RANGE_MA_VMCOREINFO, addr, &end);
+ if (ret < 0)
return -1;
- }
-
- ret = xc_kexec_get_range(xc, KEXEC_RANGE_MA_VMCOREINFO, 0, len, addr);
- xc_interface_close(xc);
+ *len = end - *addr + 1;
- if (ret < 0)
- return -1;
return 0;
}
@@ -252,29 +246,7 @@ int xen_get_note(int cpu, uint64_t *addr, uint64_t *len)
#ifdef HAVE_LIBXENCTRL
int xen_get_crashkernel_region(uint64_t *start, uint64_t *end)
{
- uint64_t size;
- xc_interface *xc;
- int rc = -1;
-
- xc = xc_interface_open(NULL, NULL, 0);
- if (!xc) {
- fprintf(stderr, "failed to open xen control interface.\n");
- goto out;
- }
-
- rc = xc_kexec_get_range(xc, KEXEC_RANGE_MA_CRASH, 0, &size, start);
- if (rc < 0) {
- fprintf(stderr, "failed to get crash region from hypervisor.\n");
- goto out_close;
- }
-
- *end = *start + size - 1;
-
-out_close:
- xc_interface_close(xc);
-
-out:
- return rc;
+ return xen_get_kexec_range(KEXEC_RANGE_MA_CRASH, start, end);
}
#else
int xen_get_crashkernel_region(uint64_t *start, uint64_t *end)