libxl: Remove xen/sched.h from public interface
authorIan Campbell <ian.campbell@citrix.com>
Thu, 1 Mar 2012 12:26:13 +0000 (12:26 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 1 Mar 2012 12:26:13 +0000 (12:26 +0000)
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxl/libxl.h
tools/libxl/libxl_types.idl
tools/libxl/libxl_utils.c
tools/libxl/xl_cmdimpl.c
tools/python/xen/lowlevel/xl/xl.c

index d1110f4a235fc50065e33823751f6f85118ff88b..f44f1de9b41c34d9f281398eb0ec4c8eb5fcfdfc 100644 (file)
 
 #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 *ctx, uint32_t poolid, int cpu);
 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);
index 567e48d43788543de17c94a9e06606b21c2545a2..7f656ab926a379f65ea903af6bc8421c376fcfa6 100644 (file)
@@ -113,6 +113,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
 #
@@ -156,11 +165,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),
index 227364cffecf35ab16a6baa27137cdb4c2665cf9..a5b3c17f5507e0de201dcfcab2bd3aedf7d2528b 100644 (file)
@@ -507,6 +507,13 @@ void libxl_cputopology_list_free(libxl_cputopology *list, int nr)
     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
index b8b7b5452c795a0c3d9a3d90e900924a0ecce10e..9bcc7fe24f3de22d3dc004fd05cf51241620f049 100644 (file)
@@ -1235,19 +1235,19 @@ static int handle_domain_death(libxl_ctx *ctx, uint32_t domid,
     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:
index 625891a6bc3c7b421376efaba4102140d63c5e98..48a828645a5518cf8018a0892665f9f120e1e156 100644 (file)
@@ -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);
 }