On 11/15/19 7:44 PM, Nick Rosbrook wrote: > From: Nick Rosbrook <rosbro...@ainfosec.com> > > Add struct and keyed union generation to gengotypes.py. For keyed unions, > use a method similar to gRPC's oneof to interpret C unions as Go types. > Meaning, for a given struct with a union field, generate a struct for > each sub-struct defined in the union. Then, define an interface of one > method which is implemented by each of the defined sub-structs. For > example: > > type domainBuildInfoTypeUnion interface { > isdomainBuildInfoTypeUnion() > } > > type DomainBuildInfoTypeUnionHvm struct { > // HVM-specific fields... > } > > func (x DomainBuildInfoTypeUnionHvm) isdomainBuildInfoTypeUnion() {} > > type DomainBuildInfoTypeUnionPv struct { > // PV-specific fields... > } > > func (x DomainBuildInfoTypeUnionPv) isdomainBuildInfoTypeUnion() {} > > type DomainBuildInfoTypeUnionPvh struct { > // PVH-specific fields... > } > > func (x DomainBuildInfoTypeUnionPvh) isdomainBuildInfoTypeUnion() {} > > Then, remove existing struct definitions in xenlight.go that conflict > with the generated types, and modify existing marshaling functions to > align with the new type definitions. Notably, drop "time" package since > fields of type time.Duration are now of type uint64. > > Signed-off-by: Nick Rosbrook <rosbro...@ainfosec.com>
Looks good, thanks! Reviewed-by: George Dunlap <george.dun...@citrix.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel