From nobody Thu Apr 25 17:30:57 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1561710785; cv=none; d=zoho.com; s=zohoarc; b=PB8wmctYSTl/jr7o7kk0PDXTKyuFqhj70wbkymW+FR3GhaI5OS8YtUYup+yB3wW06KSdduawHiY8VL1RaOYJO5jM+2+VtfssXJEFRAYUck8liwvKROAWWP4wow6TOjqS4T2TjvR6NnyPfhR6J7W13dqLyaoQeZRXZ8iAdzfvM74= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561710785; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=mhcZs+sSRQEMzUJjy0nPEpuZXJzgVEd6LCaKEBzoB3s=; b=YxnO6WEajdNIqjiTBRBvEdv5WTmML4F2pl4g9hh9HYvwkXe/XLcKeJRRTrxWGbwQWsMuZudD00JfSd0omwehW+BYD27iInZEcMSlfnNUsXd7edXyssbwbTERJg+/3jG95e+dH5y2Nkp2TCldeKSSkv83h4AtQV9E+sCmEU4GQeM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1561710785418984.2834550148874; Fri, 28 Jun 2019 01:33:05 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hgmIk-00006G-D6; Fri, 28 Jun 2019 08:32:10 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hgmIj-000069-1K for xen-devel@lists.xenproject.org; Fri, 28 Jun 2019 08:32:09 +0000 Received: from gandi.net (unknown [217.70.182.73]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 36c7efde-997f-11e9-8980-bc764e045a96; Fri, 28 Jun 2019 08:32:07 +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 9CC1C16032C; Fri, 28 Jun 2019 08:32:06 +0000 (UTC) X-Inumbo-ID: 36c7efde-997f-11e9-8980-bc764e045a96 From: Nicolas Belouin To: xen-devel@lists.xenproject.org Date: Fri, 28 Jun 2019 10:31:48 +0200 Message-Id: <20190628083148.1747-1-nicolas.belouin@gandi.net> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2] 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Newer versions of Go have become stricter on enforcing the no implicit conversions policy when using CGo. Specifically, the following two conversions are no longer allowed: - unsafe.Pointer being automatically cast to any C pointer - A pointer type other than unsafe.Pointer being automatically cast to C void * Fix this by adding explicit casts where necessary. Signed-off-by: Nicolas Belouin Reviewed-by: George Dunlap --- tools/golang/xenlight/xenlight.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tools/golang/xenlight/xenlight.go b/tools/golang/xenlight/xenl= ight.go index 53534d047e..a2af6f6ef9 100644 --- a/tools/golang/xenlight/xenlight.go +++ b/tools/golang/xenlight/xenlight.go @@ -122,7 +122,7 @@ type Uuid C.libxl_uuid =20 type Context struct { ctx *C.libxl_ctx - logger *C.xentoollog_logger_stdiostream + logger *C.xentoollog_logger } =20 type Hwcap []C.uint32_t @@ -847,14 +847,15 @@ func (Ctx *Context) Open() (err error) { return } =20 - Ctx.logger =3D C.xtl_createlogger_stdiostream(C.stderr, C.XTL_ERROR, 0) + Ctx.logger =3D (*C.xentoollog_logger)(unsafe.Pointer( + C.xtl_createlogger_stdiostream(C.stderr, C.XTL_ERROR, 0))) if Ctx.logger =3D=3D nil { err =3D fmt.Errorf("Cannot open stdiostream") return } =20 ret :=3D C.libxl_ctx_alloc(&Ctx.ctx, C.LIBXL_VERSION, - 0, unsafe.Pointer(Ctx.logger)) + 0, Ctx.logger) =20 if ret !=3D 0 { err =3D Error(-ret) @@ -869,7 +870,7 @@ func (Ctx *Context) Close() (err error) { if ret !=3D 0 { err =3D Error(-ret) } - C.xtl_logger_destroy(unsafe.Pointer(Ctx.logger)) + C.xtl_logger_destroy(Ctx.logger) return } =20 @@ -1170,7 +1171,7 @@ func (Ctx *Context) ConsoleGetTty(id Domid, consNum i= nt, conType ConsoleType) (p err =3D Error(-ret) return } - defer C.free(cpath) + defer C.free(unsafe.Pointer(cpath)) =20 path =3D C.GoString(cpath) return @@ -1190,7 +1191,7 @@ func (Ctx *Context) PrimaryConsoleGetTty(domid uint32= ) (path string, err error) err =3D Error(-ret) return } - defer C.free(cpath) + defer C.free(unsafe.Pointer(cpath)) =20 path =3D C.GoString(cpath) return --=20 2.22.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel