mirror of https://gitee.com/openkylin/qemu.git
qmp: Eliminate silly QERR_QMP_* macros
The QERR_ macros are leftovers from the days of "rich" error objects. QERR_QMP_BAD_INPUT_OBJECT, QERR_QMP_BAD_INPUT_OBJECT_MEMBER, QERR_QMP_EXTRA_MEMBER are used in just one place now, except for one use that has crept into qobject-input-visitor.c. Drop these macros, to make the (bad) error messages more visible. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <1488544368-30622-10-git-send-email-armbru@redhat.com>
This commit is contained in:
parent
104fc30279
commit
99fb0c53c0
|
@ -82,15 +82,6 @@
|
|||
#define QERR_QGA_COMMAND_FAILED \
|
||||
"Guest agent command failed, error was '%s'"
|
||||
|
||||
#define QERR_QMP_BAD_INPUT_OBJECT \
|
||||
"Expected '%s' in QMP input"
|
||||
|
||||
#define QERR_QMP_BAD_INPUT_OBJECT_MEMBER \
|
||||
"QMP input object member '%s' expects '%s'"
|
||||
|
||||
#define QERR_QMP_EXTRA_MEMBER \
|
||||
"QMP input object member '%s' is unexpected"
|
||||
|
||||
#define QERR_SET_PASSWD_FAILED \
|
||||
"Could not set password"
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ static QDict *qmp_dispatch_check_obj(const QObject *request, Error **errp)
|
|||
|
||||
dict = qobject_to_qdict(request);
|
||||
if (!dict) {
|
||||
error_setg(errp, QERR_QMP_BAD_INPUT_OBJECT, "object");
|
||||
error_setg(errp, "Expected '%s' in QMP input", "object");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -41,25 +41,26 @@ static QDict *qmp_dispatch_check_obj(const QObject *request, Error **errp)
|
|||
|
||||
if (!strcmp(arg_name, "execute")) {
|
||||
if (qobject_type(arg_obj) != QTYPE_QSTRING) {
|
||||
error_setg(errp, QERR_QMP_BAD_INPUT_OBJECT_MEMBER, "execute",
|
||||
"string");
|
||||
error_setg(errp, "QMP input object member '%s' expects '%s'",
|
||||
"execute", "string");
|
||||
return NULL;
|
||||
}
|
||||
has_exec_key = true;
|
||||
} else if (!strcmp(arg_name, "arguments")) {
|
||||
if (qobject_type(arg_obj) != QTYPE_QDICT) {
|
||||
error_setg(errp, QERR_QMP_BAD_INPUT_OBJECT_MEMBER,
|
||||
error_setg(errp, "QMP input object member '%s' expects '%s'",
|
||||
"arguments", "object");
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
error_setg(errp, QERR_QMP_EXTRA_MEMBER, arg_name);
|
||||
error_setg(errp, "QMP input object member '%s' is unexpected",
|
||||
arg_name);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (!has_exec_key) {
|
||||
error_setg(errp, QERR_QMP_BAD_INPUT_OBJECT, "execute");
|
||||
error_setg(errp, "Expected '%s' in QMP input", "execute");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -140,7 +140,8 @@ static void qobject_input_check_struct(Visitor *v, Error **errp)
|
|||
|
||||
g_hash_table_iter_init(&iter, top_ht);
|
||||
if (g_hash_table_iter_next(&iter, (void **)&key, NULL)) {
|
||||
error_setg(errp, QERR_QMP_EXTRA_MEMBER, key);
|
||||
error_setg(errp, "QMP input object member '%s' is unexpected",
|
||||
key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue