summaryrefslogtreecommitdiff
path: root/kexec/kexec-xen.c
diff options
context:
space:
mode:
authorEric DeVolder <eric.devolder@oracle.com>2017-01-25 09:31:15 -0600
committerSimon Horman <horms@verge.net.au>2017-01-26 11:22:26 +0100
commit2cf7cb9a60802cfdbd4ec51439b05b5ac6293ee6 (patch)
tree0f2b240544b8050bd2310cf1231d1ac30ffe2ee2 /kexec/kexec-xen.c
parent4eaa36cd01a972a602065ebade5ac46d1c81fba9 (diff)
kexec: implemented XEN KEXEC STATUS to determine if an image is loaded
Instead of the scripts having to poke at various fields we can provide that functionality via the -S parameter. kexec_loaded/kexec_crash_loaded exposes Linux kernel kexec/crash state. It does not say anything about Xen kexec/crash state. So, we need a special approach to get the latter. Though for compatibility we provide similar functionality in kexec-tools for the former. This change enables the --status or -S option to work either with or without Xen. Returns 0 if the payload is loaded. Can be used in combination with -l or -p to get the state of the proper kexec image. Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Eric DeVolder <eric.devolder@oracle.com> Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec/kexec-xen.c')
-rw-r--r--kexec/kexec-xen.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/kexec/kexec-xen.c b/kexec/kexec-xen.c
index 24a4191..2b448d3 100644
--- a/kexec/kexec-xen.c
+++ b/kexec/kexec-xen.c
@@ -105,6 +105,27 @@ int xen_kexec_unload(uint64_t kexec_flags)
return ret;
}
+int xen_kexec_status(uint64_t kexec_flags)
+{
+ xc_interface *xch;
+ uint8_t type;
+ int ret = -1;
+
+#ifdef HAVE_KEXEC_CMD_STATUS
+ xch = xc_interface_open(NULL, NULL, 0);
+ if (!xch)
+ return -1;
+
+ type = (kexec_flags & KEXEC_ON_CRASH) ? KEXEC_TYPE_CRASH : KEXEC_TYPE_DEFAULT;
+
+ ret = xc_kexec_status(xch, type);
+
+ xc_interface_close(xch);
+#endif
+
+ return ret;
+}
+
void xen_kexec_exec(void)
{
xc_interface *xch;
@@ -130,6 +151,11 @@ int xen_kexec_unload(uint64_t kexec_flags)
return -1;
}
+int xen_kexec_status(uint64_t kexec_flags)
+{
+ return -1;
+}
+
void xen_kexec_exec(void)
{
}