[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 Wed, 2015-07-08 at 15:34 +0100, Rob Hoes wrote:
> 
> > On 8 Jul 2015, at 15:19, Ian Campbell <Ian.Campbell@xxxxxxxxxx> wrote:
> > 
> > On Wed, 2015-07-08 at 15:08 +0100, Rob Hoes wrote:
> >> 
> >>> 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.
> > 
> > Thanks.
> > 
> >> In fact, Iâd even drop the "__anonâ and use the struct name as the
> >> type name directly.
> > 
> > I did have that to start with, see below for how the keyed union stuff
> > worked which lead me to suffix it.
> 
> Itâs just that __anon doesnât really mean much, because it isnât
> anonymous in OCaml :) In hindsight, I would have probably dropped the
> __union as well...

Me too, now ;-)

> Anyway, I donât care too much about these names, because in practice
> you wonât normally use them directly.

Right, thanks.

> 
> Rob
> 
> >> Or for consistency, use "type_<name>â, which is similar to what
> >> happens in the keyed union case (âtype_hvm", âtype_pvâ).
> > 
> > Actually in this case the "type" is the name of the KeyedUnion and the
> > hvm|pv are the potential values of the enum which is the key.
> > 
> >> Incidentally, those structs are also defined as "Struct(None, [...â,
> >> but are probably handled specially because the struct appears inside
> >> the union.
> > 
> > Correct, they needed different special handling of the struct in order
> > to construct the keyedunion as an ocaml discriminated type thing, which
> > ends up with (for a keyedunion key field "type" of the domain type
> > enum):
> >     type type_hvm = { ... }
> >     type type_pv = { ... }
> >        type type__union = Hvm of type_hvm | Pv of type_pv | Invalid
> > 
> > then the field is "xl_type : type__union";
> > 
> > (the xl_ prefix is because type, the name of the C field, is an ocaml
> > keyword...)
> > 
> > I added the __anon suffix for consistency with the __union suffix here.
> > 
> > Ian.
> > 
> > 
> 



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

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