diff mbox series

[v3,12/12] tools/ocaml: abi: Use formal conversion and check in more places

Message ID 20190910120207.10358-13-ian.jackson@eu.citrix.com (mailing list archive)
State New, archived
Headers show
Series ocaml abi fixes | expand

Commit Message

Ian Jackson Sept. 10, 2019, 12:02 p.m. UTC
From: Andrew Cooper <andrew.cooper3@citrix.com>

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 15 +++++++++------
 xen/include/public/domctl.h         |  4 ++++
 2 files changed, 13 insertions(+), 6 deletions(-)

Comments

Jan Beulich Sept. 10, 2019, 12:18 p.m. UTC | #1
On 10.09.2019 14:02, Ian Jackson wrote:
> From: Andrew Cooper <andrew.cooper3@citrix.com>
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>

Same as for the sysctl one - if you want it, here you are:
Acked-by: Jan Beulich <jbeulich@suse.com>

Jan
diff mbox series

Patch

diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index c74c2b43a0..f86ecc7b7e 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -195,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) )
@@ -211,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
 
@@ -368,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 */
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index ff9265f765..77f546cbb8 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -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;
 
     /*