[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v1][ 17/23] qapi: add QMP dispatch functions
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH v1][ 17/23] qapi: add QMP dispatch functions |
Date: |
Wed, 18 May 2011 09:58:44 +0100 |
On Wed, May 18, 2011 at 1:52 AM, Michael Roth <address@hidden> wrote:
> Given an object recieved via QMP, this code uses the dispatch table
> provided by qmp_registry.c to call the corresponding marshalling/dispatch
> function and format return values/errors for delivery to the QMP.
> Currently only synchronous QMP functions are supported, but this will
> also be used for async QMP functions and QMP guest proxy dispatch as
> well.
>
> Signed-off-by: Michael Roth <address@hidden>
> ---
> qapi/qmp-dispatch.c | 104
> +++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 104 insertions(+), 0 deletions(-)
> create mode 100644 qapi/qmp-dispatch.c
>
> diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c
> new file mode 100644
> index 0000000..733decf
> --- /dev/null
> +++ b/qapi/qmp-dispatch.c
> @@ -0,0 +1,104 @@
> +#include <glib.h>
> +#include "qemu-objects.h"
> +#include "qapi/qmp-core.h"
> +#include "json-parser.h"
> +
> +static QObject *qmp_dispatch_err(QmpState *state, QObject *request, Error
> **errp)
> +{
> + const char *command;
> + QDict *args, *dict;
> + //QObject *request;
> + QmpCommand *cmd;
> + QObject *ret = NULL;
> + //Error *err = NULL;
Please remove commented out lines, it makes the code noisy.
> + case QCT_ASYNC: {
> + QmpCommandState *s = qemu_mallocz(sizeof(*s));
> + // FIXME save async commands and do something
> + // smart if disconnect occurs before completion
> + s->state = state;
> + s->tag = NULL;
> + if (qdict_haskey(dict, "tag")) {
> + s->tag = qdict_get(dict, "tag");
> + qobject_incref(s->tag);
> + }
> + cmd->afn(args, errp, s);
async_fn() would be a clear name.
> + ret = NULL;
It is already NULL.
> + }
> + break;
> + case QCT_PROXY: {
> + QmpCommandState *s = qemu_mallocz(sizeof(*s));
> + // FIXME save async commands and do something
> + // smart if disconnect occurs before completion
> + s->state = state;
> + s->tag = NULL;
> + if (qdict_haskey(dict, "tag")) {
> + s->tag = qdict_get(dict, "tag");
> + qobject_incref(s->tag);
> + }
> + cmd->pfn(args, errp, s);
> + ret = NULL;
Same comments as for async.
Stefan
- [Qemu-devel] [PATCH v1][ 10/23] qapi: add qapi-commands.py code generator, (continued)
- [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, 2011/05/17
- [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
- Re: [Qemu-devel] [PATCH v1][ 17/23] qapi: add QMP dispatch functions,
Stefan Hajnoczi <=
- [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
- Re: [Qemu-devel] [PATCH v1 00/23] QAPI Infrastructure Round 1, Luiz Capitulino, 2011/05/18