diff options
author | Michael Roth <mdroth@linux.vnet.ibm.com> | 2012-04-17 19:01:45 -0500 |
---|---|---|
committer | Michael Roth <mdroth@linux.vnet.ibm.com> | 2012-04-30 08:42:10 -0500 |
commit | f22d85e9e67262db34504f4079745f9843da6a92 (patch) | |
tree | 4eb65b26bec47ed0b9b9f6014ad5278b1e89f048 /qapi/qmp-registry.c | |
parent | 9e8aded432884477bcd4fa1c7e849a196412bcc4 (diff) | |
download | hqemu-f22d85e9e67262db34504f4079745f9843da6a92.zip hqemu-f22d85e9e67262db34504f4079745f9843da6a92.tar.gz |
qemu-ga: add a whitelist for fsfreeze-safe commands
Currently we rely on fsfreeze/thaw commands disabling/enabling logging
then having other commands check whether logging is disabled to avoid
executing if they aren't safe for running while a filesystem is frozen.
Instead, have an explicit whitelist of fsfreeze-safe commands, and
consolidate logging and command enablement/disablement into a pair
of helper functions: ga_set_frozen()/ga_unset_frozen()
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'qapi/qmp-registry.c')
-rw-r--r-- | qapi/qmp-registry.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/qapi/qmp-registry.c b/qapi/qmp-registry.c index 25c89ad..43d5cde 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; |