[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v12 03/18] qmp: Drop dead command->type
From: |
Eric Blake |
Subject: |
[Qemu-devel] [PATCH v12 03/18] qmp: Drop dead command->type |
Date: |
Mon, 29 Feb 2016 22:14:17 -0700 |
Ever since QMP was first added back in commit 43c20a43, we have
never had any QmpCommandType other than QCT_NORMAL. It's
pointless to carry around the cruft.
Signed-off-by: Eric Blake <address@hidden>
---
v12: new patch
---
include/qapi/qmp/dispatch.h | 6 ------
qapi/qmp-dispatch.c | 18 +++++++-----------
qapi/qmp-registry.c | 1 -
3 files changed, 7 insertions(+), 18 deletions(-)
diff --git a/include/qapi/qmp/dispatch.h b/include/qapi/qmp/dispatch.h
index 4955209..5609946 100644
--- a/include/qapi/qmp/dispatch.h
+++ b/include/qapi/qmp/dispatch.h
@@ -19,11 +19,6 @@
typedef void (QmpCommandFunc)(QDict *, QObject **, Error **);
-typedef enum QmpCommandType
-{
- QCT_NORMAL,
-} QmpCommandType;
-
typedef enum QmpCommandOptions
{
QCO_NO_OPTIONS = 0x0,
@@ -33,7 +28,6 @@ typedef enum QmpCommandOptions
typedef struct QmpCommand
{
const char *name;
- QmpCommandType type;
QmpCommandFunc *fn;
QmpCommandOptions options;
QTAILQ_ENTRY(QmpCommand) node;
diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c
index 8f27c34..072e092 100644
--- a/qapi/qmp-dispatch.c
+++ b/qapi/qmp-dispatch.c
@@ -93,17 +93,13 @@ static QObject *do_qmp_dispatch(QObject *request, Error
**errp)
QINCREF(args);
}
- switch (cmd->type) {
- case QCT_NORMAL:
- cmd->fn(args, &ret, &local_err);
- if (local_err) {
- error_propagate(errp, local_err);
- } else if (cmd->options & QCO_NO_SUCCESS_RESP) {
- g_assert(!ret);
- } else if (!ret) {
- ret = QOBJECT(qdict_new());
- }
- break;
+ cmd->fn(args, &ret, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ } else if (cmd->options & QCO_NO_SUCCESS_RESP) {
+ g_assert(!ret);
+ } else if (!ret) {
+ ret = QOBJECT(qdict_new());
}
QDECREF(args);
diff --git a/qapi/qmp-registry.c b/qapi/qmp-registry.c
index 4ebfbcc..4332a68 100644
--- a/qapi/qmp-registry.c
+++ b/qapi/qmp-registry.c
@@ -25,7 +25,6 @@ void qmp_register_command(const char *name, QmpCommandFunc
*fn,
QmpCommand *cmd = g_malloc0(sizeof(*cmd));
cmd->name = name;
- cmd->type = QCT_NORMAL;
cmd->fn = fn;
cmd->enabled = true;
cmd->options = options;
--
2.5.0
- [Qemu-devel] [PATCH v12 00/18] qapi visitor cleanups (post-introspection cleanups subset E), Eric Blake, 2016/03/01
- [Qemu-devel] [PATCH v12 03/18] qmp: Drop dead command->type,
Eric Blake <=
- [Qemu-devel] [PATCH v12 01/18] qapi-visit: Add visitor.type classification, Eric Blake, 2016/03/01
- [Qemu-devel] [PATCH v12 10/18] qmp: Support explicit null during visits, Eric Blake, 2016/03/01
- [Qemu-devel] [PATCH v12 05/18] qmp-input: Don't consume input when checking has_member, Eric Blake, 2016/03/01
- [Qemu-devel] [PATCH v12 07/18] qapi: Document visitor interfaces, add assertions, Eric Blake, 2016/03/01
- [Qemu-devel] [PATCH v12 02/18] qapi: Guarantee NULL obj on input visitor callback error, Eric Blake, 2016/03/01
- [Qemu-devel] [PATCH v12 12/18] qmp: Tighten output visitor rules, Eric Blake, 2016/03/01
- [Qemu-devel] [PATCH v12 14/18] qapi-commands: Wrap argument visit in visit_start_struct, Eric Blake, 2016/03/01
- [Qemu-devel] [PATCH v12 15/18] qom: Wrap prop visit in visit_start_struct, Eric Blake, 2016/03/01
- [Qemu-devel] [PATCH v12 16/18] qmp-input: Require struct push to visit members of top dict, Eric Blake, 2016/03/01
- [Qemu-devel] [PATCH v12 04/18] qmp-input: Clean up stack handling, Eric Blake, 2016/03/01