diff mbox series

golang/xenlight: Fixing compilation for go 1.11

Message ID 20190418015203.1636-1-dpsmith@apertussolutions.com (mailing list archive)
State New, archived
Headers show
Series golang/xenlight: Fixing compilation for go 1.11 | expand

Commit Message

dpsmith.dev April 18, 2019, 1:52 a.m. UTC
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>
---
 tools/golang/xenlight/xenlight.go | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

George Dunlap April 18, 2019, 1:11 p.m. UTC | #1
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
> 
> Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>

Reviewed-by: George Dunlap <george.dunlap@citrix.com>

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

This should be considered for backport as well (cc'ing Jan).
dpsmith.dev April 20, 2019, 11:27 p.m. UTC | #2
On 4/18/19 9:11 AM, George Dunlap 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
>>
>> Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
> 
> Reviewed-by: George Dunlap <george.dunlap@citrix.com>
> 
> 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.

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

Ack and thank you.

V/r,
Daniel P. Smith
Pasi Kärkkäinen April 22, 2019, 1:47 p.m. UTC | #3
On Sat, Apr 20, 2019 at 07:27:55PM -0400, Daniel P. Smith wrote:
> On 4/18/19 9:11 AM, George Dunlap 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
> >>
> >> Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
> > 
> > Reviewed-by: George Dunlap <george.dunlap@citrix.com>
> > 
> > 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
Jan Beulich April 25, 2019, 11:40 a.m. UTC | #4
>>> On 18.04.19 at 15:11, <george.dunlap@citrix.com> 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
>> 
>> Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
> 
> Reviewed-by: George Dunlap <george.dunlap@citrix.com>
> 
> 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
George Dunlap April 25, 2019, 11:41 a.m. UTC | #5
On 4/25/19 12:40 PM, Jan Beulich wrote:
>>>> On 18.04.19 at 15:11, <george.dunlap@citrix.com> 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
>>>
>>> Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
>>
>> Reviewed-by: George Dunlap <george.dunlap@citrix.com>
>>
>> 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
Rich Persaud July 18, 2019, 6:26 p.m. UTC | #6
> On Apr 25, 2019, at 07:41, George Dunlap <george.dunlap@citrix.com> wrote:
> 
> On 4/25/19 12:40 PM, Jan Beulich wrote:
>>>>> On 18.04.19 at 15:11, <george.dunlap@citrix.com> 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
>>>> 
>>>> Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
>>> 
>>> Reviewed-by: George Dunlap <george.dunlap@citrix.com>
>>> 
>>> 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

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

Rich
George Dunlap July 18, 2019, 8:51 p.m. UTC | #7
> On Jul 18, 2019, at 7:26 PM, Rich Persaud <persaur@gmail.com> wrote:
> 
>> On Apr 25, 2019, at 07:41, George Dunlap <george.dunlap@citrix.com> wrote:
>> 
>> On 4/25/19 12:40 PM, Jan Beulich wrote:
>>>>>> On 18.04.19 at 15:11, <george.dunlap@citrix.com> 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
>>>>> 
>>>>> Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
>>>> 
>>>> Reviewed-by: George Dunlap <george.dunlap@citrix.com>
>>>> 
>>>> 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
> 
> 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
George Dunlap July 18, 2019, 9:06 p.m. UTC | #8
> On Jul 18, 2019, at 9:51 PM, George Dunlap <George.Dunlap@citrix.com> wrote:
> 
> 
> 
>> On Jul 18, 2019, at 7:26 PM, Rich Persaud <persaur@gmail.com> wrote:
>> 
>>> On Apr 25, 2019, at 07:41, George Dunlap <george.dunlap@citrix.com> wrote:
>>> 
>>> On 4/25/19 12:40 PM, Jan Beulich wrote:
>>>>>>> On 18.04.19 at 15:11, <george.dunlap@citrix.com> 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
>>>>>> 
>>>>>> Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
>>>>> 
>>>>> Reviewed-by: George Dunlap <george.dunlap@citrix.com>
>>>>> 
>>>>> 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
>> 
>> 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
diff mbox series

Patch

diff --git a/tools/golang/xenlight/xenlight.go b/tools/golang/xenlight/xenlight.go
index 9c37e59ec0..47bb27a0f9 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