From patchwork Mon Oct 7 15:12:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Rosbrook X-Patchwork-Id: 11177789 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 853E613BD for ; Mon, 7 Oct 2019 15:15:19 +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 60B812070B for ; Mon, 7 Oct 2019 15:15:19 +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="Nx8zhUBR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 60B812070B 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 1iHUi3-0006zF-KQ; Mon, 07 Oct 2019 15:14:03 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iHUi1-0006yV-Q9 for xen-devel@lists.xenproject.org; Mon, 07 Oct 2019 15:14:01 +0000 X-Inumbo-ID: 030b7d3a-e915-11e9-9bee-bc764e2007e4 Received: from mail-qk1-x741.google.com (unknown [2607:f8b0:4864:20::741]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 030b7d3a-e915-11e9-9bee-bc764e2007e4; Mon, 07 Oct 2019 15:13:26 +0000 (UTC) Received: by mail-qk1-x741.google.com with SMTP id f16so12888805qkl.9 for ; Mon, 07 Oct 2019 08:13:26 -0700 (PDT) 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=lBukk/qlgORTmMR549JWa59xhwON8qeH+/C+qvTackQ=; b=Nx8zhUBR7MhDgZLMPKV1MYx26hLVuDv48SlVMp55+0tV2v7erCTSDFJAz4/Zfh/E2T PnvdobvwWHgqniIkI6JRvX0HEvXc+BPpwqwDsfF/qbiaZic97CggKURyRA3FplGMPTaQ nnU/aSlqpHZvwHSG3vUCBghJx+15oUE88oLeoWaOR8aYIRcIy4ms4OJ3umNK4SBUSMwL Lu4wNkDRF+YjU9yLApOXsrGo3EBbvgOIXetSYjuL+ojlHA2uqUZFzKTkgmipMLM8Qbk8 TGLfPjk+ECDQ+w6rpFZaKOJYksEO9YKvjYGzSU1ntcFcbu1Jbqv76zI2RNt7KNXa6Kwe lUXA== 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=lBukk/qlgORTmMR549JWa59xhwON8qeH+/C+qvTackQ=; b=dvLK5bdGBqT9EvG5YfPLB6EcCvZfHbOLwsAxYosXW/p8Mjtp4bOJ0wyz+90/ffebJM DmVatPvirF3hs0KLxsImID+59a0YZ5eQTS8k8em9xtDsnQnORuyXUfhDno2bQzsPGSWI I/h8eKv+Qg85NeBumc8Dr2d79eBwwbv7zAGcsuaEm5tnwI09qIpH9bzAJiJIpZtbqqDx btQnSB77iNHL/j3hxMFQsJa5sLsc1460n0Dx3gx6g4/4m1y3pVdwjOww9axtVnIRmQle 1HItf9GjtvEIDEuWGsbKPBEQBX25DWIW/tRZX2dPoUvoz0uBfNeUXAO0mKHcgkVqpDqO FlWw== X-Gm-Message-State: APjAAAVIT2Be0V2dCeqovJRPLTwuLQTLOfAxfoWPr/+hAy7uXPMW90dO 4TIyiSMzq1wUw8Rx+kw/Wj0vapYt X-Google-Smtp-Source: APXvYqzyNSFxMzsUFzZgx++d4TzbQSTKYONgvX306foWV1039FRm3amb3UcVbB/exY9KfT6KtEMZ2g== X-Received: by 2002:a05:620a:49b:: with SMTP id 27mr22388047qkr.89.1570461205990; Mon, 07 Oct 2019 08:13:25 -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.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2019 08:13:25 -0700 (PDT) From: Nick Rosbrook To: xen-devel@lists.xenproject.org Date: Mon, 7 Oct 2019 11:12:56 -0400 Message-Id: <87f082bdf06e820e911256138a7380d0cf7019a2.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 09/24] 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 --- Cc: George Dunlap Cc: Ian Jackson Cc: Wei Liu tools/golang/xenlight/xenlight.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tools/golang/xenlight/xenlight.go b/tools/golang/xenlight/xenlight.go index 3b7824b284..6aca5b89c0 100644 --- a/tools/golang/xenlight/xenlight.go +++ b/tools/golang/xenlight/xenlight.go @@ -216,6 +216,29 @@ 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 { + b := (*[int(C.LIBXL_MS_VM_GENID_LEN)]C.uint8_t)(unsafe.Pointer(&cmvg.bytes[0])) + + for i, v := range b { + mvg[i] = byte(v) + } + + 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