|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen staging] tools/ocaml: abi: Use formal conversion and check in more places
commit 7fb0e134f8c67f78470c15ec2a5e99dfa8c4a49b
Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Tue Sep 10 12:17:30 2019 +0100
Commit: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
CommitDate: Tue Sep 10 14:44:33 2019 +0100
tools/ocaml: abi: Use formal conversion and check in more places
Now we have a caller for ocaml_list_to_c_bitmap.
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
Acked-by: Christian Lindig <christian.lindig@xxxxxxxxxx>
---
tools/ocaml/libs/xc/xenctrl_stubs.c | 17 +++++++++--------
xen/include/public/domctl.h | 4 ++++
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c
b/tools/ocaml/libs/xc/xenctrl_stubs.c
index 522c2c59dd..f86ecc7b7e 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -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 */
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;
/*
--
generated by git-patchbot for /home/xen/git/xen.git#staging
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |