Re: [Xen-devel] [PATCH 02/22] tools: libxendevicemodel: Provide xendevicemodel_shutdown

2017-09-18 Thread Ian Jackson
Wei Liu writes ("Re: [PATCH 02/22] tools: libxendevicemodel: Provide 
xendevicemodel_shutdown"):
> We need to have:
> 
> VERS_1.1 {
...
> And also bump the minor number in Makefile.

Done, thanks.

Ian.

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH 02/22] tools: libxendevicemodel: Provide xendevicemodel_shutdown

2017-09-18 Thread Wei Liu
On Fri, Sep 15, 2017 at 07:48:39PM +0100, Ian Jackson wrote:
> diff --git a/tools/libs/devicemodel/libxendevicemodel.map 
> b/tools/libs/devicemodel/libxendevicemodel.map
> index 130222c..fd57e79 100644
> --- a/tools/libs/devicemodel/libxendevicemodel.map
> +++ b/tools/libs/devicemodel/libxendevicemodel.map
> @@ -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 */

We need to have:

VERS_1.1 {
   global:
xendevicemodel_shutdown;
} VERS_1.0;

And also bump the minor number in Makefile.

The code looks fine to me.

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH 02/22] tools: libxendevicemodel: Provide xendevicemodel_shutdown

2017-09-15 Thread Ian Jackson
Signed-off-by: Ian Jackson 
---
 tools/libs/devicemodel/core.c   | 16 
 tools/libs/devicemodel/include/xendevicemodel.h |  9 +
 tools/libs/devicemodel/libxendevicemodel.map|  1 +
 3 files changed, 26 insertions(+)

diff --git a/tools/libs/devicemodel/core.c b/tools/libs/devicemodel/core.c
index d7c6476..2093884 100644
--- a/tools/libs/devicemodel/core.c
+++ b/tools/libs/devicemodel/core.c
@@ -532,6 +532,22 @@ int xendevicemodel_inject_event(
 return xendevicemodel_op(dmod, domid, 1, , 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(, 0, sizeof(op));
+
+op.op = XEN_DMOP_remote_shutdown;
+data = _shutdown;
+
+data->reason = reason;
+
+return xendevicemodel_op(dmod, domid, 1, , sizeof(op));
+}
+
 int xendevicemodel_restrict(xendevicemodel_handle *dmod, domid_t domid)
 {
 return osdep_xendevicemodel_restrict(dmod, domid);
diff --git a/tools/libs/devicemodel/include/xendevicemodel.h 
b/tools/libs/devicemodel/include/xendevicemodel.h
index 580fad2..6ce39d1 100644
--- a/tools/libs/devicemodel/include/xendevicemodel.h
+++ b/tools/libs/devicemodel/include/xendevicemodel.h
@@ -317,6 +317,15 @@ int xendevicemodel_inject_event(
 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.
  *
diff --git a/tools/libs/devicemodel/libxendevicemodel.map 
b/tools/libs/devicemodel/libxendevicemodel.map
index 130222c..fd57e79 100644
--- a/tools/libs/devicemodel/libxendevicemodel.map
+++ b/tools/libs/devicemodel/libxendevicemodel.map
@@ -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 */
-- 
2.1.4


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel