From patchwork Thu Jun 27 07:58:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Belouin X-Patchwork-Id: 11019105 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7D4F2924 for ; Thu, 27 Jun 2019 08:11:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D405289CE for ; Thu, 27 Jun 2019 08:11:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B450289F0; Thu, 27 Jun 2019 08:11:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 55282289CE for ; Thu, 27 Jun 2019 08:11:27 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hgPTG-00023V-P3; Thu, 27 Jun 2019 08:09:30 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hgPTF-00022l-FP for xen-devel@lists.xenproject.org; Thu, 27 Jun 2019 08:09:29 +0000 X-Inumbo-ID: e1cd6527-98b2-11e9-8980-bc764e045a96 Received: from gandi.net (unknown [2001:4b98:dc4:5:ae1f:6bff:fe2d:9fdc]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id e1cd6527-98b2-11e9-8980-bc764e045a96; Thu, 27 Jun 2019 08:09:27 +0000 (UTC) Received: from diconico07.dev (unknown [IPv6:2001:4b98:beef:a:e7c:1fb4:ff55:f4a9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by gandi.net (Postfix) with ESMTPSA id A57331602F2; Thu, 27 Jun 2019 08:09:26 +0000 (UTC) From: Nicolas Belouin To: xen-devel@lists.xenproject.org Date: Thu, 27 Jun 2019 09:58:35 +0200 Message-Id: <20190627075834.14469-1-nicolas.belouin@gandi.net> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] golang/xenlight: Fix type issues with recent Go version X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Ian Jackson , Nicolas Belouin , George Dunlap , Wei Liu Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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