mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
qapi: Support multiple command registries per program
The command registry encapsulates a single command list. Give the functions using it a parameter instead. Define suitable command lists in monitor, guest agent and test-qmp-commands. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1488544368-30622-6-git-send-email-armbru@redhat.com> [Debugging turds buried] Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
0587568780
commit
1527badb95
9 changed files with 84 additions and 66 deletions
|
@ -67,7 +67,8 @@ static QDict *qmp_dispatch_check_obj(const QObject *request, Error **errp)
|
|||
return dict;
|
||||
}
|
||||
|
||||
static QObject *do_qmp_dispatch(QObject *request, Error **errp)
|
||||
static QObject *do_qmp_dispatch(QmpCommandList *cmds, QObject *request,
|
||||
Error **errp)
|
||||
{
|
||||
Error *local_err = NULL;
|
||||
const char *command;
|
||||
|
@ -81,7 +82,7 @@ static QObject *do_qmp_dispatch(QObject *request, Error **errp)
|
|||
}
|
||||
|
||||
command = qdict_get_str(dict, "execute");
|
||||
cmd = qmp_find_command(command);
|
||||
cmd = qmp_find_command(cmds, command);
|
||||
if (cmd == NULL) {
|
||||
error_set(errp, ERROR_CLASS_COMMAND_NOT_FOUND,
|
||||
"The command %s has not been found", command);
|
||||
|
@ -121,13 +122,13 @@ QObject *qmp_build_error_object(Error *err)
|
|||
error_get_pretty(err));
|
||||
}
|
||||
|
||||
QObject *qmp_dispatch(QObject *request)
|
||||
QObject *qmp_dispatch(QmpCommandList *cmds, QObject *request)
|
||||
{
|
||||
Error *err = NULL;
|
||||
QObject *ret;
|
||||
QDict *rsp;
|
||||
|
||||
ret = do_qmp_dispatch(request, &err);
|
||||
ret = do_qmp_dispatch(cmds, request, &err);
|
||||
|
||||
rsp = qdict_new();
|
||||
if (err) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue