[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v1][ 16/23] qapi: add command registration/lookup fu
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH v1][ 16/23] qapi: add command registration/lookup functions |
Date: |
Tue, 17 May 2011 19:52:03 -0500 |
Registration/lookup functions for that provide a lookup table for
dispatching QMP commands.
Signed-off-by: Michael Roth <address@hidden>
---
qapi/qmp-registry.c | 38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
create mode 100644 qapi/qmp-registry.c
diff --git a/qapi/qmp-registry.c b/qapi/qmp-registry.c
new file mode 100644
index 0000000..06811ec
--- /dev/null
+++ b/qapi/qmp-registry.c
@@ -0,0 +1,38 @@
+#include "qapi/qmp-core.h"
+
+static QTAILQ_HEAD(, QmpCommand) qmp_commands =
+ QTAILQ_HEAD_INITIALIZER(qmp_commands);
+
+void qmp_register_command(const char *name, QmpCommandFunc *fn)
+{
+ QmpCommand *cmd = qemu_mallocz(sizeof(*cmd));
+
+ cmd->name = name;
+ cmd->type = QCT_NORMAL;
+ cmd->fn = fn;
+ QTAILQ_INSERT_TAIL(&qmp_commands, cmd, node);
+}
+
+void qmp_register_proxy_command(const char *name, QmpProxyCommandFunc *fn,
QmpProxyCompletionFunc *cb)
+{
+ QmpCommand *cmd = qemu_mallocz(sizeof(*cmd));
+
+ cmd->name = name;
+ cmd->type = QCT_PROXY;
+ //cmd->fn = fn;
+ cmd->pfn = fn;
+ QTAILQ_INSERT_TAIL(&qmp_commands, cmd, node);
+}
+
+QmpCommand *qmp_find_command(const char *name)
+{
+ QmpCommand *i;
+
+ QTAILQ_FOREACH(i, &qmp_commands, node) {
+ if (strcmp(i->name, name) == 0) {
+ return i;
+ }
+ }
+ return NULL;
+}
+
--
1.7.0.4
- [Qemu-devel] [PATCH v1][ 07/23] qapi: add ordereddict/qapi.py helper libraries, (continued)
- [Qemu-devel] [PATCH v1][ 07/23] qapi: add ordereddict/qapi.py helper libraries, Michael Roth, 2011/05/17
- [Qemu-devel] [PATCH v1][ 06/23] qapi: add module init types for qapi, Michael Roth, 2011/05/17
- [Qemu-devel] [PATCH v1][ 08/23] qapi: add qapi-types.py code generator, Michael Roth, 2011/05/17
- [Qemu-devel] [PATCH v1][ 09/23] qapi: add qapi-visit.py code generator, Michael Roth, 2011/05/17
- [Qemu-devel] [PATCH v1][ 10/23] qapi: add qapi-commands.py code generator, Michael Roth, 2011/05/17
- [Qemu-devel] [PATCH v1][ 11/23] qapi: add qapi-types-core.h, Michael Roth, 2011/05/17
- [Qemu-devel] [PATCH v1][ 12/23] qapi: add qapi-visit-core.h, Michael Roth, 2011/05/17
- [Qemu-devel] [PATCH v1][ 15/23] qapi: add QAPI dealloc visiter, Michael Roth, 2011/05/17
- [Qemu-devel] [PATCH v1][ 13/23] qapi: add QMP input visiter, Michael Roth, 2011/05/17
- [Qemu-devel] [PATCH v1][ 16/23] qapi: add command registration/lookup functions,
Michael Roth <=
- [Qemu-devel] [PATCH v1][ 14/23] qapi: add QMP output visiter, Michael Roth, 2011/05/17
- [Qemu-devel] [PATCH v1][ 17/23] qapi: add QMP dispatch functions, Michael Roth, 2011/05/17
- [Qemu-devel] [PATCH v1][ 19/23] qapi: test schema used for unit tests, Michael Roth, 2011/05/17
- [Qemu-devel] [PATCH v1][ 20/23] qapi: add test-visiter, tests for gen. visiter code, Michael Roth, 2011/05/17
- [Qemu-devel] [PATCH v1][ 21/23] qapi: Makefile changes to build test-visiter, Michael Roth, 2011/05/17
- [Qemu-devel] [PATCH v1][ 18/23] qapi: add base declaration/types for QMP, Michael Roth, 2011/05/17
- [Qemu-devel] [PATCH v1][ 22/23] qapi: add test-qmp-commands, tests for gen. marshalling/dispatch code, Michael Roth, 2011/05/17
- [Qemu-devel] [PATCH v1][ 23/23] qapi: Makefile changes to build test-qmp-commands, Michael Roth, 2011/05/17