[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 02 of 26 V3] libxl: Remove xen/sched.h from public interface



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1330000276 0
# Node ID 67349816c1ccec5d2e665c1dde956d1d38b10f9f
# Parent  d3332d3bc6fbf50aa2054f2f458afa4cf1232377
libxl: Remove xen/sched.h from public interface

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r d3332d3bc6fb -r 67349816c1cc tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Thu Feb 23 12:31:15 2012 +0000
+++ b/tools/libxl/libxl.h       Thu Feb 23 12:31:16 2012 +0000
@@ -137,8 +137,6 @@
 
 #include <xentoollog.h>
 
-#include <xen/sched.h>
-
 #include <libxl_uuid.h>
 #include <_libxl_list.h>
 
@@ -638,12 +636,7 @@ int libxl_cpupool_cpuremove(libxl_ctx *c
 int libxl_cpupool_cpuremove_node(libxl_ctx *ctx, uint32_t poolid, int node, 
int *cpus);
 int libxl_cpupool_movedomain(libxl_ctx *ctx, uint32_t poolid, uint32_t domid);
 
-static inline int libxl_domid_valid_guest(uint32_t domid)
-{
-    /* returns 1 if the value _could_ be a valid guest domid, 0 otherwise
-     * does not check whether the domain actually exists */
-    return domid > 0 && domid < DOMID_FIRST_RESERVED;
-}
+int libxl_domid_valid_guest(uint32_t domid);
 
 int libxl_flask_context_to_sid(libxl_ctx *ctx, char *buf, size_t len,
                                uint32_t *ssidref);
diff -r d3332d3bc6fb -r 67349816c1cc tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl       Thu Feb 23 12:31:15 2012 +0000
+++ b/tools/libxl/libxl_types.idl       Thu Feb 23 12:31:16 2012 +0000
@@ -107,6 +107,15 @@ libxl_scheduler = Enumeration("scheduler
     (7, "arinc653"),
     ])
 
+# Consistent with SHUTDOWN_* in sched.h
+libxl_shutdown_reason = Enumeration("shutdown_reason", [
+    (0, "poweroff"),
+    (1, "reboot"),
+    (2, "suspend"),
+    (3, "crash"),
+    (4, "watchdog"),
+    ])
+
 #
 # Complex libxl types
 #
@@ -150,11 +159,11 @@ libxl_dominfo = Struct("dominfo",[
     ("shutdown",    bool),
     ("dying",       bool),
 
-    # Valid SHUTDOWN_* value from xen/sched.h iff (shutdown||dying).
+    # Valid iff (shutdown||dying).
     #
     # Otherwise set to a value guaranteed not to clash with any valid
-    # SHUTDOWN_* constant.
-    ("shutdown_reason", uint8),
+    # LIBXL_SHUTDOWN_REASON_* constant.
+    ("shutdown_reason", libxl_shutdown_reason),
     ("current_memkb",   uint64),
     ("shared_memkb", uint64),
     ("max_memkb",   uint64),
diff -r d3332d3bc6fb -r 67349816c1cc tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c Thu Feb 23 12:31:15 2012 +0000
+++ b/tools/libxl/libxl_utils.c Thu Feb 23 12:31:16 2012 +0000
@@ -507,6 +507,13 @@ void libxl_cputopology_list_free(libxl_c
     free(list);
 }
 
+int libxl_domid_valid_guest(uint32_t domid)
+{
+    /* returns 1 if the value _could_ be a valid guest domid, 0 otherwise
+     * does not check whether the domain actually exists */
+    return domid > 0 && domid < DOMID_FIRST_RESERVED;
+}
+
 /*
  * Local variables:
  * mode: C
diff -r d3332d3bc6fb -r 67349816c1cc tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Thu Feb 23 12:31:15 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Thu Feb 23 12:31:16 2012 +0000
@@ -1230,19 +1230,19 @@ static int handle_domain_death(libxl_ctx
     libxl_action_on_shutdown action;
 
     switch (event->u.domain_shutdown.shutdown_reason) {
-    case SHUTDOWN_poweroff:
+    case LIBXL_SHUTDOWN_REASON_POWEROFF:
         action = d_config->on_poweroff;
         break;
-    case SHUTDOWN_reboot:
+    case LIBXL_SHUTDOWN_REASON_REBOOT:
         action = d_config->on_reboot;
         break;
-    case SHUTDOWN_suspend:
+    case LIBXL_SHUTDOWN_REASON_SUSPEND:
         LOG("Domain has suspended.");
         return 0;
-    case SHUTDOWN_crash:
+    case LIBXL_SHUTDOWN_REASON_CRASH:
         action = d_config->on_crash;
         break;
-    case SHUTDOWN_watchdog:
+    case LIBXL_SHUTDOWN_REASON_WATCHDOG:
         action = d_config->on_watchdog;
         break;
     default:
diff -r d3332d3bc6fb -r 67349816c1cc tools/python/xen/lowlevel/xl/xl.c
--- a/tools/python/xen/lowlevel/xl/xl.c Thu Feb 23 12:31:15 2012 +0000
+++ b/tools/python/xen/lowlevel/xl/xl.c Thu Feb 23 12:31:16 2012 +0000
@@ -762,11 +762,11 @@ PyMODINIT_FUNC initxl(void)
     Py_INCREF(xl_error_obj);
     PyModule_AddObject(m, "Error", xl_error_obj);
 
-    _INT_CONST(m, SHUTDOWN_poweroff);
-    _INT_CONST(m, SHUTDOWN_reboot);
-    _INT_CONST(m, SHUTDOWN_suspend);
-    _INT_CONST(m, SHUTDOWN_crash);
-    _INT_CONST(m, SHUTDOWN_watchdog);
+    _INT_CONST_LIBXL(m, SHUTDOWN_REASON_POWEROFF);
+    _INT_CONST_LIBXL(m, SHUTDOWN_REASON_REBOOT);
+    _INT_CONST_LIBXL(m, SHUTDOWN_REASON_SUSPEND);
+    _INT_CONST_LIBXL(m, SHUTDOWN_REASON_CRASH);
+    _INT_CONST_LIBXL(m, SHUTDOWN_REASON_WATCHDOG);
 
     genwrap__init(m);
 }

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.