On 3/2/20 8:10 PM, Nick Rosbrook wrote:
> Generate constructors for generated Go types. Call libxl_<type>_init so
> the Go type can be properly initialized.
> 
> If a type has a keyed union field, add a parameter to the function
> signature to set the key variable, and call the init function for the
> keyed union.>
> Signed-off-by: Nick Rosbrook <rosbro...@ainfosec.com>

So gave this a spin and ran a cross a niggle...

> +// NewDomainBuildInfo returns an instance of DomainBuildInfo initialized 
> with defaults.
> +func NewDomainBuildInfo(dtype DomainType) (*DomainBuildInfo, error) {

NewDomainBuildInfo() will take the domain type; but what I really want is...

> +// NewDomainConfig returns an instance of DomainConfig initialized with 
> defaults.
> +func NewDomainConfig() (*DomainConfig, error) {

...for NewDomainConfig() to take the Domain Type.  Otherwise I'm in a
position of having to do something like:

        dconf, err := xl.NewDomainConfig(xl.DomainTypePv)
        if err != nil {
                fmt.Printf("NewDomainConfig: %v\n", err)
                return
        }
        dconf.BInfo = xl.NewDomainBuildInfo(xl.DomainTypePv)

I've already got to do:

        dconf.CInfo.Type = xl.DomainTypePv

Although, I'm not sure if that implies "There's already boilerplate, so
it's extra important to avoid adding more", or "There's already
boilerplate, so it won't hurt to have a bit more, and wrap the whole
thing in a nicer library."

OTOH, we should be able to have libxl automatically copy c_info.type
from b_info.type if c_info.type == LIBXL_DOMAIN_TYPE_INVALID -- if it
doesn't do so already.

Thoughts?

 -George

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

Reply via email to