|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v3 12/12] tools/ocaml: abi: Use formal conversion and check in more places
From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
tools/ocaml/libs/xc/xenctrl_stubs.c | 15 +++++++++------
xen/include/public/domctl.h | 4 ++++
2 files changed, 13 insertions(+), 6 deletions(-)
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;
/*
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |