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

[Xen-devel] [PATCH] golang/xenlight: Fix type issues with recent Go version



Go is doing more type check (even when using CGo), so these incorrect
use of `unsafe.Pointer` as well as the lack of `unsafe.Pointer` for
these calls no longer compile with recent Go versions.

This does *not* break compatibility with older Go version.
---
 tools/golang/xenlight/xenlight.go | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/golang/xenlight/xenlight.go 
b/tools/golang/xenlight/xenlight.go
index 53534d047e..e281328d43 100644
--- a/tools/golang/xenlight/xenlight.go
+++ b/tools/golang/xenlight/xenlight.go
@@ -854,7 +854,7 @@ func (Ctx *Context) Open() (err error) {
        }
 
        ret := C.libxl_ctx_alloc(&Ctx.ctx, C.LIBXL_VERSION,
-               0, unsafe.Pointer(Ctx.logger))
+               0, (*C.struct_xentoollog_logger)(unsafe.Pointer(Ctx.logger)))
 
        if ret != 0 {
                err = Error(-ret)
@@ -869,7 +869,7 @@ func (Ctx *Context) Close() (err error) {
        if ret != 0 {
                err = Error(-ret)
        }
-       C.xtl_logger_destroy(unsafe.Pointer(Ctx.logger))
+       
C.xtl_logger_destroy((*C.struct_xentoollog_logger)(unsafe.Pointer(Ctx.logger)))
        return
 }
 
@@ -1170,7 +1170,7 @@ func (Ctx *Context) ConsoleGetTty(id Domid, consNum int, 
conType ConsoleType) (p
                err = Error(-ret)
                return
        }
-       defer C.free(cpath)
+       defer C.free(unsafe.Pointer(cpath))
 
        path = C.GoString(cpath)
        return
@@ -1190,7 +1190,7 @@ func (Ctx *Context) PrimaryConsoleGetTty(domid uint32) 
(path string, err error)
                err = Error(-ret)
                return
        }
-       defer C.free(cpath)
+       defer C.free(unsafe.Pointer(cpath))
 
        path = C.GoString(cpath)
        return
-- 
2.22.0


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