[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 06/20] tools/ocaml: Drop domain_create_flag_table[]



This is a logarithm in disguise.  Update the logic to match how
x86_arch_emulation_flags works in c/s 9d683b5e37 and b38d96f596.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Christian Lindig <christian.lindig@xxxxxxxxxx>
CC: David Scott <dave@xxxxxxxxxx>
CC: Jon Ludlam <jonathan.ludlam@xxxxxxxxxxxxx>
CC: Rob Hoes <Rob.Hoes@xxxxxxxxxx>
---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c 
b/tools/ocaml/libs/xc/xenctrl_stubs.c
index f97070c..45d4e20 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -97,11 +97,6 @@ CAMLprim value stub_xc_interface_close(value xch)
        CAMLreturn(Val_unit);
 }
 
-static int domain_create_flag_table[] = {
-       XEN_DOMCTL_CDF_hvm_guest,
-       XEN_DOMCTL_CDF_hap,
-};
-
 CAMLprim value stub_xc_domain_create(value xch, value ssidref,
                                      value flags, value handle,
                                      value domconfig)
@@ -124,10 +119,8 @@ CAMLprim value stub_xc_domain_create(value xch, value 
ssidref,
                h[i] = Int_val(Field(handle, i)) & 0xff;
        }
 
-       for (l = flags; l != Val_none; l = Field(l, 1)) {
-               int v = Int_val(Field(l, 0));
-               c_flags |= domain_create_flag_table[v];
-       }
+       for (l = flags; l != Val_none; l = Field(l, 1))
+               c_flags |= 1u << Int_val(Field(l, 0));
 
        switch(Tag_val(domconfig)) {
        case 0: /* ARM - nothing to do */
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.