[Xen-devel] [PATCH] golang/xenlight: Fixing compilation for go 1.11

Daniel P. Smith posted 1 patch 5 years ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/xen tags/patchew/20190418015203.1636-1-dpsmith@apertussolutions.com
tools/golang/xenlight/xenlight.go | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
[Xen-devel] [PATCH] golang/xenlight: Fixing compilation for go 1.11
Posted by Daniel P. Smith 5 years ago
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(-)

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
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH] golang/xenlight: Fixing compilation for go 1.11
Posted by George Dunlap 5 years ago
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).

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH] golang/xenlight: Fixing compilation for go 1.11
Posted by Daniel P. Smith 5 years ago
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

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH] golang/xenlight: Fixing compilation for go 1.11
Posted by Pasi Kärkkäinen 5 years ago
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


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH] golang/xenlight: Fixing compilation for go 1.11
Posted by Jan Beulich 5 years ago
>>> 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



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH] golang/xenlight: Fixing compilation for go 1.11
Posted by George Dunlap 5 years ago
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

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH] golang/xenlight: Fixing compilation for go 1.11
Posted by Rich Persaud 4 years, 9 months ago
> 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
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH] golang/xenlight: Fixing compilation for go 1.11
Posted by George Dunlap 4 years, 9 months ago

> 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
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH] golang/xenlight: Fixing compilation for go 1.11
Posted by George Dunlap 4 years, 9 months ago

> 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

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel