From patchwork Mon Oct 7 15:12:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Rosbrook X-Patchwork-Id: 11177781 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 772D015AB for ; Mon, 7 Oct 2019 15:14:54 +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 477A02070B for ; Mon, 7 Oct 2019 15:14:54 +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="KLXY1j1E" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 477A02070B 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 1iHUhT-0006i4-Rq; Mon, 07 Oct 2019 15:13:27 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iHUhS-0006hn-N1 for xen-devel@lists.xenproject.org; Mon, 07 Oct 2019 15:13:26 +0000 X-Inumbo-ID: fe612460-e914-11e9-9bee-bc764e2007e4 Received: from mail-qt1-x834.google.com (unknown [2607:f8b0:4864:20::834]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id fe612460-e914-11e9-9bee-bc764e2007e4; Mon, 07 Oct 2019 15:13:18 +0000 (UTC) Received: by mail-qt1-x834.google.com with SMTP id j31so19656605qta.5 for ; Mon, 07 Oct 2019 08:13:18 -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=Ygcqn4Ay4EKoqcWvtyBpccbSOXzI7BCo+TnvgE4ius0=; b=KLXY1j1EsxsK0Vjqe3tafxSQDpnKMbKRXF4mBuUhmY2m9nKNohVDTtF5ETvzt9EHPc AUS5MwMIOJspwFQqR0WpTd0Fmofw8XfziPmsNu6NRo7f25jxc0gEcmpf3jTmjp6UK6Gg 66m2tI6tr3ZCyN2ovhxtiPebw/50N0VIOiD2hVwR0ZVIcKfWArqc0OYrPerVfHRLASLq v9PgLAepyzCWKa1YBgF85M9Ejq3UiY+emLQYUsxorRTZ3Xolt2C5HnDE+ekky0a9qiW8 MYjr93iqlWXCGDeLSzN5kBBwT4FwWaevDAwflu6pG7NFv30pM9aiGCSWGASDIQAbZEWm ZkwA== 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=Ygcqn4Ay4EKoqcWvtyBpccbSOXzI7BCo+TnvgE4ius0=; b=H9w18XH/7pZnOmWwKZUIwgdSJd/c1BGP5N5UZKjdXcOzgysG66yFCc0fc9KOFHwXJM fpemmH7fq556YTEbd9BsKOiTIu6yQJd3IerCKHKy54hs82gdx4m0X//J29FU5qsCCfqH bNmncgBgxuIOsCavD5nzfs8quJP+6/+CpZdMKmGJpkv3acbTkxoNmnx8oyN34FEpK6qp rL+4KedlUfgCmEp70lJ1fo3MM3cEVZRbvA96aiGo9VhR10Tzt6SLI5fD2BFVi7pOdtlc ZEpXrteA+XyX3pFZrXKy4OAStZp5jgqucen3LeM6fGqYmftytnF35v5ht1P8ekJaG0IA K/Fw== X-Gm-Message-State: APjAAAVUcLOreu9WyAS5jDxS59qLhORREZ2vERUUia/a2EJ44Wz2t+Tr ZDacI+X8HOAqEffSw9R3f9Zll34j X-Google-Smtp-Source: APXvYqwjxTFNyxtaTfsHCNJ+ZDGdp2kgc7wJrIs3b1drpIjR0/3w60W33snINke9VkVUotEI1r8J2w== X-Received: by 2002:a0c:e948:: with SMTP id n8mr27126177qvo.113.1570461198040; Mon, 07 Oct 2019 08:13:18 -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.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2019 08:13:17 -0700 (PDT) From: Nick Rosbrook To: xen-devel@lists.xenproject.org Date: Mon, 7 Oct 2019 11:12:49 -0400 Message-Id: <2bef5bfd9cc33260be663b84d2b813f28f0f3c47.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 02/24] golang/xenlight: generate enum types from IDL 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 Introduce gengotypes.py to generate Go code the from IDL. As a first step, implement 'enum' type generation. As a result of the newly-generated code, remove the existing, and now conflicting definitions in xenlight.go. In the case of the Error type, rename the slice 'errors' to 'libxlErrors' so that it does not conflict with the standard library package 'errors.' And, negate the values used in 'libxlErrors' since the generated error values are negative. Signed-off-by: Nick Rosbrook --- Cc: George Dunlap Cc: Ian Jackson Cc: Wei Liu tools/golang/xenlight/gengotypes.py | 109 +++++++ tools/golang/xenlight/xenlight.go | 140 ++------- tools/golang/xenlight/xenlight_types.go | 378 ++++++++++++++++++++++++ 3 files changed, 515 insertions(+), 112 deletions(-) create mode 100644 tools/golang/xenlight/gengotypes.py create mode 100644 tools/golang/xenlight/xenlight_types.go diff --git a/tools/golang/xenlight/gengotypes.py b/tools/golang/xenlight/gengotypes.py new file mode 100644 index 0000000000..59307492cb --- /dev/null +++ b/tools/golang/xenlight/gengotypes.py @@ -0,0 +1,109 @@ +#!/usr/bin/python + +import os +import sys + +sys.path.append('{}/tools/libxl'.format(os.environ['XEN_ROOT'])) +import idl + +# Go versions of some builtin types. +# Append the libxl-defined builtins after IDL parsing. +builtin_type_names = { + idl.bool.typename: 'bool', + idl.string.typename: 'string', + idl.integer.typename: 'int', + idl.uint8.typename: 'byte', + idl.uint16.typename: 'uint16', + idl.uint32.typename: 'uint32', + idl.uint64.typename: 'uint64', +} + +def xenlight_golang_generate_types(path = None, types = None, comment = None): + """ + Generate a .go file (xenlight_types.go by default) + that contains a Go type for each type in types. + """ + if path is None: + path = 'xenlight_types.go' + + with open(path, 'w') as f: + if comment is not None: + f.write(comment) + f.write('package xenlight\n') + + for ty in types: + f.write(xenlight_golang_type_define(ty)) + f.write('\n') + + go_fmt(path) + +def xenlight_golang_type_define(ty = None): + s = '' + + if isinstance(ty, idl.Enumeration): + s += xenlight_golang_define_enum(ty) + + return s + +def xenlight_golang_define_enum(ty = None): + s = '' + typename = '' + + if ty.typename is not None: + typename = xenlight_golang_fmt_name(ty.typename) + s += 'type {} int\n'.format(typename) + + # Start const block + s += 'const(\n' + + for v in ty.values: + name = xenlight_golang_fmt_name(v.name) + s += '{} {} = {}\n'.format(name, typename, v.value) + + # End const block + s += ')\n' + + return s + +def xenlight_golang_fmt_name(name, exported = True): + """ + Take a given type name and return an + appropriate Go type name. + """ + if name in builtin_type_names.keys(): + return builtin_type_names[name] + + # Name is not a builtin, format it for Go. + words = name.split('_') + + # Remove 'libxl' prefix + if words[0].lower() == 'libxl': + words.remove(words[0]) + + if exported: + return ''.join(x.title() for x in words) + + return words[0] + ''.join(x.title() for x in words[1:]) + +def go_fmt(path): + """ Call go fmt on the given path. """ + os.system('go fmt {}'.format(path)) + +if __name__ == '__main__': + idlname = sys.argv[1] + + (builtins, types) = idl.parse(idlname) + + for b in builtins: + name = b.typename + builtin_type_names[name] = xenlight_golang_fmt_name(name) + + header_comment="""// DO NOT EDIT. + // + // This file is generated by: + // {} + // + """.format(' '.join(sys.argv)) + + xenlight_golang_generate_types(types=types, + comment=header_comment) diff --git a/tools/golang/xenlight/xenlight.go b/tools/golang/xenlight/xenlight.go index 59b8186a64..e617f22fcf 100644 --- a/tools/golang/xenlight/xenlight.go +++ b/tools/golang/xenlight/xenlight.go @@ -37,77 +37,42 @@ import ( "unsafe" ) -/* - * Errors - */ - -type Error int - -const ( - ErrorNonspecific = Error(-C.ERROR_NONSPECIFIC) - ErrorVersion = Error(-C.ERROR_VERSION) - ErrorFail = Error(-C.ERROR_FAIL) - ErrorNi = Error(-C.ERROR_NI) - ErrorNomem = Error(-C.ERROR_NOMEM) - ErrorInval = Error(-C.ERROR_INVAL) - ErrorBadfail = Error(-C.ERROR_BADFAIL) - ErrorGuestTimedout = Error(-C.ERROR_GUEST_TIMEDOUT) - ErrorTimedout = Error(-C.ERROR_TIMEDOUT) - ErrorNoparavirt = Error(-C.ERROR_NOPARAVIRT) - ErrorNotReady = Error(-C.ERROR_NOT_READY) - ErrorOseventRegFail = Error(-C.ERROR_OSEVENT_REG_FAIL) - ErrorBufferfull = Error(-C.ERROR_BUFFERFULL) - ErrorUnknownChild = Error(-C.ERROR_UNKNOWN_CHILD) - ErrorLockFail = Error(-C.ERROR_LOCK_FAIL) - ErrorJsonConfigEmpty = Error(-C.ERROR_JSON_CONFIG_EMPTY) - ErrorDeviceExists = Error(-C.ERROR_DEVICE_EXISTS) - ErrorCheckpointDevopsDoesNotMatch = Error(-C.ERROR_CHECKPOINT_DEVOPS_DOES_NOT_MATCH) - ErrorCheckpointDeviceNotSupported = Error(-C.ERROR_CHECKPOINT_DEVICE_NOT_SUPPORTED) - ErrorVnumaConfigInvalid = Error(-C.ERROR_VNUMA_CONFIG_INVALID) - ErrorDomainNotfound = Error(-C.ERROR_DOMAIN_NOTFOUND) - ErrorAborted = Error(-C.ERROR_ABORTED) - ErrorNotfound = Error(-C.ERROR_NOTFOUND) - ErrorDomainDestroyed = Error(-C.ERROR_DOMAIN_DESTROYED) - ErrorFeatureRemoved = Error(-C.ERROR_FEATURE_REMOVED) -) - -var errors = [...]string{ - ErrorNonspecific: "Non-specific error", - ErrorVersion: "Wrong version", - ErrorFail: "Failed", - ErrorNi: "Not Implemented", - ErrorNomem: "No memory", - ErrorInval: "Invalid argument", - ErrorBadfail: "Bad Fail", - ErrorGuestTimedout: "Guest timed out", - ErrorTimedout: "Timed out", - ErrorNoparavirt: "No Paravirtualization", - ErrorNotReady: "Not ready", - ErrorOseventRegFail: "OS event registration failed", - ErrorBufferfull: "Buffer full", - ErrorUnknownChild: "Unknown child", - ErrorLockFail: "Lock failed", - ErrorJsonConfigEmpty: "JSON config empty", - ErrorDeviceExists: "Device exists", - ErrorCheckpointDevopsDoesNotMatch: "Checkpoint devops does not match", - ErrorCheckpointDeviceNotSupported: "Checkpoint device not supported", - ErrorVnumaConfigInvalid: "VNUMA config invalid", - ErrorDomainNotfound: "Domain not found", - ErrorAborted: "Aborted", - ErrorNotfound: "Not found", - ErrorDomainDestroyed: "Domain destroyed", - ErrorFeatureRemoved: "Feature removed", +var libxlErrors = [...]string{ + -ErrorNonspecific: "Non-specific error", + -ErrorVersion: "Wrong version", + -ErrorFail: "Failed", + -ErrorNi: "Not Implemented", + -ErrorNomem: "No memory", + -ErrorInval: "Invalid argument", + -ErrorBadfail: "Bad Fail", + -ErrorGuestTimedout: "Guest timed out", + -ErrorTimedout: "Timed out", + -ErrorNoparavirt: "No Paravirtualization", + -ErrorNotReady: "Not ready", + -ErrorOseventRegFail: "OS event registration failed", + -ErrorBufferfull: "Buffer full", + -ErrorUnknownChild: "Unknown child", + -ErrorLockFail: "Lock failed", + -ErrorJsonConfigEmpty: "JSON config empty", + -ErrorDeviceExists: "Device exists", + -ErrorCheckpointDevopsDoesNotMatch: "Checkpoint devops does not match", + -ErrorCheckpointDeviceNotSupported: "Checkpoint device not supported", + -ErrorVnumaConfigInvalid: "VNUMA config invalid", + -ErrorDomainNotfound: "Domain not found", + -ErrorAborted: "Aborted", + -ErrorNotfound: "Not found", + -ErrorDomainDestroyed: "Domain destroyed", + -ErrorFeatureRemoved: "Feature removed", } func (e Error) Error() string { - if 0 < int(e) && int(e) < len(errors) { - s := errors[e] + if 0 < int(e) && int(e) < len(libxlErrors) { + s := libxlErrors[e] if s != "" { return s } } return fmt.Sprintf("libxl error: %d", -e) - } /* @@ -236,18 +201,6 @@ func (cinfo *C.libxl_version_info) toGo() (info *VersionInfo) { return } -type ShutdownReason int32 - -const ( - ShutdownReasonUnknown = ShutdownReason(C.LIBXL_SHUTDOWN_REASON_UNKNOWN) - ShutdownReasonPoweroff = ShutdownReason(C.LIBXL_SHUTDOWN_REASON_POWEROFF) - ShutdownReasonReboot = ShutdownReason(C.LIBXL_SHUTDOWN_REASON_REBOOT) - ShutdownReasonSuspend = ShutdownReason(C.LIBXL_SHUTDOWN_REASON_SUSPEND) - ShutdownReasonCrash = ShutdownReason(C.LIBXL_SHUTDOWN_REASON_CRASH) - ShutdownReasonWatchdog = ShutdownReason(C.LIBXL_SHUTDOWN_REASON_WATCHDOG) - ShutdownReasonSoftReset = ShutdownReason(C.LIBXL_SHUTDOWN_REASON_SOFT_RESET) -) - func (sr ShutdownReason) String() (str string) { cstr := C.libxl_shutdown_reason_to_string(C.libxl_shutdown_reason(sr)) str = C.GoString(cstr) @@ -255,14 +208,6 @@ func (sr ShutdownReason) String() (str string) { return } -type DomainType int32 - -const ( - DomainTypeInvalid = DomainType(C.LIBXL_DOMAIN_TYPE_INVALID) - DomainTypeHvm = DomainType(C.LIBXL_DOMAIN_TYPE_HVM) - DomainTypePv = DomainType(C.LIBXL_DOMAIN_TYPE_PV) -) - func (dt DomainType) String() (str string) { cstr := C.libxl_domain_type_to_string(C.libxl_domain_type(dt)) str = C.GoString(cstr) @@ -323,27 +268,6 @@ func (cdi *C.libxl_dominfo) toGo() (di *Dominfo) { return } -// # Consistent with values defined in domctl.h -// # Except unknown which we have made up -// libxl_scheduler = Enumeration("scheduler", [ -// (0, "unknown"), -// (4, "sedf"), -// (5, "credit"), -// (6, "credit2"), -// (7, "arinc653"), -// (8, "rtds"), -// ]) -type Scheduler int - -var ( - SchedulerUnknown Scheduler = C.LIBXL_SCHEDULER_UNKNOWN - SchedulerSedf Scheduler = C.LIBXL_SCHEDULER_SEDF - SchedulerCredit Scheduler = C.LIBXL_SCHEDULER_CREDIT - SchedulerCredit2 Scheduler = C.LIBXL_SCHEDULER_CREDIT2 - SchedulerArinc653 Scheduler = C.LIBXL_SCHEDULER_ARINC653 - SchedulerRTDS Scheduler = C.LIBXL_SCHEDULER_RTDS -) - // const char *libxl_scheduler_to_string(libxl_scheduler p); func (s Scheduler) String() string { cs := C.libxl_scheduler_to_string(C.libxl_scheduler(s)) @@ -1141,14 +1065,6 @@ func (Ctx *Context) ListVcpu(id Domid) (glist []Vcpuinfo) { return } -type ConsoleType int - -const ( - ConsoleTypeUnknown = ConsoleType(C.LIBXL_CONSOLE_TYPE_UNKNOWN) - ConsoleTypeSerial = ConsoleType(C.LIBXL_CONSOLE_TYPE_SERIAL) - ConsoleTypePV = ConsoleType(C.LIBXL_CONSOLE_TYPE_PV) -) - func (ct ConsoleType) String() (str string) { cstr := C.libxl_console_type_to_string(C.libxl_console_type(ct)) str = C.GoString(cstr) diff --git a/tools/golang/xenlight/xenlight_types.go b/tools/golang/xenlight/xenlight_types.go new file mode 100644 index 0000000000..05f62182b7 --- /dev/null +++ b/tools/golang/xenlight/xenlight_types.go @@ -0,0 +1,378 @@ +// DO NOT EDIT. +// +// This file is generated by: +// gengotypes.py ../../libxl/libxl_types.idl +// +package xenlight + +type Error int + +const ( + ErrorNonspecific Error = -1 + ErrorVersion Error = -2 + ErrorFail Error = -3 + ErrorNi Error = -4 + ErrorNomem Error = -5 + ErrorInval Error = -6 + ErrorBadfail Error = -7 + ErrorGuestTimedout Error = -8 + ErrorTimedout Error = -9 + ErrorNoparavirt Error = -10 + ErrorNotReady Error = -11 + ErrorOseventRegFail Error = -12 + ErrorBufferfull Error = -13 + ErrorUnknownChild Error = -14 + ErrorLockFail Error = -15 + ErrorJsonConfigEmpty Error = -16 + ErrorDeviceExists Error = -17 + ErrorCheckpointDevopsDoesNotMatch Error = -18 + ErrorCheckpointDeviceNotSupported Error = -19 + ErrorVnumaConfigInvalid Error = -20 + ErrorDomainNotfound Error = -21 + ErrorAborted Error = -22 + ErrorNotfound Error = -23 + ErrorDomainDestroyed Error = -24 + ErrorFeatureRemoved Error = -25 + ErrorProtocolErrorQmp Error = -26 + ErrorUnknownQmpError Error = -27 + ErrorQmpGenericError Error = -28 + ErrorQmpCommandNotFound Error = -29 + ErrorQmpDeviceNotActive Error = -30 + ErrorQmpDeviceNotFound Error = -31 + ErrorQemuApi Error = -32 +) + +type DomainType int + +const ( + DomainTypeInvalid DomainType = -1 + DomainTypeHvm DomainType = 1 + DomainTypePv DomainType = 2 + DomainTypePvh DomainType = 3 +) + +type RdmReserveStrategy int + +const ( + RdmReserveStrategyIgnore RdmReserveStrategy = 0 + RdmReserveStrategyHost RdmReserveStrategy = 1 +) + +type RdmReservePolicy int + +const ( + RdmReservePolicyInvalid RdmReservePolicy = -1 + RdmReservePolicyStrict RdmReservePolicy = 0 + RdmReservePolicyRelaxed RdmReservePolicy = 1 +) + +type ChannelConnection int + +const ( + ChannelConnectionUnknown ChannelConnection = 0 + ChannelConnectionPty ChannelConnection = 1 + ChannelConnectionSocket ChannelConnection = 2 +) + +type DeviceModelVersion int + +const ( + DeviceModelVersionUnknown DeviceModelVersion = 0 + DeviceModelVersionQemuXenTraditional DeviceModelVersion = 1 + DeviceModelVersionQemuXen DeviceModelVersion = 2 +) + +type ConsoleType int + +const ( + ConsoleTypeUnknown ConsoleType = 0 + ConsoleTypeSerial ConsoleType = 1 + ConsoleTypePv ConsoleType = 2 + ConsoleTypeVuart ConsoleType = 3 +) + +type DiskFormat int + +const ( + DiskFormatUnknown DiskFormat = 0 + DiskFormatQcow DiskFormat = 1 + DiskFormatQcow2 DiskFormat = 2 + DiskFormatVhd DiskFormat = 3 + DiskFormatRaw DiskFormat = 4 + DiskFormatEmpty DiskFormat = 5 + DiskFormatQed DiskFormat = 6 +) + +type DiskBackend int + +const ( + DiskBackendUnknown DiskBackend = 0 + DiskBackendPhy DiskBackend = 1 + DiskBackendTap DiskBackend = 2 + DiskBackendQdisk DiskBackend = 3 +) + +type NicType int + +const ( + NicTypeUnknown NicType = 0 + NicTypeVifIoemu NicType = 1 + NicTypeVif NicType = 2 +) + +type ActionOnShutdown int + +const ( + ActionOnShutdownDestroy ActionOnShutdown = 1 + ActionOnShutdownRestart ActionOnShutdown = 2 + ActionOnShutdownRestartRename ActionOnShutdown = 3 + ActionOnShutdownPreserve ActionOnShutdown = 4 + ActionOnShutdownCoredumpDestroy ActionOnShutdown = 5 + ActionOnShutdownCoredumpRestart ActionOnShutdown = 6 + ActionOnShutdownSoftReset ActionOnShutdown = 7 +) + +type Trigger int + +const ( + TriggerUnknown Trigger = 0 + TriggerPower Trigger = 1 + TriggerSleep Trigger = 2 + TriggerNmi Trigger = 3 + TriggerInit Trigger = 4 + TriggerReset Trigger = 5 + TriggerS3Resume Trigger = 6 +) + +type TscMode int + +const ( + TscModeDefault TscMode = 0 + TscModeAlwaysEmulate TscMode = 1 + TscModeNative TscMode = 2 + TscModeNativeParavirt TscMode = 3 +) + +type GfxPassthruKind int + +const ( + GfxPassthruKindDefault GfxPassthruKind = 0 + GfxPassthruKindIgd GfxPassthruKind = 1 +) + +type TimerMode int + +const ( + TimerModeUnknown TimerMode = -1 + TimerModeDelayForMissedTicks TimerMode = 0 + TimerModeNoDelayForMissedTicks TimerMode = 1 + TimerModeNoMissedTicksPending TimerMode = 2 + TimerModeOneMissedTickPending TimerMode = 3 +) + +type BiosType int + +const ( + BiosTypeUnknown BiosType = 0 + BiosTypeRombios BiosType = 1 + BiosTypeSeabios BiosType = 2 + BiosTypeOvmf BiosType = 3 +) + +type Scheduler int + +const ( + SchedulerUnknown Scheduler = 0 + SchedulerSedf Scheduler = 4 + SchedulerCredit Scheduler = 5 + SchedulerCredit2 Scheduler = 6 + SchedulerArinc653 Scheduler = 7 + SchedulerRtds Scheduler = 8 + SchedulerNull Scheduler = 9 +) + +type ShutdownReason int + +const ( + ShutdownReasonUnknown ShutdownReason = -1 + ShutdownReasonPoweroff ShutdownReason = 0 + ShutdownReasonReboot ShutdownReason = 1 + ShutdownReasonSuspend ShutdownReason = 2 + ShutdownReasonCrash ShutdownReason = 3 + ShutdownReasonWatchdog ShutdownReason = 4 + ShutdownReasonSoftReset ShutdownReason = 5 +) + +type VgaInterfaceType int + +const ( + VgaInterfaceTypeUnknown VgaInterfaceType = 0 + VgaInterfaceTypeCirrus VgaInterfaceType = 1 + VgaInterfaceTypeStd VgaInterfaceType = 2 + VgaInterfaceTypeNone VgaInterfaceType = 3 + VgaInterfaceTypeQxl VgaInterfaceType = 4 +) + +type VendorDevice int + +const ( + VendorDeviceNone VendorDevice = 0 + VendorDeviceXenserver VendorDevice = 1 +) + +type ViridianEnlightenment int + +const ( + ViridianEnlightenmentBase ViridianEnlightenment = 0 + ViridianEnlightenmentFreq ViridianEnlightenment = 1 + ViridianEnlightenmentTimeRefCount ViridianEnlightenment = 2 + ViridianEnlightenmentReferenceTsc ViridianEnlightenment = 3 + ViridianEnlightenmentHcallRemoteTlbFlush ViridianEnlightenment = 4 + ViridianEnlightenmentApicAssist ViridianEnlightenment = 5 + ViridianEnlightenmentCrashCtl ViridianEnlightenment = 6 + ViridianEnlightenmentSynic ViridianEnlightenment = 7 + ViridianEnlightenmentStimer ViridianEnlightenment = 8 + ViridianEnlightenmentHcallIpi ViridianEnlightenment = 9 +) + +type Hdtype int + +const ( + HdtypeIde Hdtype = 1 + HdtypeAhci Hdtype = 2 +) + +type CheckpointedStream int + +const ( + CheckpointedStreamNone CheckpointedStream = 0 + CheckpointedStreamRemus CheckpointedStream = 1 + CheckpointedStreamColo CheckpointedStream = 2 +) + +type VuartType int + +const ( + VuartTypeUnknown VuartType = 0 + VuartTypeSbsaUart VuartType = 1 +) + +type VkbBackend int + +const ( + VkbBackendUnknown VkbBackend = 0 + VkbBackendQemu VkbBackend = 1 + VkbBackendLinux VkbBackend = 2 +) + +type GicVersion int + +const ( + GicVersionDefault GicVersion = 0 + GicVersionV2 GicVersion = 32 + GicVersionV3 GicVersion = 48 +) + +type TeeType int + +const ( + TeeTypeNone TeeType = 0 + TeeTypeOptee TeeType = 1 +) + +type Altp2MMode int + +const ( + Altp2MModeDisabled Altp2MMode = 0 + Altp2MModeMixed Altp2MMode = 1 + Altp2MModeExternal Altp2MMode = 2 + Altp2MModeLimited Altp2MMode = 3 +) + +type UsbctrlType int + +const ( + UsbctrlTypeAuto UsbctrlType = 0 + UsbctrlTypePv UsbctrlType = 1 + UsbctrlTypeDevicemodel UsbctrlType = 2 + UsbctrlTypeQusb UsbctrlType = 3 +) + +type UsbdevType int + +const ( + UsbdevTypeHostdev UsbdevType = 1 +) + +type VsndPcmFormat int + +const ( + VsndPcmFormatS8 VsndPcmFormat = 1 + VsndPcmFormatU8 VsndPcmFormat = 2 + VsndPcmFormatS16Le VsndPcmFormat = 3 + VsndPcmFormatS16Be VsndPcmFormat = 4 + VsndPcmFormatU16Le VsndPcmFormat = 5 + VsndPcmFormatU16Be VsndPcmFormat = 6 + VsndPcmFormatS24Le VsndPcmFormat = 7 + VsndPcmFormatS24Be VsndPcmFormat = 8 + VsndPcmFormatU24Le VsndPcmFormat = 9 + VsndPcmFormatU24Be VsndPcmFormat = 10 + VsndPcmFormatS32Le VsndPcmFormat = 11 + VsndPcmFormatS32Be VsndPcmFormat = 12 + VsndPcmFormatU32Le VsndPcmFormat = 13 + VsndPcmFormatU32Be VsndPcmFormat = 14 + VsndPcmFormatF32Le VsndPcmFormat = 15 + VsndPcmFormatF32Be VsndPcmFormat = 16 + VsndPcmFormatF64Le VsndPcmFormat = 17 + VsndPcmFormatF64Be VsndPcmFormat = 18 + VsndPcmFormatIec958SubframeLe VsndPcmFormat = 19 + VsndPcmFormatIec958SubframeBe VsndPcmFormat = 20 + VsndPcmFormatMuLaw VsndPcmFormat = 21 + VsndPcmFormatALaw VsndPcmFormat = 22 + VsndPcmFormatImaAdpcm VsndPcmFormat = 23 + VsndPcmFormatMpeg VsndPcmFormat = 24 + VsndPcmFormatGsm VsndPcmFormat = 25 +) + +type VsndStreamType int + +const ( + VsndStreamTypeP VsndStreamType = 1 + VsndStreamTypeC VsndStreamType = 2 +) + +type EventType int + +const ( + EventTypeDomainShutdown EventType = 1 + EventTypeDomainDeath EventType = 2 + EventTypeDiskEject EventType = 3 + EventTypeOperationComplete EventType = 4 + EventTypeDomainCreateConsoleAvailable EventType = 5 +) + +type PsrCmtType int + +const ( + PsrCmtTypeCacheOccupancy PsrCmtType = 1 + PsrCmtTypeTotalMemCount PsrCmtType = 2 + PsrCmtTypeLocalMemCount PsrCmtType = 3 +) + +type PsrCbmType int + +const ( + PsrCbmTypeUnknown PsrCbmType = 0 + PsrCbmTypeL3Cbm PsrCbmType = 1 + PsrCbmTypeL3CbmCode PsrCbmType = 2 + PsrCbmTypeL3CbmData PsrCbmType = 3 + PsrCbmTypeL2Cbm PsrCbmType = 4 + PsrCbmTypeMbaThrtl PsrCbmType = 5 +) + +type PsrFeatType int + +const ( + PsrFeatTypeCat PsrFeatType = 1 + PsrFeatTypeMba PsrFeatType = 2 +)