2014-06-05 19:45:29 +08:00
|
|
|
# -*- Mode: Python -*-
|
2017-01-13 22:41:23 +08:00
|
|
|
|
|
|
|
##
|
2017-08-25 03:14:08 +08:00
|
|
|
# = Common data types
|
2017-01-13 22:41:23 +08:00
|
|
|
##
|
2014-06-05 19:45:29 +08:00
|
|
|
|
|
|
|
##
|
2016-11-17 23:54:55 +08:00
|
|
|
# @QapiErrorClass:
|
2014-06-05 19:45:29 +08:00
|
|
|
#
|
|
|
|
# QEMU error classes
|
|
|
|
#
|
|
|
|
# @GenericError: this is used for errors that don't require a specific error
|
|
|
|
# class. This should be the default case for most errors
|
|
|
|
#
|
|
|
|
# @CommandNotFound: the requested command has not been found
|
|
|
|
#
|
|
|
|
# @DeviceNotActive: a device has failed to be become active
|
|
|
|
#
|
|
|
|
# @DeviceNotFound: the requested device has not been found
|
|
|
|
#
|
|
|
|
# @KVMMissingCap: the requested operation can't be fulfilled because a
|
|
|
|
# required KVM capability is missing
|
|
|
|
#
|
|
|
|
# Since: 1.2
|
|
|
|
##
|
qapi: Add alias for ErrorClass
The qapi enum ErrorClass is unusual that it uses 'CamelCase' names,
contrary to our documented convention of preferring 'lower-case'.
However, this enum is entrenched in the API; we cannot change
what strings QMP outputs. Meanwhile, we want to simplify how
c_enum_const() is used to generate enum constants, by moving away
from the heuristics of camel_to_upper() to a more straightforward
c_name(N).upper() - but doing so will rename all of the ErrorClass
constants and cause churn to all client files, where the new names
are aesthetically less pleasing (ERROR_CLASS_DEVICENOTFOUND looks
like we can't make up our minds on whether to break between words).
So as always in computer science, solve the problem by some more
indirection: rename the qapi type to QapiErrorClass, and add a
new enum ErrorClass in error.h whose members are aliases of the
qapi type, but with the spelling expected elsewhere in the tree.
Then, when c_enum_const() changes the munging, we only have to
adjust the one alias spot.
Suggested by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1447836791-369-26-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-11-18 16:53:00 +08:00
|
|
|
{ 'enum': 'QapiErrorClass',
|
|
|
|
# Keep this in sync with ErrorClass in error.h
|
2017-06-24 00:24:16 +08:00
|
|
|
'data': [ 'GenericError', 'CommandNotFound',
|
2014-06-05 19:45:29 +08:00
|
|
|
'DeviceNotActive', 'DeviceNotFound', 'KVMMissingCap' ] }
|
|
|
|
|
2017-08-25 03:14:06 +08:00
|
|
|
##
|
|
|
|
# @IoOperationType:
|
|
|
|
#
|
|
|
|
# An enumeration of the I/O operation types
|
|
|
|
#
|
|
|
|
# @read: read operation
|
|
|
|
#
|
|
|
|
# @write: write operation
|
|
|
|
#
|
|
|
|
# Since: 2.1
|
|
|
|
##
|
|
|
|
{ 'enum': 'IoOperationType',
|
|
|
|
'data': [ 'read', 'write' ] }
|
|
|
|
|
2014-11-22 00:18:52 +08:00
|
|
|
##
|
2016-11-17 23:54:55 +08:00
|
|
|
# @OnOffAuto:
|
2014-11-22 00:18:52 +08:00
|
|
|
#
|
|
|
|
# An enumeration of three options: on, off, and auto
|
|
|
|
#
|
|
|
|
# @auto: QEMU selects the value between on and off
|
|
|
|
#
|
|
|
|
# @on: Enabled
|
|
|
|
#
|
|
|
|
# @off: Disabled
|
|
|
|
#
|
|
|
|
# Since: 2.2
|
|
|
|
##
|
|
|
|
{ 'enum': 'OnOffAuto',
|
|
|
|
'data': [ 'auto', 'on', 'off' ] }
|
2015-11-17 02:03:06 +08:00
|
|
|
|
|
|
|
##
|
2016-11-17 23:54:55 +08:00
|
|
|
# @OnOffSplit:
|
2015-11-17 02:03:06 +08:00
|
|
|
#
|
|
|
|
# An enumeration of three values: on, off, and split
|
|
|
|
#
|
|
|
|
# @on: Enabled
|
|
|
|
#
|
|
|
|
# @off: Disabled
|
|
|
|
#
|
|
|
|
# @split: Mixed
|
|
|
|
#
|
|
|
|
# Since: 2.6
|
|
|
|
##
|
|
|
|
{ 'enum': 'OnOffSplit',
|
|
|
|
'data': [ 'on', 'off', 'split' ] }
|
2017-08-25 03:13:56 +08:00
|
|
|
|
|
|
|
##
|
|
|
|
# @String:
|
|
|
|
#
|
|
|
|
# A fat type wrapping 'str', to be embedded in lists.
|
|
|
|
#
|
|
|
|
# Since: 1.2
|
|
|
|
##
|
|
|
|
{ 'struct': 'String',
|
|
|
|
'data': {
|
|
|
|
'str': 'str' } }
|
2017-08-25 03:14:01 +08:00
|
|
|
|
|
|
|
##
|
|
|
|
# @StrOrNull:
|
|
|
|
#
|
|
|
|
# This is a string value or the explicit lack of a string (null
|
|
|
|
# pointer in C). Intended for cases when 'optional absent' already
|
|
|
|
# has a different meaning.
|
|
|
|
#
|
|
|
|
# @s: the string value
|
|
|
|
# @n: no string value
|
|
|
|
#
|
|
|
|
# Since: 2.10
|
|
|
|
##
|
|
|
|
{ 'alternate': 'StrOrNull',
|
|
|
|
'data': { 's': 'str',
|
|
|
|
'n': 'null' } }
|