]> xenbits.xensource.com Git - people/liuw/xen.git/commitdiff
tools/ocaml: abi: Use formal conversion and check in more places
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 10 Sep 2019 11:17:30 +0000 (12:17 +0100)
committerIan Jackson <ian.jackson@eu.citrix.com>
Tue, 10 Sep 2019 13:44:33 +0000 (14:44 +0100)
Now we have a caller for ocaml_list_to_c_bitmap.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <Andrew.Cooper3@citrix.com>
Acked-by: Christian Lindig <christian.lindig@citrix.com>
tools/ocaml/libs/xc/xenctrl_stubs.c
xen/include/public/domctl.h

index 522c2c59dd613b23290f294f3d6c8d60e14bd1d0..f86ecc7b7ea67f74cbbfe0671823b38ed8385e59 100644 (file)
@@ -153,7 +153,6 @@ static value c_bitmap_to_ocaml_list
        CAMLreturn(list);
 }
 
-#if 0 /* unused, will be used in a moment */
 static unsigned int ocaml_list_to_c_bitmap(value l)
              /* ! */
              /*
@@ -168,7 +167,6 @@ static unsigned int ocaml_list_to_c_bitmap(value l)
 
        return val;
 }
-#endif
 
 CAMLprim value stub_xc_domain_create(value xch, value config)
 {
@@ -197,8 +195,10 @@ CAMLprim value stub_xc_domain_create(value xch, value config)
 
        domain_handle_of_uuid_string(cfg.handle, String_val(VAL_HANDLE));
 
-       for ( l = VAL_FLAGS; l != Val_none; l = Field(l, 1) )
-               cfg.flags |= 1u << Int_val(Field(l, 0));
+       cfg.flags = ocaml_list_to_c_bitmap
+               /* ! domain_create_flag CDF_ lc */
+               /* ! XEN_DOMCTL_CDF_ XEN_DOMCTL_CDF_MAX max */
+               (VAL_FLAGS);
 
        arch_domconfig = Field(VAL_ARCH, 0);
        switch ( Tag_val(VAL_ARCH) )
@@ -213,8 +213,10 @@ CAMLprim value stub_xc_domain_create(value xch, value config)
         /* Mnemonics for the named fields inside xen_x86_arch_domainconfig */
 #define VAL_EMUL_FLAGS          Field(arch_domconfig, 0)
 
-               for ( l = VAL_EMUL_FLAGS; l != Val_none; l = Field(l, 1) )
-                       cfg.arch.emulation_flags |= 1u << Int_val(Field(l, 0));
+               cfg.arch.emulation_flags = ocaml_list_to_c_bitmap
+                       /* ! x86_arch_emulation_flags X86_EMU_ none */
+                       /* ! XEN_X86_EMU_ XEN_X86_EMU_ALL all */
+                       (VAL_EMUL_FLAGS);
 
 #undef VAL_EMUL_FLAGS
 
@@ -370,8 +372,7 @@ static value alloc_domaininfo(xc_domaininfo_t * info)
         * emulation_flags: x86_arch_emulation_flags list;
         */
        emul_list = c_bitmap_to_ocaml_list
-               /* ! x86_arch_emulation_flags X86_EMU_ none */
-               /* ! XEN_X86_EMU_ XEN_X86_EMU_ALL all */
+               /* ! x86_arch_emulation_flags */
                (info->arch_config.emulation_flags);
 
        /* xen_x86_arch_domainconfig */
index ff9265f765d57b8056913cb2a3552400b366fabf..77f546cbb8b4cf2de3d3985fb86d57eed26ea047 100644 (file)
@@ -64,6 +64,10 @@ struct xen_domctl_createdomain {
  /* Is this a xenstore domain? */
 #define _XEN_DOMCTL_CDF_xs_domain     4
 #define XEN_DOMCTL_CDF_xs_domain      (1U<<_XEN_DOMCTL_CDF_xs_domain)
+
+/* Max XEN_DOMCTL_CDF_* constant.  Used for ABI checking. */
+#define XEN_DOMCTL_CDF_MAX XEN_DOMCTL_CDF_xs_domain
+
     uint32_t flags;
 
     /*