Skip to contentSkip to conversation

golang/xenlight: Fixing compilation for go 1.11

PATCH In review Daniel P. Smith 5 participants 9 messages Apr 18, 2019 – Jul 18, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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

---
 tools/golang/xenlight/xenlight.go | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/golang/xenlight/xenlight.go +4 -4
index 9c37e59ec0..47bb27a0f9 100644
@@ -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
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Daniel P. Smith

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

BTW, do you know if this will compile for older versions of go?

This should be considered for backport as well (cc'ing Jan).

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
Quoted 10 lines · George Dunlap
Quoted 5 lines · Daniel P. Smith

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

BTW, do you know if this will compile for older versions of go?

Per the suggestion on IRC, I did a test compile with golang 1.10.8 as the version available with Ubuntu 18.04 was 1.10.1. Since this matters, the environment was setup with Xen 4.12 tools. If there are additional variations you would like to see, please let me know as I am using a docker container setup for reproducible build environments and should be able to spin up different variations fairly easily.

Quoted 2 lines

This should be considered for backport as well (cc'ing Jan).

Ack and thank you.

V/r,
Daniel P. Smith

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw
Quoted 10 lines · Daniel P. Smith
Quoted 9 lines · George Dunlap
Quoted 5 lines · Daniel P. Smith

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

Quoted 9 lines
Quoted 1 line

BTW, do you know if this will compile for older versions of go?

Per the suggestion on IRC, I did a test compile with golang 1.10.8 as the version available with Ubuntu 18.04 was 1.10.1. Since this matters, the environment was setup with Xen 4.12 tools. If there are additional variations you would like to see, please let me know as I am using a docker container setup for reproducible build environments and should be able to spin up different variations fairly easily.

Ubuntu 16.04 LTS seems to ship golang 1.6 as a default.

CentOS7 used to ship golang 1.9 in CentOS 7.5 and earlier (in extras repo), but currently in CentOS 7.6+ has golang 1.10 (in SCL) and 1.11 (in epel) available.

Thanks,

-- Pasi

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw
In reply to George Dunlap
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 18.04.19 at 15:11, <[email protected]> wrote:
Quoted 4 lines · Daniel P. Smith

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

Quoted 7 lines
Quoted 1 line

BTW, do you know if this will compile for older versions of go?

This should be considered for backport as well (cc'ing Jan).

Did you mean Ian, this being a tools patch?

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#5 lore raw
Quoted 8 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 18.04.19 at 15:11, <[email protected]> wrote:
Quoted 5 lines · Daniel P. Smith

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

Quoted 7 lines
Quoted 5 lines

BTW, do you know if this will compile for older versions of go?

This should be considered for backport as well (cc'ing Jan).

Did you mean Ian, this being a tools patch?

I guess so. Sorry, I didn't realize Ian was doing the tools backports.

-George

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#6 lore raw
Quoted 15 lines · George Dunlap
Quoted 12 lines · Jan Beulich
Quoted 12 lines
Quoted 7 lines
Quoted 1 line · On 18.04.19 at 15:11, <[email protected]> wrote:

On 4/18/19 2:52 AM, Daniel P. Smith wrote:
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

BTW, do you know if this will compile for older versions of go?

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

This should be considered for backport as well (cc'ing Jan).

Did you mean Ian, this being a tools patch?

I guess so. Sorry, I didn't realize Ian was doing the tools backports.

-George

With the golang tools maintainer change completed, is anything further needed for this patch to be merged?

Rich
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#7 lore raw
Quoted 21 lines · Rich Persaud
Quoted 18 lines · George Dunlap
Quoted 14 lines · Jan Beulich
Quoted 13 lines
Quoted 7 lines
Quoted 1 line · On 18.04.19 at 15:11, <[email protected]> wrote:

On 4/18/19 2:52 AM, Daniel P. Smith wrote:
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

BTW, do you know if this will compile for older versions of go?

This should be considered for backport as well (cc'ing Jan).

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Did you mean Ian, this being a tools patch?

I guess so. Sorry, I didn't realize Ian was doing the tools backports.

-George

With the golang tools maintainer change completed, is anything further needed for this patch to be merged?

My change to the MAINTAINERS file hasn’t yet been merged; I think it would be good to wait until the tools maintainer (who technically is currently the maintainer) can Ack the patch.

I’ll ping Ian privately to make sure he doesn’t miss it.

-George
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#8 lore raw
Quoted 29 lines · George Dunlap
Quoted 26 lines · Rich Persaud
Quoted 22 lines · George Dunlap
Quoted 8 lines · Jan Beulich
Quoted 8 lines
Quoted 7 lines
Quoted 1 line · On 18.04.19 at 15:11, <[email protected]> wrote:

On 4/18/19 2:52 AM, Daniel P. Smith wrote:
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

Quoted 7 lines
Quoted 5 lines

BTW, do you know if this will compile for older versions of go?

This should be considered for backport as well (cc'ing Jan).

Did you mean Ian, this being a tools patch?

I guess so. Sorry, I didn't realize Ian was doing the tools backports.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

-George

With the golang tools maintainer change completed, is anything further needed for this patch to be merged?

My change to the MAINTAINERS file hasn’t yet been merged; I think it would be good to wait until the tools maintainer (who technically is currently the maintainer) can Ack the patch.

I’ll ping Ian privately to make sure he doesn’t miss it.

OK, he’s acked it privately, so I’ll check that in and then catch these.

-George

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel