Skip to content

Commit 1fbd5e2

Browse files
committed
qmp: Update generated code
Generated with `go generate ./...`
1 parent a055254 commit 1fbd5e2

File tree

2 files changed

+59
-3
lines changed

2 files changed

+59
-3
lines changed

qmp/raw/autogen.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9765,6 +9765,13 @@ type String struct {
97659765
Str string `json:"str"`
97669766
}
97679767

9768+
// TPMEmulatorOptions -> TPMEmulatorOptions (struct)
9769+
9770+
// TPMEmulatorOptions implements the "TPMEmulatorOptions" QMP API type.
9771+
type TPMEmulatorOptions struct {
9772+
Chardev string `json:"chardev"`
9773+
}
9774+
97689775
// TPMInfo -> TPMInfo (struct)
97699776

97709777
// TPMInfo implements the "TPMInfo" QMP API type.
@@ -9863,13 +9870,16 @@ type TPMType int
98639870
// Known values of TPMType.
98649871
const (
98659872
TPMTypePassthrough TPMType = iota
9873+
TPMTypeEmulator
98669874
)
98679875

98689876
// String implements fmt.Stringer.
98699877
func (e TPMType) String() string {
98709878
switch e {
98719879
case TPMTypePassthrough:
98729880
return "passthrough"
9881+
case TPMTypeEmulator:
9882+
return "emulator"
98739883
default:
98749884
return fmt.Sprintf("TPMType(%d)", e)
98759885
}
@@ -9880,6 +9890,8 @@ func (e TPMType) MarshalJSON() ([]byte, error) {
98809890
switch e {
98819891
case TPMTypePassthrough:
98829892
return json.Marshal("passthrough")
9893+
case TPMTypeEmulator:
9894+
return json.Marshal("emulator")
98839895
default:
98849896
return nil, fmt.Errorf("unknown enum value %q for TPMType", e)
98859897
}
@@ -9894,6 +9906,8 @@ func (e *TPMType) UnmarshalJSON(bs []byte) error {
98949906
switch s {
98959907
case "passthrough":
98969908
*e = TPMTypePassthrough
9909+
case "emulator":
9910+
*e = TPMTypeEmulator
98979911
default:
98989912
return fmt.Errorf("unknown enum value %q for TPMType", s)
98999913
}
@@ -9905,11 +9919,26 @@ func (e *TPMType) UnmarshalJSON(bs []byte) error {
99059919
// TPMTypeOptions implements the "TpmTypeOptions" QMP API type.
99069920
//
99079921
// Can be one of:
9922+
// - TPMTypeOptionsEmulator
99089923
// - TPMTypeOptionsPassthrough
99099924
type TPMTypeOptions interface {
99109925
isTPMTypeOptions()
99119926
}
99129927

9928+
// TPMTypeOptionsEmulator is an implementation of TPMTypeOptions.
9929+
type TPMTypeOptionsEmulator TPMEmulatorOptions
9930+
9931+
func (TPMTypeOptionsEmulator) isTPMTypeOptions() {}
9932+
9933+
// MarshalJSON implements json.Marshaler.
9934+
func (s TPMTypeOptionsEmulator) MarshalJSON() ([]byte, error) {
9935+
v := map[string]interface{}{
9936+
"type": "emulator",
9937+
"data": s,
9938+
}
9939+
return json.Marshal(v)
9940+
}
9941+
99139942
// TPMTypeOptionsPassthrough is an implementation of TPMTypeOptions.
99149943
type TPMTypeOptionsPassthrough TPMPassthroughOptions
99159944

@@ -9933,6 +9962,12 @@ func decodeTPMTypeOptions(bs json.RawMessage) (TPMTypeOptions, error) {
99339962
return nil, err
99349963
}
99359964
switch v.T {
9965+
case "emulator":
9966+
var ret TPMTypeOptionsEmulator
9967+
if err := json.Unmarshal([]byte(v.V), &ret); err != nil {
9968+
return nil, err
9969+
}
9970+
return ret, nil
99369971
case "passthrough":
99379972
var ret TPMTypeOptionsPassthrough
99389973
if err := json.Unmarshal([]byte(v.V), &ret); err != nil {

qmp/raw/spec.txt

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9513,13 +9513,16 @@
95139513
# An enumeration of TPM types
95149514
#
95159515
# @passthrough: TPM passthrough type
9516+
# @emulator: Software Emulator TPM type
9517+
# Since: 2.11
95169518
#
95179519
# Since: 1.5
95189520
##
95199521
{
95209522
"enum": "TpmType",
95219523
"data": [
9522-
"passthrough"
9524+
"passthrough",
9525+
"emulator"
95239526
]
95249527
}
95259528

@@ -9535,7 +9538,7 @@
95359538
# Example:
95369539
#
95379540
# -> { "execute": "query-tpm-types" }
9538-
# <- { "return": [ "passthrough" ] }
9541+
# <- { "return": [ "passthrough", "emulator" ] }
95399542
#
95409543
##
95419544
{
@@ -9565,19 +9568,37 @@
95659568
}
95669569
}
95679570

9571+
##
9572+
# @TPMEmulatorOptions:
9573+
#
9574+
# Information about the TPM emulator type
9575+
#
9576+
# @chardev: Name of a unix socket chardev
9577+
#
9578+
# Since: 2.11
9579+
##
9580+
{
9581+
"struct": "TPMEmulatorOptions",
9582+
"data": {
9583+
"chardev": "str"
9584+
}
9585+
}
9586+
95689587
##
95699588
# @TpmTypeOptions:
95709589
#
95719590
# A union referencing different TPM backend types' configuration options
95729591
#
95739592
# @type: 'passthrough' The configuration options for the TPM passthrough type
9593+
# 'emulator' The configuration options for TPM emulator backend type
95749594
#
95759595
# Since: 1.5
95769596
##
95779597
{
95789598
"union": "TpmTypeOptions",
95799599
"data": {
9580-
"passthrough": "TPMPassthroughOptions"
9600+
"passthrough": "TPMPassthroughOptions",
9601+
"emulator": "TPMEmulatorOptions"
95819602
}
95829603
}
95839604

0 commit comments

Comments
 (0)