From patchwork Tue Dec 10 15:47:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Rosbrook X-Patchwork-Id: 11282877 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 306A1138C for ; Tue, 10 Dec 2019 15:49:22 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0CA7B206D5 for ; Tue, 10 Dec 2019 15:49:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="T4JR5lkM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0CA7B206D5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iehkW-00038T-Hu; Tue, 10 Dec 2019 15:48:32 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iehkU-00037Q-RH for xen-devel@lists.xenproject.org; Tue, 10 Dec 2019 15:48:30 +0000 X-Inumbo-ID: 713c9574-1b64-11ea-b6f1-bc764e2007e4 Received: from mail-qt1-x841.google.com (unknown [2607:f8b0:4864:20::841]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 713c9574-1b64-11ea-b6f1-bc764e2007e4; Tue, 10 Dec 2019 15:47:59 +0000 (UTC) Received: by mail-qt1-x841.google.com with SMTP id s8so3207832qte.2 for ; Tue, 10 Dec 2019 07:47:59 -0800 (PST) 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=FHv28KVI1LuPzWrTOCFa+sts2+d/6qshGJxnHHNJjD4=; b=T4JR5lkMiFThm4g2hlVchv7XpPP1BLqo5e/qNpwseqT25AKe88Lp2Ad8J1mqs0HAw9 Wx+jo35oujweyMcXlSTqZCssCfSXJyqFmED6LNDJIqecJDqWoOTF0Qu56UoNUDnltiGb K61j3xWLYHa+O3hHBXqfwqOZzzQBC4USpddnQYRWFgWDya1Ii1YPsSzNy7F2jJd6Rw14 AyWF2fElS16McXbwOy1FsAZRePjLrcSSWmlFU2RPzvqkfKdvo7mG87vDkap8gJcpI0dA PBxD3JTf5P/E+55d6tCsocUeZPZAeWhnDHvmrXcU9JOGLL2LXCPWNF6NDkMuBIEBh24+ IHAw== 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=FHv28KVI1LuPzWrTOCFa+sts2+d/6qshGJxnHHNJjD4=; b=Zwthfoi4NgpplWjEeOs3EklZ2LvCSJSJaMYq92gwvv/1oum2nyBk/1vYRyWEu7Dg6E Bv18uZSZCm8ll12ZDIO7OfRFOWSY2f7hc2lrmcjdR6XKJ1L4MMDOCxeX6JOY8+RzpIG0 gbRoRIu4HwXiXh1sKZ1QvM8rei/I17b9jWfe/tPC+F6obJd3WrdcAW4eCEMHRVsfPMyQ 2J58WaWtYRXNCMJtW96aPGBCG4IMRQrPgqYmhMR0IDK8vsnD/9wFrRd+f3ZEjFSgruad uRkZ3phfeaysnhYIa+QQycO0oN4YqZkC0hdRyMx0LlwLi4U2zjlpEZM3u3JfQ2+jKOBh 33EA== X-Gm-Message-State: APjAAAUBf7NzWmNKWwhA1BQOXvJEFASJeD8QY4JTNuYWTLPsINxmloNz 0go00ZrOkpAKmEn0hAs5hEBVf19J X-Google-Smtp-Source: APXvYqwFBtgEAx+3xnGXkptZqxPJjk3sldGF7iRNpzN44/XCdc52kc37ApJeJLCuPaT9gxWW8f9lIw== X-Received: by 2002:ac8:6f73:: with SMTP id u19mr30205732qtv.326.1575992879261; Tue, 10 Dec 2019 07:47:59 -0800 (PST) Received: from five.crux.rad.ainfosec.com (209-217-208-226.northland.net. [209.217.208.226]) by smtp.googlemail.com with ESMTPSA id m29sm1247848qtf.1.2019.12.10.07.47.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2019 07:47:58 -0800 (PST) From: Nick Rosbrook To: xen-devel@lists.xenproject.org Date: Tue, 10 Dec 2019 10:47:23 -0500 Message-Id: X-Mailer: git-send-email 2.19.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v3 08/22] golang/xenlight: define MsVmGenid 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 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: Nick Rosbrook Define MsVmGenid as [int(C.LIBXL_MS_VM_GENID_LEN)]byte and implement fromC and toC functions. Signed-off-by: Nick Rosbrook Reviewed-by: George Dunlap --- Changes in v3: - In fromC, iterate over the indirect of mvg instead of creating a slice from the C type. --- tools/golang/xenlight/xenlight.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tools/golang/xenlight/xenlight.go b/tools/golang/xenlight/xenlight.go index 17d146771e..6c3868cd69 100644 --- a/tools/golang/xenlight/xenlight.go +++ b/tools/golang/xenlight/xenlight.go @@ -214,6 +214,27 @@ func (mac Mac) toC() (C.libxl_mac, error) { return cmac, nil } +// MsVmGenid represents a libxl_ms_vm_genid. +type MsVmGenid [int(C.LIBXL_MS_VM_GENID_LEN)]byte + +func (mvg *MsVmGenid) fromC(cmvg *C.libxl_ms_vm_genid) error { + for i := range *mvg { + mvg[i] = byte(cmvg.bytes[i]) + } + + return nil +} + +func (mvg *MsVmGenid) toC() (C.libxl_ms_vm_genid, error) { + var cmvg C.libxl_ms_vm_genid + + for i, v := range mvg { + cmvg.bytes[i] = C.uint8_t(v) + } + + return cmvg, nil +} + type Context struct { ctx *C.libxl_ctx logger *C.xentoollog_logger_stdiostream