|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v5 2/3] arm: Allow the user to specify the GIC version
> On 8 Jul 2015, at 12:37, Ian Campbell <Ian.Campbell@xxxxxxxxxx> wrote:
> ...
>
> I have a patch to genwrap.py which results in the following diff to the
> generate ml files for the anonymous sub-struct added by the IDL change
> above.
>
> Dave/Euan/Rob, is that idiomatic ocaml or is it possible to have
> anonymous structs in ocaml like it is in C?
I think that you have done the right thing. Iâm not sure if you can define a
nested record type without giving the inner one a name. But frankly, I donât
think there is much point to that either. In fact, Iâd even drop the "__anonâ
and use the struct name as the type name directly.
Or for consistency, use "type_<name>â, which is similar to what happens in the
keyed union case (âtype_hvm", âtype_pvâ). Incidentally, those structs are also
defined as "Struct(None, [...â, but are probably handled specially because the
struct appears inside the union.
Cheers,
Rob
> If there is a better/more usual way to do this would you mind supplying
> me with the ocaml I should be aiming for please?
>
> Ian.
>
> --- tools/ocaml/libs/xl/_libxl_BACKUP_types.ml.in 2015-07-08
> 11:22:35.000000000 +0100
> +++ tools/ocaml/libs/xl/_libxl_types.ml.in 2015-07-08 12:25:56.000000000
> +0100
> @@ -508,6 +508,17 @@ module Vnode_info = struct
> external default : ctx -> unit -> t = "stub_libxl_vnode_info_init"
> end
>
> +(* libxl_gic_version implementation *)
> +type gic_version =
> + | GIC_VERSION_DEFAULT
> + | GIC_VERSION_V2
> + | GIC_VERSION_V3
> +
> +let string_of_gic_version = function
> + | GIC_VERSION_DEFAULT -> "DEFAULT"
> + | GIC_VERSION_V2 -> "V2"
> + | GIC_VERSION_V3 -> "V3"
> +
> (* libxl_domain_build_info implementation *)
> module Domain_build_info = struct
>
> @@ -566,6 +577,10 @@ module Domain_build_info = struct
>
> type type__union = Hvm of type_hvm | Pv of type_pv | Invalid
>
> + type arch_arm__anon = {
> + gic_version : gic_version;
> + }
> +
> type t =
> {
> max_vcpus : int;
> @@ -607,6 +622,7 @@ module Domain_build_info = struct
> ramdisk : string option;
> device_tree : string option;
> xl_type : type__union;
> + arch_arm : arch_arm__anon;
> }
> external default : ctx -> ?xl_type:domain_type -> unit -> t =
> "stub_libxl_domain_build_info_init"
> end
>
>
>
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |