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

[Xen-devel] [PATCH v3-RESEND 09/28] libxl: make the libxl error type an IDL enum



This makes it easier to use in language bindings.

Signed-off-by: Rob Hoes <rob.hoes@xxxxxxxxxx>

---
New in v3:
* New patch to simplify the (following) exception handling patch.
---
 tools/libxl/libxl.h         |   18 ------------------
 tools/libxl/libxl_device.c  |    6 +++---
 tools/libxl/libxl_types.idl |   17 +++++++++++++++++
 3 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index 1c6675d..9379694 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -459,24 +459,6 @@ typedef struct libxl__ctx libxl_ctx;
 
 const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx);
 
-enum {
-    ERROR_NONSPECIFIC = -1,
-    ERROR_VERSION = -2,
-    ERROR_FAIL = -3,
-    ERROR_NI = -4,
-    ERROR_NOMEM = -5,
-    ERROR_INVAL = -6,
-    ERROR_BADFAIL = -7,
-    ERROR_GUEST_TIMEDOUT = -8,
-    ERROR_TIMEDOUT = -9,
-    ERROR_NOPARAVIRT = -10,
-    ERROR_NOT_READY = -11,
-    ERROR_OSEVENT_REG_FAIL = -12,
-    ERROR_BUFFERFULL = -13,
-    ERROR_UNKNOWN_CHILD = -14,
-};
-
-
 /*
  * Some libxl operations can take a long time.  These functions take a
  * parameter to control their concurrency:
diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
index 16a92a4..11c53cf 100644
--- a/tools/libxl/libxl_device.c
+++ b/tools/libxl/libxl_device.c
@@ -497,7 +497,7 @@ static void multidev_one_callback(libxl__egc *egc, 
libxl__ao_device *aodev)
 {
     STATE_AO_GC(aodev->ao);
     libxl__multidev *multidev = aodev->multidev;
-    int i, error = 0;
+    int i, err = 0;
 
     aodev->active = 0;
 
@@ -506,10 +506,10 @@ static void multidev_one_callback(libxl__egc *egc, 
libxl__ao_device *aodev)
             return;
 
         if (multidev->array[i]->rc)
-            error = multidev->array[i]->rc;
+            err = multidev->array[i]->rc;
     }
 
-    multidev->callback(egc, multidev, error);
+    multidev->callback(egc, multidev, err);
     return;
 }
 
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index 5c43d6f..778a416 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -28,6 +28,23 @@ MemKB = UInt(64, init_val = "LIBXL_MEMKB_DEFAULT")
 # Constants / Enumerations
 #
 
+libxl_error = Enumeration("error", [
+    (-1, "NONSPECIFIC"),
+    (-2, "VERSION"),
+    (-3, "FAIL"),
+    (-4, "NI"),
+    (-5, "NOMEM"),
+    (-6, "INVAL"),
+    (-7, "BADFAIL"),
+    (-8, "GUEST_TIMEDOUT"),
+    (-9, "TIMEDOUT"),
+    (-10, "NOPARAVIRT"),
+    (-11, "NOT_READY"),
+    (-12, "OSEVENT_REG_FAIL"),
+    (-13, "BUFFERFULL"),
+    (-14, "UNKNOWN_CHILD"),
+    ], namespace = "")
+
 libxl_domain_type = Enumeration("domain_type", [
     (-1, "INVALID"),
     (1, "HVM"),
-- 
1.7.10.4


_______________________________________________
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®.