]> xenbits.xensource.com Git - xenclient/toolstack.git/commitdiff
pass the capabilities in physinfo
authorVincent Hanquez <vincent.hanquez@eu.citrix.com>
Fri, 26 Jun 2009 09:57:59 +0000 (10:57 +0100)
committerVincent Hanquez <vincent.hanquez@eu.citrix.com>
Fri, 26 Jun 2009 09:57:59 +0000 (10:57 +0100)
libs/xc/xc.ml
libs/xc/xc.mli
libs/xc/xc_stubs.c

index 4d93d29e7090d3ca505d44a3e8ce282184fdbce8..36a6efc46e763066996d75ae08cbbd4b816d1564 100644 (file)
@@ -54,6 +54,10 @@ type sched_control =
        cap    : int;
 }
 
+type physinfo_cap_flag =
+       | CAP_HVM
+       | CAP_DirectIO
+
 type physinfo =
 {
        nr_cpus          : int;
@@ -66,6 +70,7 @@ type physinfo =
        free_pages       : nativeint;
        scrub_pages      : nativeint;
        (* XXX hw_cap *)
+       capabilities     : physinfo_cap_flag list;
 }
 
 type version =
index cbb3c839b8016bcf50b181dd4687b604f48ed6fb..e6ee2d1e54ed3e05dde3d8a45d5cc6765bc119d5 100644 (file)
@@ -41,6 +41,7 @@ type domaininfo = {
   handle : int array;
 }
 type sched_control = { weight : int; cap : int; }
+type physinfo_cap_flag = CAP_HVM | CAP_DirectIO
 type physinfo = {
   nr_cpus : int;
   threads_per_core : int;
@@ -51,6 +52,7 @@ type physinfo = {
   total_pages : nativeint;
   free_pages : nativeint;
   scrub_pages : nativeint;
+  capabilities : physinfo_cap_flag list;
 }
 type version = { major : int; minor : int; extra : string; }
 type compile_info = {
index f86ac7deda25e6f1bdc9323b0b93b08efa8ef4ff..7ff73f2c483c205c53a99c33f7c10a6b411ef378 100644 (file)
@@ -513,7 +513,7 @@ CAMLprim value stub_xc_send_debug_keys(value xc_handle, value keys)
 CAMLprim value stub_xc_physinfo(value xc_handle)
 {
        CAMLparam1(xc_handle);
-       CAMLlocal1(physinfo);
+       CAMLlocal3(physinfo, cap_list, tmp);
        xc_physinfo_t c_physinfo;
        int r;
 
@@ -524,7 +524,17 @@ CAMLprim value stub_xc_physinfo(value xc_handle)
        if (r)
                failwith_xc();
 
-       physinfo = caml_alloc_tuple(9);
+       tmp = cap_list = Val_emptylist;
+       for (r = 0; r < 2; r++) {
+               if ((c_physinfo.capabilities >> r) & 1) {
+                       tmp = caml_alloc_small(2, Tag_cons);
+                       Field(tmp, 0) = Val_int(r);
+                       Field(tmp, 1) = cap_list;
+                       cap_list = tmp;
+               }
+       }
+
+       physinfo = caml_alloc_tuple(10);
        Store_field(physinfo, 0, Val_int(COMPAT_FIELD_physinfo_get_nr_cpus(c_physinfo)));
        Store_field(physinfo, 1, Val_int(c_physinfo.threads_per_core));
        Store_field(physinfo, 2, Val_int(c_physinfo.cores_per_socket));
@@ -534,6 +544,7 @@ CAMLprim value stub_xc_physinfo(value xc_handle)
        Store_field(physinfo, 6, caml_copy_nativeint(c_physinfo.total_pages));
        Store_field(physinfo, 7, caml_copy_nativeint(c_physinfo.free_pages));
        Store_field(physinfo, 8, caml_copy_nativeint(c_physinfo.scrub_pages));
+       Store_field(physinfo, 9, cap_list);
 
        CAMLreturn(physinfo);
 }