diff options
author | Markus Armbruster <armbru@redhat.com> | 2015-03-16 08:57:47 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2015-06-22 18:20:39 +0200 |
commit | 75158ebbe259f0bd8bf435e8f4827a43ec89c877 (patch) | |
tree | eba61e08212343a1a688dae6f51897b0702ee8db /net | |
parent | c6bf0f7ffa90c720377eb6bddd27037041acbc5b (diff) | |
download | qemu-75158ebbe259f0bd8bf435e8f4827a43ec89c877.zip qemu-75158ebbe259f0bd8bf435e8f4827a43ec89c877.tar.gz qemu-75158ebbe259f0bd8bf435e8f4827a43ec89c877.tar.bz2 |
qerror: Eliminate QERR_DEVICE_NOT_FOUND
Error classes other than ERROR_CLASS_GENERIC_ERROR should not be used
in new code. Hiding them in QERR_ macros makes new uses hard to spot.
Fortunately, there's just one such macro left. Eliminate it with this
coccinelle semantic patch:
@@
expression EP, E;
@@
-error_set(EP, QERR_DEVICE_NOT_FOUND, E)
+error_set(EP, ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found", E)
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/net.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1127,7 +1127,8 @@ void qmp_netdev_del(const char *id, Error **errp) nc = qemu_find_netdev(id); if (!nc) { - error_set(errp, QERR_DEVICE_NOT_FOUND, id); + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", id); return; } @@ -1238,7 +1239,8 @@ void qmp_set_link(const char *name, bool up, Error **errp) MAX_QUEUE_NUM); if (queues == 0) { - error_set(errp, QERR_DEVICE_NOT_FOUND, name); + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", name); return; } nc = ncs[0]; |