Patchwork [13/14] qerror: change all qerror_report() calls to use the ErrClass enum

login
register
mail settings
Submitter Luiz Capitulino
Date July 25, 2012, 8:50 p.m.
Message ID <1343249431-9245-14-git-send-email-lcapitulino@redhat.com>
Download mbox | patch
Permalink /patch/173283/
State New
Headers show

Comments

Luiz Capitulino - July 25, 2012, 8:50 p.m.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 block/cow.c       |  2 +-
 block/qcow.c      |  2 +-
 block/qcow2.c     |  2 +-
 block/qed.c       |  2 +-
 blockdev.c        | 10 +++++-----
 hw/pci.c          |  4 ++--
 hw/qdev-monitor.c | 22 +++++++++++-----------
 hw/usb/bus.c      |  2 +-
 hw/usb/hcd-ehci.c |  4 ++--
 hw/usb/redirect.c |  4 ++--
 monitor.c         | 48 ++++++++++++++++++++++++------------------------
 qemu-option.c     |  2 +-
 12 files changed, 52 insertions(+), 52 deletions(-)

Patch

diff --git a/block/cow.c b/block/cow.c
index 002dcf1..a61708e 100644
--- a/block/cow.c
+++ b/block/cow.c
@@ -81,7 +81,7 @@  static int cow_open(BlockDriverState *bs, int flags)
         char version[64];
         snprintf(version, sizeof(version),
                "COW version %d", cow_header.version);
-        qerror_report(/* QERR_UNKNOWN_BLOCK_FORMAT_FEATURE */ 67, "'device=%s' uses a format=%s feature which is not supported by this qemu version: feature=%s", bs->device_name, "cow", version);
+        qerror_report(QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, "'device=%s' uses a format=%s feature which is not supported by this qemu version: feature=%s",  bs->device_name,  "cow",  version);
         ret = -ENOTSUP;
         goto fail;
     }
diff --git a/block/qcow.c b/block/qcow.c
index 0b1f87c..b86d547 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -118,7 +118,7 @@  static int qcow_open(BlockDriverState *bs, int flags)
     if (header.version != QCOW_VERSION) {
         char version[64];
         snprintf(version, sizeof(version), "QCOW version %d", header.version);
-        qerror_report(/* QERR_UNKNOWN_BLOCK_FORMAT_FEATURE */ 67, "'device=%s' uses a format=%s feature which is not supported by this qemu version: feature=%s", bs->device_name, "qcow", version);
+        qerror_report(QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, "'device=%s' uses a format=%s feature which is not supported by this qemu version: feature=%s",  bs->device_name,  "qcow",  version);
         ret = -ENOTSUP;
         goto fail;
     }
diff --git a/block/qcow2.c b/block/qcow2.c
index a5b46df..7d9c813 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -192,7 +192,7 @@  static void GCC_FMT_ATTR(2, 3) report_unsupported(BlockDriverState *bs,
     vsnprintf(msg, sizeof(msg), fmt, ap);
     va_end(ap);
 
-    qerror_report(/* QERR_UNKNOWN_BLOCK_FORMAT_FEATURE */ 67, "'device=%s' uses a format=%s feature which is not supported by this qemu version: feature=%s", bs->device_name, "qcow2", msg);
+    qerror_report(QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, "'device=%s' uses a format=%s feature which is not supported by this qemu version: feature=%s",  bs->device_name,  "qcow2",  msg);
 }
 
 static void report_unsupported_feature(BlockDriverState *bs,
diff --git a/block/qed.c b/block/qed.c
index fda3dcc..7175a7c 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -397,7 +397,7 @@  static int bdrv_qed_open(BlockDriverState *bs, int flags)
         char buf[64];
         snprintf(buf, sizeof(buf), "%" PRIx64,
             s->header.features & ~QED_FEATURE_MASK);
-        qerror_report(/* QERR_UNKNOWN_BLOCK_FORMAT_FEATURE */ 67, "'device=%s' uses a format=%s feature which is not supported by this qemu version: feature=%s", bs->device_name, "QED", buf);
+        qerror_report(QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, "'device=%s' uses a format=%s feature which is not supported by this qemu version: feature=%s",  bs->device_name,  "QED",  buf);
         return -ENOTSUP;
     }
     if (!qed_is_cluster_size_valid(s->header.cluster_size)) {
diff --git a/blockdev.c b/blockdev.c
index e737d2f..11c714f 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -633,18 +633,18 @@  void do_commit(Monitor *mon, const QDict *qdict)
     if (!strcmp(device, "all")) {
         ret = bdrv_commit_all();
         if (ret == -EBUSY) {
-            qerror_report(/* QERR_DEVICE_IN_USE */ 14, "Device 'device=%s' is in use", device);
+            qerror_report(QERR_DEVICE_IN_USE, "Device 'device=%s' is in use",  device);
             return;
         }
     } else {
         bs = bdrv_find(device);
         if (!bs) {
-            qerror_report(/* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", device);
+            qerror_report(QERR_DEVICE_NOT_FOUND, "Device 'device=%s' not found",  device);
             return;
         }
         ret = bdrv_commit(bs);
         if (ret == -EBUSY) {
-            qerror_report(/* QERR_DEVICE_IN_USE */ 14, "Device 'device=%s' is in use", device);
+            qerror_report(QERR_DEVICE_IN_USE, "Device 'device=%s' is in use",  device);
             return;
         }
     }
@@ -984,11 +984,11 @@  int do_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data)
 
     bs = bdrv_find(id);
     if (!bs) {
-        qerror_report(/* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", id);
+        qerror_report(QERR_DEVICE_NOT_FOUND, "Device 'device=%s' not found",  id);
         return -1;
     }
     if (bdrv_in_use(bs)) {
-        qerror_report(/* QERR_DEVICE_IN_USE */ 14, "Device 'device=%s' is in use", id);
+        qerror_report(QERR_DEVICE_IN_USE, "Device 'device=%s' is in use",  id);
         return -1;
     }
 
diff --git a/hw/pci.c b/hw/pci.c
index 1aac667..1970661 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -1506,7 +1506,7 @@  static int pci_qdev_init(DeviceState *qdev)
     if (pci_dev == NULL)
         return -1;
     if (qdev->hotplugged && pc->no_hotplug) {
-        qerror_report(/* QERR_DEVICE_NO_HOTPLUG */ 19, "Device 'device=%s' does not support hotplugging", object_get_typename(OBJECT(pci_dev)));
+        qerror_report(QERR_DEVICE_NO_HOTPLUG, "Device 'device=%s' does not support hotplugging",  object_get_typename(OBJECT(pci_dev)));
         do_pci_unregister_device(pci_dev);
         return -1;
     }
@@ -1547,7 +1547,7 @@  static int pci_unplug_device(DeviceState *qdev)
     PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev);
 
     if (pc->no_hotplug) {
-        qerror_report(/* QERR_DEVICE_NO_HOTPLUG */ 19, "Device 'device=%s' does not support hotplugging", object_get_typename(OBJECT(dev)));
+        qerror_report(QERR_DEVICE_NO_HOTPLUG, "Device 'device=%s' does not support hotplugging",  object_get_typename(OBJECT(dev)));
         return -1;
     }
     return dev->bus->hotplug(dev->bus->hotplug_qdev, dev,
diff --git a/hw/qdev-monitor.c b/hw/qdev-monitor.c
index 6909a6d..03bb21d 100644
--- a/hw/qdev-monitor.c
+++ b/hw/qdev-monitor.c
@@ -326,7 +326,7 @@  static BusState *qbus_find(const char *path)
         }
         bus = qbus_find_recursive(sysbus_get_default(), elem, NULL);
         if (!bus) {
-            qerror_report(/* QERR_BUS_NOT_FOUND */ 7, "Bus 'bus=%s' not found", elem);
+            qerror_report(QERR_BUS_NOT_FOUND, "Bus 'bus=%s' not found",  elem);
             return NULL;
         }
         pos = len;
@@ -349,7 +349,7 @@  static BusState *qbus_find(const char *path)
         pos += len;
         dev = qbus_find_dev(bus, elem);
         if (!dev) {
-            qerror_report(/* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", elem);
+            qerror_report(QERR_DEVICE_NOT_FOUND, "Device 'device=%s' not found",  elem);
             if (!monitor_cur_is_qmp()) {
                 qbus_list_dev(bus);
             }
@@ -365,12 +365,12 @@  static BusState *qbus_find(const char *path)
              * one child bus accept it nevertheless */
             switch (dev->num_child_bus) {
             case 0:
-                qerror_report(/* QERR_DEVICE_NO_BUS */ 18, "Device 'device=%s' has no child bus", elem);
+                qerror_report(QERR_DEVICE_NO_BUS, "Device 'device=%s' has no child bus",  elem);
                 return NULL;
             case 1:
                 return QLIST_FIRST(&dev->child_bus);
             default:
-                qerror_report(/* QERR_DEVICE_MULTIPLE_BUSSES */ 17, "Device 'device=%s' has multiple child busses", elem);
+                qerror_report(QERR_DEVICE_MULTIPLE_BUSSES, "Device 'device=%s' has multiple child busses",  elem);
                 if (!monitor_cur_is_qmp()) {
                     qbus_list_bus(dev);
                 }
@@ -386,7 +386,7 @@  static BusState *qbus_find(const char *path)
         pos += len;
         bus = qbus_find_bus(dev, elem);
         if (!bus) {
-            qerror_report(/* QERR_BUS_NOT_FOUND */ 7, "Bus 'bus=%s' not found", elem);
+            qerror_report(QERR_BUS_NOT_FOUND, "Bus 'bus=%s' not found",  elem);
             if (!monitor_cur_is_qmp()) {
                 qbus_list_bus(dev);
             }
@@ -405,7 +405,7 @@  DeviceState *qdev_device_add(QemuOpts *opts)
 
     driver = qemu_opt_get(opts, "driver");
     if (!driver) {
-        qerror_report(/* QERR_MISSING_PARAMETER */ 42, "Parameter 'name=%s' is missing", "driver");
+        qerror_report(QERR_MISSING_PARAMETER, "Parameter 'name=%s' is missing",  "driver");
         return NULL;
     }
 
@@ -421,7 +421,7 @@  DeviceState *qdev_device_add(QemuOpts *opts)
     }
 
     if (!obj) {
-        qerror_report(/* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", "driver", "device type");
+        qerror_report(QERR_INVALID_PARAMETER_VALUE, "Parameter 'name=%s' expects expected=%s",  "driver",  "device type");
         return NULL;
     }
 
@@ -435,18 +435,18 @@  DeviceState *qdev_device_add(QemuOpts *opts)
             return NULL;
         }
         if (strcmp(object_get_typename(OBJECT(bus)), k->bus_type) != 0) {
-            qerror_report(/* QERR_BAD_BUS_FOR_DEVICE */ 2, "Device 'device=%s' can't go on a bad_bus_type=%s bus", driver, object_get_typename(OBJECT(bus)));
+            qerror_report(QERR_BAD_BUS_FOR_DEVICE, "Device 'device=%s' can't go on a bad_bus_type=%s bus",  driver,  object_get_typename(OBJECT(bus)));
             return NULL;
         }
     } else {
         bus = qbus_find_recursive(sysbus_get_default(), NULL, k->bus_type);
         if (!bus) {
-            qerror_report(/* QERR_NO_BUS_FOR_DEVICE */ 43, "No 'bus=%s' bus found for device 'device=%s'", driver, k->bus_type);
+            qerror_report(QERR_NO_BUS_FOR_DEVICE, "No 'bus=%s' bus found for device 'device=%s'",  driver,  k->bus_type);
             return NULL;
         }
     }
     if (qdev_hotplug && !bus->allow_hotplug) {
-        qerror_report(/* QERR_BUS_NO_HOTPLUG */ 6, "Bus 'bus=%s' does not support hotplugging", bus->name);
+        qerror_report(QERR_BUS_NO_HOTPLUG, "Bus 'bus=%s' does not support hotplugging",  bus->name);
         return NULL;
     }
 
@@ -477,7 +477,7 @@  DeviceState *qdev_device_add(QemuOpts *opts)
         g_free(name);
     }        
     if (qdev_init(qdev) < 0) {
-        qerror_report(/* QERR_DEVICE_INIT_FAILED */ 13, "Device 'device=%s' could not be initialized", driver);
+        qerror_report(QERR_DEVICE_INIT_FAILED, "Device 'device=%s' could not be initialized",  driver);
         return NULL;
     }
     qdev->opts = opts;
diff --git a/hw/usb/bus.c b/hw/usb/bus.c
index 28901cb..977d4b2 100644
--- a/hw/usb/bus.c
+++ b/hw/usb/bus.c
@@ -303,7 +303,7 @@  int usb_register_companion(const char *masterbus, USBPort *ports[],
     }
 
     if (!bus || !bus->ops->register_companion) {
-        qerror_report(/* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", "masterbus", "an USB masterbus");
+        qerror_report(QERR_INVALID_PARAMETER_VALUE, "Parameter 'name=%s' expects expected=%s",  "masterbus",  "an USB masterbus");
         if (bus) {
             error_printf_unless_qmp(
                 "USB bus '%s' does not allow companion controllers\n",
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index 2d42945..a58a36e 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -933,7 +933,7 @@  static int ehci_register_companion(USBBus *bus, USBPort *ports[],
     uint32_t i;
 
     if (firstport + portcount > NB_PORTS) {
-        qerror_report(/* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", "firstport", "firstport on masterbus");
+        qerror_report(QERR_INVALID_PARAMETER_VALUE, "Parameter 'name=%s' expects expected=%s",  "firstport",  "firstport on masterbus");
         error_printf_unless_qmp(
             "firstport value of %u makes companion take ports %u - %u, which "
             "is outside of the valid range of 0 - %u\n", firstport, firstport,
@@ -943,7 +943,7 @@  static int ehci_register_companion(USBBus *bus, USBPort *ports[],
 
     for (i = 0; i < portcount; i++) {
         if (s->companion_ports[firstport + i]) {
-            qerror_report(/* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", "masterbus", "an USB masterbus");
+            qerror_report(QERR_INVALID_PARAMETER_VALUE, "Parameter 'name=%s' expects expected=%s",  "masterbus",  "an USB masterbus");
             error_printf_unless_qmp(
                 "port %u on masterbus %s already has a companion assigned\n",
                 firstport + i, bus->qbus.name);
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index d43dae2..7ca5444 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -902,7 +902,7 @@  static int usbredir_initfn(USBDevice *udev)
     int i;
 
     if (dev->cs == NULL) {
-        qerror_report(/* QERR_MISSING_PARAMETER */ 42, "Parameter 'name=%s' is missing", "chardev");
+        qerror_report(QERR_MISSING_PARAMETER, "Parameter 'name=%s' is missing",  "chardev");
         return -1;
     }
 
@@ -911,7 +911,7 @@  static int usbredir_initfn(USBDevice *udev)
                                            &dev->filter_rules,
                                            &dev->filter_rules_count);
         if (i) {
-            qerror_report(/* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", "filter", "a usb device filter string");
+            qerror_report(QERR_INVALID_PARAMETER_VALUE, "Parameter 'name=%s' expects expected=%s",  "filter",  "a usb device filter string");
             return -1;
         }
     }
diff --git a/monitor.c b/monitor.c
index a5ec2c8..62d56a4 100644
--- a/monitor.c
+++ b/monitor.c
@@ -227,7 +227,7 @@  int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func,
                           void *opaque)
 {
     if (monitor_ctrl_mode(mon)) {
-        qerror_report(/* QERR_MISSING_PARAMETER */ 42, "Parameter 'name=%s' is missing", "password");
+        qerror_report(QERR_MISSING_PARAMETER, "Parameter 'name=%s' is missing",  "password");
         return -EINVAL;
     } else if (mon->rs) {
         readline_start(mon->rs, "Password: ", 1, readline_func, opaque);
@@ -935,7 +935,7 @@  static int add_graphics_client(Monitor *mon, const QDict *qdict, QObject **ret_d
         int tls = qdict_get_try_bool(qdict, "tls", 0);
         if (!using_spice) {
             /* correct one? spice isn't a device ,,, */
-            qerror_report(/* QERR_DEVICE_NOT_ACTIVE */ 20, "Device 'device=%s' has not been activated", "spice");
+            qerror_report(QERR_DEVICE_NOT_ACTIVE, "Device 'device=%s' has not been activated",  "spice");
             return -1;
         }
         if (qemu_spice_display_add_client(fd, skipauth, tls) < 0) {
@@ -952,13 +952,13 @@  static int add_graphics_client(Monitor *mon, const QDict *qdict, QObject **ret_d
     } else if ((s = qemu_chr_find(protocol)) != NULL) {
 	int fd = monitor_get_fd(mon, fdname);
 	if (qemu_chr_add_client(s, fd) < 0) {
-qerror_report(/* QERR_ADD_CLIENT_FAILED */ 0, "Could not add client");
+qerror_report(QERR_ADD_CLIENT_FAILED, "Could not add client");
 	    return -1;
 	}
 	return 0;
     }
 
-    qerror_report(/* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", "protocol");
+    qerror_report(QERR_INVALID_PARAMETER, "Invalid parameter 'name=%s'",  "protocol");
     return -1;
 }
 
@@ -974,25 +974,25 @@  static int client_migrate_info(Monitor *mon, const QDict *qdict,
 
     if (strcmp(protocol, "spice") == 0) {
         if (!using_spice) {
-            qerror_report(/* QERR_DEVICE_NOT_ACTIVE */ 20, "Device 'device=%s' has not been activated", "spice");
+            qerror_report(QERR_DEVICE_NOT_ACTIVE, "Device 'device=%s' has not been activated",  "spice");
             return -1;
         }
 
         if (port == -1 && tls_port == -1) {
-            qerror_report(/* QERR_MISSING_PARAMETER */ 42, "Parameter 'name=%s' is missing", "port/tls-port");
+            qerror_report(QERR_MISSING_PARAMETER, "Parameter 'name=%s' is missing",  "port/tls-port");
             return -1;
         }
 
         ret = qemu_spice_migrate_info(hostname, port, tls_port, subject,
                                       cb, opaque);
         if (ret != 0) {
-            qerror_report(/* QERR_UNDEFINED_ERROR */ 66, "An undefined error has occurred");
+            qerror_report(QERR_UNDEFINED_ERROR, "An undefined error has occurred");
             return -1;
         }
         return 0;
     }
 
-    qerror_report(/* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", "protocol");
+    qerror_report(QERR_INVALID_PARAMETER, "Invalid parameter 'name=%s'",  "protocol");
     return -1;
 }
 
@@ -3857,7 +3857,7 @@  static void handler_audit(Monitor *mon, const mon_cmd_t *cmd, int ret)
          *
          * Action: Report an internal error to the client if in QMP.
          */
-        qerror_report(/* QERR_UNDEFINED_ERROR */ 66, "An undefined error has occurred");
+        qerror_report(QERR_UNDEFINED_ERROR, "An undefined error has occurred");
     }
 }
 
@@ -4160,7 +4160,7 @@  static int check_client_args_type(const QDict *client_args,
                 continue;
             }
             /* client arg doesn't exist */
-            qerror_report(/* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", client_arg_name);
+            qerror_report(QERR_INVALID_PARAMETER, "Invalid parameter 'name=%s'",  client_arg_name);
             return -1;
         }
 
@@ -4173,7 +4173,7 @@  static int check_client_args_type(const QDict *client_args,
         case 'B':
         case 's':
             if (qobject_type(client_arg) != QTYPE_QSTRING) {
-                qerror_report(/* QERR_INVALID_PARAMETER_TYPE */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", client_arg_name, "string");
+                qerror_report(QERR_INVALID_PARAMETER_TYPE, "Invalid parameter type for 'name=%s',  expected: expected=%s",  client_arg_name,  "string");
                 return -1;
             }
         break;
@@ -4182,21 +4182,21 @@  static int check_client_args_type(const QDict *client_args,
         case 'M':
         case 'o':
             if (qobject_type(client_arg) != QTYPE_QINT) {
-                qerror_report(/* QERR_INVALID_PARAMETER_TYPE */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", client_arg_name, "int");
+                qerror_report(QERR_INVALID_PARAMETER_TYPE, "Invalid parameter type for 'name=%s',  expected: expected=%s",  client_arg_name,  "int");
                 return -1; 
             }
             break;
         case 'T':
             if (qobject_type(client_arg) != QTYPE_QINT &&
                 qobject_type(client_arg) != QTYPE_QFLOAT) {
-                qerror_report(/* QERR_INVALID_PARAMETER_TYPE */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", client_arg_name, "number");
+                qerror_report(QERR_INVALID_PARAMETER_TYPE, "Invalid parameter type for 'name=%s',  expected: expected=%s",  client_arg_name,  "number");
                return -1; 
             }
             break;
         case 'b':
         case '-':
             if (qobject_type(client_arg) != QTYPE_QBOOL) {
-                qerror_report(/* QERR_INVALID_PARAMETER_TYPE */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", client_arg_name, "bool");
+                qerror_report(QERR_INVALID_PARAMETER_TYPE, "Invalid parameter type for 'name=%s',  expected: expected=%s",  client_arg_name,  "bool");
                return -1; 
             }
             break;
@@ -4240,7 +4240,7 @@  static int check_mandatory_args(const QDict *cmd_args,
         } else if (qstring_get_str(type)[0] != '-' &&
                    qstring_get_str(type)[1] != '?' &&
                    !qdict_haskey(client_args, cmd_arg_name)) {
-            qerror_report(/* QERR_MISSING_PARAMETER */ 42, "Parameter 'name=%s' is missing", cmd_arg_name);
+            qerror_report(QERR_MISSING_PARAMETER, "Parameter 'name=%s' is missing",  cmd_arg_name);
             return -1;
         }
     }
@@ -4338,7 +4338,7 @@  static QDict *qmp_check_input_obj(QObject *input_obj)
     QDict *input_dict;
 
     if (qobject_type(input_obj) != QTYPE_QDICT) {
-        qerror_report(/* QERR_QMP_BAD_INPUT_OBJECT */ 55, "Expected 'expected=%s' in QMP input", "object");
+        qerror_report(QERR_QMP_BAD_INPUT_OBJECT, "Expected 'expected=%s' in QMP input",  "object");
         return NULL;
     }
 
@@ -4350,25 +4350,25 @@  static QDict *qmp_check_input_obj(QObject *input_obj)
 
         if (!strcmp(arg_name, "execute")) {
             if (qobject_type(arg_obj) != QTYPE_QSTRING) {
-                qerror_report(/* QERR_QMP_BAD_INPUT_OBJECT_MEMBER */ 56, "QMP input object member 'member=%s' expects 'expected=%s'", "execute", "string");
+                qerror_report(QERR_QMP_BAD_INPUT_OBJECT_MEMBER, "QMP input object member 'member=%s' expects 'expected=%s'",  "execute",  "string");
                 return NULL;
             }
             has_exec_key = 1;
         } else if (!strcmp(arg_name, "arguments")) {
             if (qobject_type(arg_obj) != QTYPE_QDICT) {
-                qerror_report(/* QERR_QMP_BAD_INPUT_OBJECT_MEMBER */ 56, "QMP input object member 'member=%s' expects 'expected=%s'", "arguments", "object");
+                qerror_report(QERR_QMP_BAD_INPUT_OBJECT_MEMBER, "QMP input object member 'member=%s' expects 'expected=%s'",  "arguments",  "object");
                 return NULL;
             }
         } else if (!strcmp(arg_name, "id")) {
             /* FIXME: check duplicated IDs for async commands */
         } else {
-            qerror_report(/* QERR_QMP_EXTRA_INPUT_OBJECT_MEMBER */ 57, "QMP input object member 'member=%s' is unexpected", arg_name);
+            qerror_report(QERR_QMP_EXTRA_INPUT_OBJECT_MEMBER, "QMP input object member 'member=%s' is unexpected",  arg_name);
             return NULL;
         }
     }
 
     if (!has_exec_key) {
-        qerror_report(/* QERR_QMP_BAD_INPUT_OBJECT */ 55, "Expected 'expected=%s' in QMP input", "execute");
+        qerror_report(QERR_QMP_BAD_INPUT_OBJECT, "Expected 'expected=%s' in QMP input",  "execute");
         return NULL;
     }
 
@@ -4401,7 +4401,7 @@  static void handle_qmp_command(JSONMessageParser *parser, QList *tokens)
     obj = json_parser_parse(tokens, NULL);
     if (!obj) {
         // FIXME: should be triggered in json_parser_parse()
-        qerror_report(/* QERR_JSON_PARSING */ 37, "Invalid JSON syntax");
+        qerror_report(QERR_JSON_PARSING, "Invalid JSON syntax");
         goto err_out;
     }
 
@@ -4417,13 +4417,13 @@  static void handle_qmp_command(JSONMessageParser *parser, QList *tokens)
     cmd_name = qdict_get_str(input, "execute");
     trace_handle_qmp_command(mon, cmd_name);
     if (invalid_qmp_mode(mon, cmd_name)) {
-        qerror_report(/* QERR_COMMAND_NOT_FOUND */ 9, "The command name=%s has not been found", cmd_name);
+        qerror_report(QERR_COMMAND_NOT_FOUND, "The command name=%s has not been found",  cmd_name);
         goto err_out;
     }
 
     cmd = qmp_find_cmd(cmd_name);
     if (!cmd) {
-        qerror_report(/* QERR_COMMAND_NOT_FOUND */ 9, "The command name=%s has not been found", cmd_name);
+        qerror_report(QERR_COMMAND_NOT_FOUND, "The command name=%s has not been found",  cmd_name);
         goto err_out;
     }
 
@@ -4685,7 +4685,7 @@  int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs,
     }
 
     if (monitor_ctrl_mode(mon)) {
-        qerror_report(/* QERR_DEVICE_ENCRYPTED */ 10, "Device 'device=%s' is encrypted (filename=filename=%s)", bdrv_get_device_name(bs), bdrv_get_encrypted_filename(bs));
+        qerror_report(QERR_DEVICE_ENCRYPTED, "Device 'device=%s' is encrypted (filename=filename=%s)",  bdrv_get_device_name(bs),  bdrv_get_encrypted_filename(bs));
         return -1;
     }
 
diff --git a/qemu-option.c b/qemu-option.c
index df24142..0864a96 100644
--- a/qemu-option.c
+++ b/qemu-option.c
@@ -690,7 +690,7 @@  int qemu_opt_set_bool(QemuOpts *opts, const char *name, bool val)
         if (i == 0) {
             /* empty list -> allow any */;
         } else {
-            qerror_report(/* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", name);
+            qerror_report(QERR_INVALID_PARAMETER, "Invalid parameter 'name=%s'",  name);
             return -1;
         }
     }