Signed-off-by: Markus Armbruster <arm...@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lur...@redhat.com>
Message-Id: <20160912091913.15831-7-marcandre.lur...@redhat.com>
---
 include/qapi/qmp/dispatch.h | 1 +
 qapi/qmp-registry.c         | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/include/qapi/qmp/dispatch.h b/include/qapi/qmp/dispatch.h
index 48c11b6..57651ea 100644
--- a/include/qapi/qmp/dispatch.h
+++ b/include/qapi/qmp/dispatch.h
@@ -36,6 +36,7 @@ typedef struct QmpCommand
 
 void qmp_register_command(const char *name, QmpCommandFunc *fn,
                           QmpCommandOptions options);
+void qmp_unregister_command(const char *name);
 QmpCommand *qmp_find_command(const char *name);
 QObject *qmp_dispatch(QObject *request);
 void qmp_disable_command(const char *name);
diff --git a/qapi/qmp-registry.c b/qapi/qmp-registry.c
index 68b24c9..e805368 100644
--- a/qapi/qmp-registry.c
+++ b/qapi/qmp-registry.c
@@ -30,6 +30,14 @@ void qmp_register_command(const char *name, QmpCommandFunc 
*fn,
     QTAILQ_INSERT_TAIL(&qmp_commands, cmd, node);
 }
 
+void qmp_unregister_command(const char *name)
+{
+    QmpCommand *cmd = qmp_find_command(name);
+
+    QTAILQ_REMOVE(&qmp_commands, cmd, node);
+    g_free(cmd);
+}
+
 QmpCommand *qmp_find_command(const char *name)
 {
     QmpCommand *cmd;
-- 
2.5.5


Reply via email to