From nobody Tue Nov 11 07:26:14 2025 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; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1570461292; cv=none; d=zoho.com; s=zohoarc; b=QGXnJjwjj+0XdDIREScFtbxgI+buKSHlWZIqvRyqZ7KJAHk+ziOgZtIvjWNlHcCu8ZA768klGJ7zEUiqLdW67juZxxg3vBQbSBnMq0IBafT74HYrZz5q8cq1fFUnyOwYz+WkqCciCKMsVEVX3hilAbRb9z9bN3Sf1xvpQTcK3k4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570461292; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=1Mam9kmK1J9w1vsOVYuPPusGR8gzEFNu2l85wjQAF80=; b=TR/sWYEk91FbWR4PBW6J3UlucXjYsJ1tltpgM9srGPzp3OX/GrDljVL4MlxVoqHpVApOCZ3HHzX0iH1yBiS1ELgY5GTH9OvKtwhghFKf4DhLmPAixJEN/k16JPuvb1blrn9fcuxnKI53l1tIJlBq2A9A+zqLtpqF1BzOPIq01/4= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; 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; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1570461292352915.7849963718345; Mon, 7 Oct 2019 08:14:52 -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 1iHUhs-0006sX-P0; Mon, 07 Oct 2019 15:13:52 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iHUhr-0006s4-NT for xen-devel@lists.xenproject.org; Mon, 07 Oct 2019 15:13:51 +0000 Received: from mail-qt1-x841.google.com (unknown [2607:f8b0:4864:20::841]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 01a48838-e915-11e9-96dc-bc764e2007e4; Mon, 07 Oct 2019 15:13:24 +0000 (UTC) Received: by mail-qt1-x841.google.com with SMTP id i26so2647377qtm.8 for ; Mon, 07 Oct 2019 08:13:24 -0700 (PDT) Received: from five.crux.rad.ainfosec.com (209-217-208-226.northland.net. [209.217.208.226]) by smtp.googlemail.com with ESMTPSA id c185sm8354313qkg.74.2019.10.07.08.13.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2019 08:13:23 -0700 (PDT) X-Inumbo-ID: 01a48838-e915-11e9-96dc-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=x6JGuVoR7EXpvX1Eyn2HjZht2i/5NyzftbPM9QkorXQ=; b=pxr13ILiir8WEMJ4gFxv70t61cLWLhJie4SDBlSrMhJKoi100fA8WW3P4VDVTDoHVg BA8CaQENFFWnNf7gw8V1LciQ5ZoXT2vKJR8L66MGWLx1//dRSWYVCDCDBv0KSj+Zp0H7 06aofXOaUFFDrHG1cKqc/4Bomr6CcgW35je4v7MwnCxWDfQr1wE23APpRj+c33dyDR4C 3eP5/rPgJ5lC0EhZiB1Iq6gZrqSfY5W5ZfWJT11gkSK4Zb//wXQJ0bcO9kBFmbq5vCVj hJQd9vsW6flfHvsteGSJcu56tjMCuL2m36Eg3NeDPQqWchavc6PMDnxzoPvhlBmpUsWI /1IQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=x6JGuVoR7EXpvX1Eyn2HjZht2i/5NyzftbPM9QkorXQ=; b=cbT+BL2SK7ZWuYBxV9d4mUpWZAkW7PFdmOoy0gZ1PaJM1ozPP8x4ahOF8a32FJoNS4 vhr++EtmUfRzM1SXIvmGrSowlzURAjrtNZPUEbWf7I3jbpSC0dkZ8yF+dzsf9P7VC/3G LMF5Uazj3YCkO8kN5aM+9m8RklSDJYAA01POHWBdi/UHcgSit4NHK5NIz3eaCwUkH/x4 IjeR4TcVhXqQmeHnTMCtN7RJvl/G87zmlYw/dWCxPaKgkOTKBTcb+0h+R8si1Odq8413 AeUHywCvQvg+uNqZV5yR1+SlQdFmpSg3yo954/Y357pk55W0vqhfu1I5sD+FbSyQCCU0 izoQ== X-Gm-Message-State: APjAAAV6i4gX9CgA5fvevSVHXGGK+yb+eDp+DVIXvabt3SG61VP4i/Qj jYzvCrQ3pGbV0xbp9XGgvyfm8ivX X-Google-Smtp-Source: APXvYqzt8npUM/Zb/KWEetdN45k+WfbIfHqr19m2vq9VclNfNJXfc1DGyDZIKlbBVeZgBP08fZ2iUA== X-Received: by 2002:ac8:5046:: with SMTP id h6mr30894932qtm.13.1570461203690; Mon, 07 Oct 2019 08:13:23 -0700 (PDT) From: Nick Rosbrook To: xen-devel@lists.xenproject.org Date: Mon, 7 Oct 2019 11:12:54 -0400 Message-Id: <1644cc12566ebdbcaddde8994a65dde029d0226a.1570456846.git.rosbrookn@ainfosec.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 07/24] golang/xenlight: define StringList builtin type 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: Nick Rosbrook , Ian Jackson , kerriganb@ainfosec.com, 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" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Nick Rosbrook Define StringList as []string an implement fromC and toC functions. Signed-off-by: Nick Rosbrook --- Cc: George Dunlap Cc: Ian Jackson Cc: Wei Liu tools/golang/xenlight/xenlight.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tools/golang/xenlight/xenlight.go b/tools/golang/xenlight/xenl= ight.go index 09fcdca5d1..a3a1836d31 100644 --- a/tools/golang/xenlight/xenlight.go +++ b/tools/golang/xenlight/xenlight.go @@ -234,6 +234,35 @@ func (kvl KeyValueList) toC() (C.libxl_key_value_list,= error) { return ckvl, nil } =20 +// StringList represents a libxl_string_list. +type StringList []string + +func (sl StringList) fromC(csl *C.libxl_string_list) error { + size :=3D int(C.libxl_string_list_length(csl)) + list :=3D (*[1 << 30]*C.char)(unsafe.Pointer(csl))[:size:size] + + sl =3D make([]string, size) + + for i, v :=3D range list { + sl[i] =3D C.GoString(v) + } + + return nil +} + +func (sl StringList) toC() (C.libxl_string_list, error) { + var char *C.char + size :=3D len(sl) + csl :=3D (C.libxl_string_list)(C.malloc(C.ulong(size) * C.ulong(unsafe.Si= zeof(char)))) + clist :=3D (*[1 << 30]*C.char)(unsafe.Pointer(csl))[:size:size] + + for i, v :=3D range sl { + clist[i] =3D C.CString(v) + } + + return csl, nil +} + // Bitmap represents a libxl_bitmap. // // Implement the Go bitmap type such that the underlying data can --=20 2.19.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel