When munging enum values, the fact that we were passing the entire
prefix + value through camel_to_upper() meant that enum values
spelled with CamelCase could be turned into CAMEL_CASE. However,
this provides a potential collision (both OneTwo and One-Two would
munge into ONE_TWO). By changing the generation of enum constants
to always be prefix + '_' + c_name(value).upper(), we can avoid
any risk of collisions (if we can also ensure no case collisions,
in the next patch) without having to think about what the
heuristics in camel_to_upper() will actually do to the value.
Thankfully, only two enums are affected: ErrorClass and InputButton.
Suggested by: Markus Armbruster
Signed-off-by: Eric Blake
---
v11: new patch
---
backends/rng-egd.c| 2 +-
balloon.c | 4 ++--
block.c | 2 +-
blockdev-nbd.c| 2 +-
blockdev.c| 24
docs/writing-qmp-commands.txt | 2 +-
hmp.c | 6 +++---
hw/input/hid.c| 4 ++--
hw/input/ps2.c| 4 ++--
hw/input/virtio-input-hid.c | 4 ++--
include/qapi/error.h | 6 +++---
include/ui/qemu-spice.h | 2 +-
monitor.c | 8
net/net.c | 4 ++--
qapi/qmp-dispatch.c | 2 +-
qdev-monitor.c| 4 ++--
qmp.c | 8
qom/object.c | 4 ++--
scripts/qapi.py | 2 +-
ui/cocoa.m| 4 ++--
ui/gtk.c | 4 ++--
ui/input-legacy.c | 4 ++--
ui/input.c| 2 +-
ui/sdl.c | 4 ++--
ui/sdl2.c | 4 ++--
ui/spice-input.c | 4 ++--
ui/vnc.c | 4 ++--
util/error.c | 6 +++---
28 files changed, 65 insertions(+), 65 deletions(-)
diff --git a/backends/rng-egd.c b/backends/rng-egd.c
index 6c13409..d92af31 100644
--- a/backends/rng-egd.c
+++ b/backends/rng-egd.c
@@ -147,7 +147,7 @@ static void rng_egd_opened(RngBackend *b, Error **errp)
s->chr = qemu_chr_find(s->chr_name);
if (s->chr == NULL) {
-error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
+error_set(errp, ERROR_CLASS_DEVICENOTFOUND,
"Device '%s' not found", s->chr_name);
return;
}
diff --git a/balloon.c b/balloon.c
index 0f45d1b..8aab0b8 100644
--- a/balloon.c
+++ b/balloon.c
@@ -51,12 +51,12 @@ void qemu_balloon_inhibit(bool state)
static bool have_balloon(Error **errp)
{
if (kvm_enabled() && !kvm_has_sync_mmu()) {
-error_set(errp, ERROR_CLASS_KVM_MISSING_CAP,
+error_set(errp, ERROR_CLASS_KVMMISSINGCAP,
"Using KVM without synchronous MMU, balloon unavailable");
return false;
}
if (!balloon_event_fn) {
-error_set(errp, ERROR_CLASS_DEVICE_NOT_ACTIVE,
+error_set(errp, ERROR_CLASS_DEVICENOTACTIVE,
"No balloon device has been activated");
return false;
}
diff --git a/block.c b/block.c
index 53a978a..0e0058d 100644
--- a/block.c
+++ b/block.c
@@ -2584,7 +2584,7 @@ void bdrv_add_key(BlockDriverState *bs, const char *key,
Error **errp)
}
} else {
if (bdrv_key_required(bs)) {
-error_set(errp, ERROR_CLASS_DEVICE_ENCRYPTED,
+error_set(errp, ERROR_CLASS_DEVICEENCRYPTED,
"'%s' (%s) is encrypted",
bdrv_get_device_or_node_name(bs),
bdrv_get_encrypted_filename(bs));
diff --git a/blockdev-nbd.c b/blockdev-nbd.c
index bcdd18b..6184eef 100644
--- a/blockdev-nbd.c
+++ b/blockdev-nbd.c
@@ -90,7 +90,7 @@ void qmp_nbd_server_add(const char *device, bool
has_writable, bool writable,
blk = blk_by_name(device);
if (!blk) {
-error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
+error_set(errp, ERROR_CLASS_DEVICENOTFOUND,
"Device '%s' not found", device);
return;
}
diff --git a/blockdev.c b/blockdev.c
index 97be42f..115f46e 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1215,7 +1215,7 @@ SnapshotInfo
*qmp_blockdev_snapshot_delete_internal_sync(const char *device,
blk = blk_by_name(device);
if (!blk) {
-error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
+error_set(errp, ERROR_CLASS_DEVICENOTFOUND,
"Device '%s' not found", device);
return NULL;
}
@@ -1411,7 +1411,7 @@ static void internal_snapshot_prepare(BlkTransactionState
*common,
/* 2. check for validation */
blk = blk_by_name(device);
if (!blk) {
-error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
+error_set(errp, ERROR_CLASS_DEVICENOTFOUND,
"Device '%s' not found", device);
return;
}
@@ -1697,7 +1697,7 @@ static void drive_backup_prepare(BlkTransactionState
*common, Error **errp)
blk