diff options
Diffstat (limited to 'qapi')
-rw-r--r-- | qapi/qmp-core.h | 1 | ||||
-rw-r--r-- | qapi/qmp-registry.c | 14 |
2 files changed, 13 insertions, 2 deletions
diff --git a/qapi/qmp-core.h b/qapi/qmp-core.h index 3bb3acb589..431ddbb337 100644 --- a/qapi/qmp-core.h +++ b/qapi/qmp-core.h @@ -38,6 +38,7 @@ void qmp_register_command(const char *name, QmpCommandFunc *fn); QmpCommand *qmp_find_command(const char *name); QObject *qmp_dispatch(QObject *request); void qmp_disable_command(const char *name); +void qmp_enable_command(const char *name); bool qmp_command_is_enabled(const char *name); char **qmp_get_command_list(void); diff --git a/qapi/qmp-registry.c b/qapi/qmp-registry.c index 25c89ad098..43d5cdeb64 100644 --- a/qapi/qmp-registry.c +++ b/qapi/qmp-registry.c @@ -40,18 +40,28 @@ QmpCommand *qmp_find_command(const char *name) return NULL; } -void qmp_disable_command(const char *name) +static void qmp_toggle_command(const char *name, bool enabled) { QmpCommand *cmd; QTAILQ_FOREACH(cmd, &qmp_commands, node) { if (strcmp(cmd->name, name) == 0) { - cmd->enabled = false; + cmd->enabled = enabled; return; } } } +void qmp_disable_command(const char *name) +{ + qmp_toggle_command(name, false); +} + +void qmp_enable_command(const char *name) +{ + qmp_toggle_command(name, true); +} + bool qmp_command_is_enabled(const char *name) { QmpCommand *cmd; |