aboutsummaryrefslogtreecommitdiff
path: root/qapi/common.json
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2015-11-18 01:53:00 -0700
committerMarkus Armbruster <armbru@redhat.com>2015-12-17 08:21:28 +0100
commitf22a28b898322c01b0463a8b7ec551d72bc61a5b (patch)
treea679e67ce5b372e2e108c2f772584353252ad4b6 /qapi/common.json
parent86f4b6871c598e86f0542ed50d2ee5280fc66590 (diff)
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>
Diffstat (limited to 'qapi/common.json')
-rw-r--r--qapi/common.json5
1 files changed, 3 insertions, 2 deletions
diff --git a/qapi/common.json b/qapi/common.json
index bad56bf688..6fb40e7a15 100644
--- a/qapi/common.json
+++ b/qapi/common.json
@@ -3,7 +3,7 @@
# QAPI common definitions
##
-# @ErrorClass
+# @QapiErrorClass
#
# QEMU error classes
#
@@ -24,7 +24,8 @@
#
# Since: 1.2
##
-{ 'enum': 'ErrorClass',
+{ 'enum': 'QapiErrorClass',
+ # Keep this in sync with ErrorClass in error.h
'data': [ 'GenericError', 'CommandNotFound', 'DeviceEncrypted',
'DeviceNotActive', 'DeviceNotFound', 'KVMMissingCap' ] }