qerror: Clean up QERR_ macros to expand into a single string

These macros expand into error class enumeration constant, comma,
string.  Unclean.  Has been that way since commit 13f59ae.

The error class is always ERROR_CLASS_GENERIC_ERROR since the previous
commit.

Clean up as follows:

* Prepend every use of a QERR_ macro by ERROR_CLASS_GENERIC_ERROR, and
  delete it from the QERR_ macro.  No change after preprocessing.

* Rewrite error_set(ERROR_CLASS_GENERIC_ERROR, ...) into
  error_setg(...).  Again, no change after preprocessing.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
Markus Armbruster 2015-03-17 11:54:50 +01:00
parent 75158ebbe2
commit c6bd8c706a
54 changed files with 367 additions and 363 deletions

34
qmp.c
View file

@ -132,13 +132,13 @@ void qmp_cpu_add(int64_t id, Error **errp)
defined in the VNC subsystem */
VncInfo *qmp_query_vnc(Error **errp)
{
error_set(errp, QERR_FEATURE_DISABLED, "vnc");
error_setg(errp, QERR_FEATURE_DISABLED, "vnc");
return NULL;
};
VncInfo2List *qmp_query_vnc_servers(Error **errp)
{
error_set(errp, QERR_FEATURE_DISABLED, "vnc");
error_setg(errp, QERR_FEATURE_DISABLED, "vnc");
return NULL;
};
#endif
@ -295,7 +295,7 @@ void qmp_set_password(const char *protocol, const char *password,
} else if (strcmp(connected, "keep") == 0) {
/* nothing */
} else {
error_set(errp, QERR_INVALID_PARAMETER, "connected");
error_setg(errp, QERR_INVALID_PARAMETER, "connected");
return;
}
}
@ -307,7 +307,7 @@ void qmp_set_password(const char *protocol, const char *password,
rc = qemu_spice_set_passwd(password, fail_if_connected,
disconnect_if_connected);
if (rc != 0) {
error_set(errp, QERR_SET_PASSWD_FAILED);
error_setg(errp, QERR_SET_PASSWD_FAILED);
}
return;
}
@ -315,19 +315,19 @@ void qmp_set_password(const char *protocol, const char *password,
if (strcmp(protocol, "vnc") == 0) {
if (fail_if_connected || disconnect_if_connected) {
/* vnc supports "connected=keep" only */
error_set(errp, QERR_INVALID_PARAMETER, "connected");
error_setg(errp, QERR_INVALID_PARAMETER, "connected");
return;
}
/* Note that setting an empty password will not disable login through
* this interface. */
rc = vnc_display_password(NULL, password);
if (rc < 0) {
error_set(errp, QERR_SET_PASSWD_FAILED);
error_setg(errp, QERR_SET_PASSWD_FAILED);
}
return;
}
error_set(errp, QERR_INVALID_PARAMETER, "protocol");
error_setg(errp, QERR_INVALID_PARAMETER, "protocol");
}
void qmp_expire_password(const char *protocol, const char *whenstr,
@ -352,7 +352,7 @@ void qmp_expire_password(const char *protocol, const char *whenstr,
}
rc = qemu_spice_set_pw_expire(when);
if (rc != 0) {
error_set(errp, QERR_SET_PASSWD_FAILED);
error_setg(errp, QERR_SET_PASSWD_FAILED);
}
return;
}
@ -360,19 +360,19 @@ void qmp_expire_password(const char *protocol, const char *whenstr,
if (strcmp(protocol, "vnc") == 0) {
rc = vnc_display_pw_expire(NULL, when);
if (rc != 0) {
error_set(errp, QERR_SET_PASSWD_FAILED);
error_setg(errp, QERR_SET_PASSWD_FAILED);
}
return;
}
error_set(errp, QERR_INVALID_PARAMETER, "protocol");
error_setg(errp, QERR_INVALID_PARAMETER, "protocol");
}
#ifdef CONFIG_VNC
void qmp_change_vnc_password(const char *password, Error **errp)
{
if (vnc_display_password(NULL, password) < 0) {
error_set(errp, QERR_SET_PASSWD_FAILED);
error_setg(errp, QERR_SET_PASSWD_FAILED);
}
}
@ -403,7 +403,7 @@ static void qmp_change_vnc(const char *target, bool has_arg, const char *arg,
{
if (strcmp(target, "passwd") == 0 || strcmp(target, "password") == 0) {
if (!has_arg) {
error_set(errp, QERR_MISSING_PARAMETER, "password");
error_setg(errp, QERR_MISSING_PARAMETER, "password");
} else {
qmp_change_vnc_password(arg, errp);
}
@ -414,12 +414,12 @@ static void qmp_change_vnc(const char *target, bool has_arg, const char *arg,
#else
void qmp_change_vnc_password(const char *password, Error **errp)
{
error_set(errp, QERR_FEATURE_DISABLED, "vnc");
error_setg(errp, QERR_FEATURE_DISABLED, "vnc");
}
static void qmp_change_vnc(const char *target, bool has_arg, const char *arg,
Error **errp)
{
error_set(errp, QERR_FEATURE_DISABLED, "vnc");
error_setg(errp, QERR_FEATURE_DISABLED, "vnc");
}
#endif /* !CONFIG_VNC */
@ -528,8 +528,7 @@ DevicePropertyInfoList *qmp_device_list_properties(const char *typename,
klass = object_class_dynamic_cast(klass, TYPE_DEVICE);
if (klass == NULL) {
error_set(errp, QERR_INVALID_PARAMETER_VALUE,
"name", TYPE_DEVICE);
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "name", TYPE_DEVICE);
return NULL;
}
@ -686,7 +685,8 @@ int qmp_object_add(Monitor *mon, const QDict *qdict, QObject **ret)
if (props) {
pdict = qobject_to_qdict(props);
if (!pdict) {
error_set(&local_err, QERR_INVALID_PARAMETER_TYPE, "props", "dict");
error_setg(&local_err, QERR_INVALID_PARAMETER_TYPE,
"props", "dict");
goto out;
}
}