[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v1][ 13/21] qapi: add command registration/lookup fu
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH v1][ 13/21] qapi: add command registration/lookup functions |
Date: |
Wed, 1 Jun 2011 12:24:41 -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 | 27 +++++++++++++++++++++++++++
1 files changed, 27 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..f870244
--- /dev/null
+++ b/qapi/qmp-registry.c
@@ -0,0 +1,27 @@
+#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);
+}
+
+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][ 11/21] qapi: add QMP output visiter, (continued)
- [Qemu-devel] [PATCH v1][ 11/21] qapi: add QMP output visiter, Michael Roth, 2011/06/01
- [Qemu-devel] [PATCH v1][ 09/21] qapi: add qapi-visit-core.h, Michael Roth, 2011/06/01
- [Qemu-devel] [PATCH v1][ 21/21] qapi: add QAPI code generation documentation, Michael Roth, 2011/06/01
- [Qemu-devel] [PATCH v1][ 08/21] qapi: add qapi-types-core.h, Michael Roth, 2011/06/01
- [Qemu-devel] [PATCH v1][ 20/21] qapi: Makefile changes to build test-qmp-commands, Michael Roth, 2011/06/01
- [Qemu-devel] [PATCH v1][ 02/21] qlist: add qlist_first()/qlist_next(), Michael Roth, 2011/06/01
- [Qemu-devel] [PATCH v1][ 01/21] Add hard build dependency on glib, Michael Roth, 2011/06/01
- [Qemu-devel] [PATCH v1][ 07/21] qapi: add qapi-commands.py code generator, Michael Roth, 2011/06/01
- [Qemu-devel] [PATCH v1][ 03/21] qapi: add module init types for qapi, Michael Roth, 2011/06/01
- [Qemu-devel] [PATCH v1][ 13/21] qapi: add command registration/lookup functions,
Michael Roth <=
- [Qemu-devel] [PATCH v1][ 04/21] qapi: add ordereddict/qapi.py helper libraries, Michael Roth, 2011/06/01
- [Qemu-devel] [PATCH v1][ 14/21] qapi: add QMP dispatch functions, Michael Roth, 2011/06/01
- [Qemu-devel] [PATCH v1][ 12/21] qapi: add QAPI dealloc visiter, Michael Roth, 2011/06/01
- [Qemu-devel] [PATCH v1][ 19/21] qapi: add test-qmp-commands, tests for gen. marshalling/dispatch code, Michael Roth, 2011/06/01