From patchwork Fri Nov 15 19:44:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Rosbrook X-Patchwork-Id: 11247031 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 8415B13BD for ; Fri, 15 Nov 2019 19:46:49 +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 6078E2073A for ; Fri, 15 Nov 2019 19:46:49 +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="ddoP75pH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6078E2073A 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 1iVhXJ-0001YB-9z; Fri, 15 Nov 2019 19:45:41 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iVhXI-0001Xe-Hk for xen-devel@lists.xenproject.org; Fri, 15 Nov 2019 19:45:40 +0000 X-Inumbo-ID: 6dfd0a2a-07e0-11ea-9631-bc764e2007e4 Received: from mail-qk1-x730.google.com (unknown [2607:f8b0:4864:20::730]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 6dfd0a2a-07e0-11ea-9631-bc764e2007e4; Fri, 15 Nov 2019 19:45:08 +0000 (UTC) Received: by mail-qk1-x730.google.com with SMTP id m125so9041154qkd.8 for ; Fri, 15 Nov 2019 11:45:08 -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=SdC3z0q2na4GF7Q+htKEKzAVYjaMonpTz2Zd41lqCo0=; b=ddoP75pHdluMP02msXTVeMLvAdlTJ8CWatHwBCqTZ/HMJt9AV36eJYe6LVlYl+POUi 5GCCeV7Vgx7Pkr8H97RChgnQvY6WYopt1RTXcCOmJQvEfZYbg0BT32fUWBkaRzjeFYaV S2p1GUUuSboRBzMwtRJ55R1OQvqG8/sGBIj9/9SnAG0yERTe2pSz7aSxNd9+Ku8FdkBJ xqBIpRcazUK/WVjAk98Xc52PmS2g9aJFdCPJQ4g09li0EqnLw1mnU3I1Bok3kIZds+vs yv1cde4fT1BLiMTUHdABnisiKGEY2mphysLHWy6O99px24AKIPmbuLHEA1a4DCOLmvta jvKg== 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=SdC3z0q2na4GF7Q+htKEKzAVYjaMonpTz2Zd41lqCo0=; b=T4cthEi6ja20YPZj3Ut8mMAnvuXGH7anyYcHmVbhx59Bj2HZX9IQw5GxBA9VrvEgks ydPYXwOadkbo3OqDprvuCwZftscM0CXJ66yFKwvB1CO4Xro62P4ZBLTzv6whk5/3j7dW Y1vzCFJJSXne48/Zrvdu00pudWGHdHx1AhwwY7dgsSMlzJndpK2yXfBVviLaAXjtyx1h tP8TqJpeq8Tb6ZzV2gd5bnrL62LZygsjABMug/Kqn3mRVN2/nkUJUOmldshh8agw31bJ 89D0GoodxnYyEAdtYEPiYs0jDtqknbGuTYSPr0XmLl4i3vzkUcl5vipZHrUi+Ppmxp9u Rzbw== X-Gm-Message-State: APjAAAV7lHMhzmLfQ4jUw1McMHWWNv3cmkVVa4hJk9CmldJu28AaA6H4 K9/RiY9030Zt/VONnTYAk40wubr/ X-Google-Smtp-Source: APXvYqz/6fXySMTJvm4o7sPDf4H+ZX/qWfaAbd3x4S5bGthJuPLFfbXed1gypq2QTW3DhZYpfapvYw== X-Received: by 2002:a37:2796:: with SMTP id n144mr14103397qkn.403.1573847108072; Fri, 15 Nov 2019 11:45:08 -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 y10sm4649679qkb.55.2019.11.15.11.45.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Nov 2019 11:45:07 -0800 (PST) From: Nick Rosbrook To: xen-devel@lists.xenproject.org Date: Fri, 15 Nov 2019 14:44:15 -0500 Message-Id: <25ebb96e473b1405d202f4334725fd68cb882c38.1573840474.git.rosbrookn@ainfosec.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2 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 --- 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 eb0d309543..108b50124a 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