Mailing List Archive

[xen master] golang/xenlight: Fixing compilation for go 1.11
commit 643d8e566de59f247556e62a27ed7a5ac2e8a8cf
Author: Daniel P. Smith <dpsmith.dev@gmail.com>
AuthorDate: Thu Jul 18 22:11:44 2019 +0100
Commit: George Dunlap <george.dunlap@citrix.com>
CommitDate: Thu Jul 18 22:11:44 2019 +0100

golang/xenlight: Fixing compilation for go 1.11

This deals with two casting issues for compiling under go 1.11:
- explicitly cast to *C.xentoollog_logger for Ctx.logger pointer
- add cast to unsafe.Pointer for the C string cpath

Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
---
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..f5d171c2d5 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.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.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
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xenproject.org
https://lists.xenproject.org/xen-changelog