tools: libxendevicemodel: Provide xendevicemodel_shutdown
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 15 Sep 2017 16:21:14 +0000 (17:21 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Wed, 11 Oct 2017 11:51:22 +0000 (12:51 +0100)
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/libs/devicemodel/Makefile
tools/libs/devicemodel/core.c
tools/libs/devicemodel/include/xendevicemodel.h
tools/libs/devicemodel/libxendevicemodel.map

index f0e1e6cb488ec2f106c651121e90b6114223e98f..1d4e5849277f589dabe1aad1405bca31738fd5a7 100644 (file)
@@ -2,7 +2,7 @@ XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 1
-MINOR    = 0
+MINOR    = 1
 SHLIB_LDFLAGS += -Wl,--version-script=libxendevicemodel.map
 
 CFLAGS   += -Werror -Wmissing-prototypes
index 0f2c1a791f0ed0325384ff5aff31c0138947ae25..0094e93e9696f4731a4f6b4199990da0d07c2a69 100644 (file)
@@ -532,6 +532,22 @@ int xendevicemodel_inject_event(
     return xendevicemodel_op(dmod, domid, 1, &op, sizeof(op));
 }
 
+int xendevicemodel_shutdown(
+    xendevicemodel_handle *dmod, domid_t domid, unsigned int reason)
+{
+    struct xen_dm_op op;
+    struct xen_dm_op_remote_shutdown *data;
+
+    memset(&op, 0, sizeof(op));
+
+    op.op = XEN_DMOP_remote_shutdown;
+    data = &op.u.remote_shutdown;
+
+    data->reason = reason;
+
+    return xendevicemodel_op(dmod, domid, 1, &op, sizeof(op));
+}
+
 int xendevicemodel_restrict(xendevicemodel_handle *dmod, domid_t domid)
 {
     return osdep_xendevicemodel_restrict(dmod, domid);
index 13216db04adf9f16bf076d2cd5faa9fd21ade95f..dda0bc76958d86eaf57393ba3bb3fd66be25a9b2 100644 (file)
@@ -316,6 +316,15 @@ int xendevicemodel_inject_event(
     xendevicemodel_handle *dmod, domid_t domid, int vcpu, uint8_t vector,
     uint8_t type, uint32_t error_code, uint8_t insn_len, uint64_t cr2);
 
+/**
+ * Shuts the domain down.
+ *
+ * @parm reason usually enum sched_shutdown_reason, see xen/sched.h
+ * @return 0 on success, -1 on failure.
+ */
+int xendevicemodel_shutdown(
+    xendevicemodel_handle *dmod, domid_t domid, unsigned int reason);
+
 /**
  * This function restricts the use of this handle to the specified
  * domain.
index 130222c3e4040a8aca04d1827c9ee38e143160aa..b0765fa33442fdd4c0e2476fb0c9e5c953ded55b 100644 (file)
@@ -1,4 +1,4 @@
-VERS_1.0 {
+VERS_1.1 {
        global:
                xendevicemodel_open;
                xendevicemodel_create_ioreq_server;
@@ -18,6 +18,7 @@ VERS_1.0 {
                xendevicemodel_modified_memory;
                xendevicemodel_set_mem_type;
                xendevicemodel_inject_event;
+               xendevicemodel_shutdown;
                xendevicemodel_restrict;
                xendevicemodel_close;
        local: *; /* Do not expose anything by default */