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

[Xen-changelog] [xen master] libxl: ocaml: add dominfo_list and dominfo_get



commit 5711ae6181cfb74c6e8da8541653d9c751e68b13
Author:     Rob Hoes <rob.hoes@xxxxxxxxxx>
AuthorDate: Wed Nov 6 17:49:54 2013 +0000
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Mon Nov 11 15:39:39 2013 +0000

    libxl: ocaml: add dominfo_list and dominfo_get
    
    Signed-off-by: Rob Hoes <rob.hoes@xxxxxxxxxx>
    Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
    Acked-by: David Scott <dave.scott@xxxxxxxxxxxxx>
---
 tools/ocaml/libs/xl/genwrap.py       |    3 ++
 tools/ocaml/libs/xl/xenlight_stubs.c |   41 ++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/tools/ocaml/libs/xl/genwrap.py b/tools/ocaml/libs/xl/genwrap.py
index 3d939d6..7a22b20 100644
--- a/tools/ocaml/libs/xl/genwrap.py
+++ b/tools/ocaml/libs/xl/genwrap.py
@@ -33,6 +33,9 @@ functions = { # ( name , [type1,type2,....] )
     "device_disk":    DEVICE_FUNCTIONS,
     "device_nic":     DEVICE_FUNCTIONS,
     "device_pci":     DEVICE_FUNCTIONS,
+    "dominfo":        [ ("list",           ["ctx", "t list"]),
+                        ("get",            ["ctx", "domid", "t"]),
+                      ],
     "physinfo":       [ ("get",            ["ctx", "t"]),
                       ],
     "cputopology":    [ ("get",            ["ctx", "t array"]),
diff --git a/tools/ocaml/libs/xl/xenlight_stubs.c 
b/tools/ocaml/libs/xl/xenlight_stubs.c
index 372ce8f..a6b4294 100644
--- a/tools/ocaml/libs/xl/xenlight_stubs.c
+++ b/tools/ocaml/libs/xl/xenlight_stubs.c
@@ -450,6 +450,47 @@ value stub_xl_cputopology_get(value ctx)
        CAMLreturn(topology);
 }
 
+value stub_xl_dominfo_list(value ctx)
+{
+       CAMLparam1(ctx);
+       CAMLlocal2(domlist, temp);
+       libxl_dominfo *c_domlist;
+       int i, nb;
+
+       c_domlist = libxl_list_domain(CTX, &nb);
+       if (!c_domlist)
+               failwith_xl(ERROR_FAIL, "dominfo_list");
+
+       domlist = temp = Val_emptylist;
+       for (i = nb - 1; i >= 0; i--) {
+               domlist = caml_alloc_small(2, Tag_cons);
+               Field(domlist, 0) = Val_int(0);
+               Field(domlist, 1) = temp;
+               temp = domlist;
+
+               Store_field(domlist, 0, Val_dominfo(&c_domlist[i]));
+       }
+
+       libxl_dominfo_list_free(c_domlist, nb);
+
+       CAMLreturn(domlist);
+}
+
+value stub_xl_dominfo_get(value ctx, value domid)
+{
+       CAMLparam2(ctx, domid);
+       CAMLlocal1(dominfo);
+       libxl_dominfo c_dominfo;
+       int ret;
+
+       ret = libxl_domain_info(CTX, &c_dominfo, Int_val(domid));
+       if (ret != 0)
+               failwith_xl(ERROR_FAIL, "domain_info");
+       dominfo = Val_dominfo(&c_dominfo);
+
+       CAMLreturn(dominfo);
+}
+
 value stub_xl_domain_sched_params_get(value ctx, value domid)
 {
        CAMLparam2(ctx, domid);
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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