golang/xenlight: Use the most generic pointer for xennoollog
PATCH 1/1 golang/xenlight: Use the most generic pointer for xennoollog
From: Nicolas Belouin <[email protected]>
It makes more sense for Ctx to contain the generic C.xentoollog_logger type, rather than the specific type we end up assigning to it. This also allows one fewer cast.
Signed-off-by Nicolas Belouin <[email protected]>
Signed-off-by George Dunlap <[email protected]>
---
Nicolas' submitted a patch fixing casts as well as making this change, at my suggestion; but I ended up checking in an earlier patch that fixed casts but didn't make this change.
CC Ian Jackson <[email protected]>
CC Wei Liu <[email protected]>
CC Nicolas Belouin <[email protected]>
--- tools/golang/xenlight/xenlight.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
tools/golang/xenlight/xenlight.go +5 -4
@@ -122,7 +122,7 @@ type Uuid C.libxl_uuid type Context struct { ctx *C.libxl_ctx - logger *C.xentoollog_logger_stdiostream + logger *C.xentoollog_logger } type Hwcap []C.uint32_t
@@ -847,14 +847,15 @@ func (Ctx *Context) Open() (err error) { return } - Ctx.logger = C.xtl_createlogger_stdiostream(C.stderr, C.XTL_ERROR, 0) + Ctx.logger = (*C.xentoollog_logger)(unsafe.Pointer( + C.xtl_createlogger_stdiostream(C.stderr, C.XTL_ERROR, 0))) if Ctx.logger == nil { err = fmt.Errorf("Cannot open stdiostream") return } ret := C.libxl_ctx_alloc(&Ctx.ctx, C.LIBXL_VERSION, - 0, (*C.xentoollog_logger)(unsafe.Pointer(Ctx.logger))) + 0, Ctx.logger) if ret != 0 { err = Error(-ret)
@@ -869,7 +870,7 @@ func (Ctx *Context) Close() (err error) { if ret != 0 { err = Error(-ret) } - C.xtl_logger_destroy((*C.xentoollog_logger)(unsafe.Pointer(Ctx.logger))) + C.xtl_logger_destroy(Ctx.logger) return }
Signature · 7 lines
2.20.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel