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

Re: [Xen-devel] [PATCH] golang/xenlight: Add libxl_utils support



Thanks for the patch!  Looks like a good start; just a couple of comments:

On Wed, Jun 26, 2019 at 11:31 AM Nicolas Belouin
<nicolas.belouin@xxxxxxxxx> wrote:
>
> The Go bindings for libxl miss functions from libxl_utils, lets start

let's

> with the simple libxl_domid_to_name and its counterpart
> libxl_name_to_domid.
>
> Signed-off-by: Nicolas Belouin <nicolas.belouin@xxxxxxxxx>

> +import "C"
> +
> +/*
> + * Other flags that may be needed at some point:
> + *  -lnl-route-3 -lnl-3
> + *
> + * To get back to static linking:
> + * #cgo LDFLAGS: -lxenlight -lyajl_s -lxengnttab -lxenstore -lxenguest 
> -lxentoollog -lxenevtchn -lxenctrl -lxenforeignmemory -lxencall -lz -luuid 
> -lutil
> + */

I think we can drop this comment -- if anyone decides they want to go
back to static linking, or to add those other flags, they can get them
from `xenlight.go`.

> +import (
> +       "unsafe"
> +)
> +
> +//char* libxl_domid_to_name(libxl_ctx *ctx, uint32_t domid);
> +func (Ctx *Context) DomidToName(id Domid) (name string) {
> +       cDomName := C.libxl_domid_to_name(Ctx.ctx, C.uint32_t(id))

libxl_domid_to_name() expects the caller to free() the string returned
to it.  Probably best if we `defer C.free()` here.

Everything else looks good, thanks!

 -George

_______________________________________________
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®.