aboutsummaryrefslogtreecommitdiffstats
path: root/tools/ocaml
diff options
context:
space:
mode:
authorMatthew Fioravante <matthew.fioravante@jhuapl.edu>2012-10-26 16:42:57 +0100
committerMatthew Fioravante <matthew.fioravante@jhuapl.edu>2012-10-26 16:42:57 +0100
commitd43861bd94c71acfb2a81980a840c752cc3feb89 (patch)
treec79c6b39ea04834cfc8b876b6911be5d7b30c608 /tools/ocaml
parent8159a4585a0b83e4b31e287b64d5c23f61a94cc3 (diff)
downloadxen-d43861bd94c71acfb2a81980a840c752cc3feb89.tar.gz
xen-d43861bd94c71acfb2a81980a840c752cc3feb89.tar.bz2
xen-d43861bd94c71acfb2a81980a840c752cc3feb89.zip
libxl: make devid a type so it is initialized properly
Previously device ids in libxl were treated as integers meaning they were being initialized to 0, which is a valid device id. This patch makes devid its own type in libxl and initializes it to -1, an invalid value. This fixes a bug where if you try to do a xl DEV-attach multiple time it will continuously try to reattach device 0 instead of generating a new device id. Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu> Reviewed-by: George Dunlap <george.dunlap@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com> xen-unstable changeset: 25988:8a073eb1e849 Backport-requested-by: Ian Campbell <Ian.Campbell@citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/ocaml')
-rw-r--r--tools/ocaml/libs/xl/genwrap.py5
-rw-r--r--tools/ocaml/libs/xl/xenlight.ml.in1
-rw-r--r--tools/ocaml/libs/xl/xenlight.mli.in1
3 files changed, 5 insertions, 2 deletions
diff --git a/tools/ocaml/libs/xl/genwrap.py b/tools/ocaml/libs/xl/genwrap.py
index 42f374eaee..97d088ddf8 100644
--- a/tools/ocaml/libs/xl/genwrap.py
+++ b/tools/ocaml/libs/xl/genwrap.py
@@ -10,6 +10,7 @@ builtins = {
"int": ("int", "%(c)s = Int_val(%(o)s)", "Val_int(%(c)s)" ),
"char *": ("string", "%(c)s = dup_String_val(gc, %(o)s)", "caml_copy_string(%(c)s)"),
"libxl_domid": ("domid", "%(c)s = Int_val(%(o)s)", "Val_int(%(c)s)" ),
+ "libxl_devid": ("devid", "%(c)s = Int_val(%(o)s)", "Val_int(%(c)s)" ),
"libxl_defbool": ("bool option", "%(c)s = Defbool_val(%(o)s)", "Val_defbool(%(c)s)" ),
"libxl_uuid": ("int array", "Uuid_val(gc, lg, &%(c)s, %(o)s)", "Val_uuid(&%(c)s)"),
"libxl_key_value_list": ("(string * string) list", None, None),
@@ -41,8 +42,8 @@ def stub_fn_name(ty, name):
return "stub_xl_%s_%s" % (ty.rawname,name)
def ocaml_type_of(ty):
- if ty.rawname == "domid":
- return "domid"
+ if ty.rawname in ["domid","devid"]:
+ return ty.rawname
elif isinstance(ty,idl.UInt):
if ty.width in [8, 16]:
# handle as ints
diff --git a/tools/ocaml/libs/xl/xenlight.ml.in b/tools/ocaml/libs/xl/xenlight.ml.in
index c47623c3fc..dcc1a38bb7 100644
--- a/tools/ocaml/libs/xl/xenlight.ml.in
+++ b/tools/ocaml/libs/xl/xenlight.ml.in
@@ -16,6 +16,7 @@
exception Error of string
type domid = int
+type devid = int
(* @@LIBXL_TYPES@@ *)
diff --git a/tools/ocaml/libs/xl/xenlight.mli.in b/tools/ocaml/libs/xl/xenlight.mli.in
index 4717bac3f7..3fd0165796 100644
--- a/tools/ocaml/libs/xl/xenlight.mli.in
+++ b/tools/ocaml/libs/xl/xenlight.mli.in
@@ -16,6 +16,7 @@
exception Error of string
type domid = int
+type devid = int
(* @@LIBXL_TYPES@@ *)