[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 04/15] monitor: remove usage of generated mar
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH v3 04/15] monitor: remove usage of generated marshal functions |
Date: |
Tue, 09 Aug 2016 10:36:51 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
address@hidden writes:
> From: Marc-André Lureau <address@hidden>
>
> Once the middle mode is removed, the generated marshal functions will no
> longer be exported.
>
> Signed-off-by: Marc-André Lureau <address@hidden>
> Reviewed-by: Eric Blake <address@hidden>
> ---
> monitor.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/monitor.c b/monitor.c
> index c9191e5..3a4a533 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -3659,21 +3659,21 @@ static int monitor_can_read(void *opaque)
> return (mon->suspend_cnt == 0) ? 1 : 0;
> }
>
> -static bool invalid_qmp_mode(const Monitor *mon, const mon_cmd_t *cmd,
> +static bool invalid_qmp_mode(const Monitor *mon, const char *cmd,
> Error **errp)
> {
> - bool is_cap = cmd->mhandler.cmd_new == qmp_marshal_qmp_capabilities;
> + bool is_cap = g_str_equal(cmd, "qmp_capabilities");
We usually do !strcmp(...). The negation is somewhat error-prone, which
is why some people argue for using g_str_equal() instead. Okay.
>
> if (is_cap && mon->qmp.in_command_mode) {
> error_set(errp, ERROR_CLASS_COMMAND_NOT_FOUND,
> "Capabilities negotiation is already complete, command "
> - "'%s' ignored", cmd->name);
> + "'%s' ignored", cmd);
> return true;
> }
> if (!is_cap && !mon->qmp.in_command_mode) {
> error_set(errp, ERROR_CLASS_COMMAND_NOT_FOUND,
> "Expecting capabilities negotiation with "
> - "'qmp_capabilities' before command '%s'", cmd->name);
> + "'qmp_capabilities' before command '%s'", cmd);
> return true;
> }
> return false;
> @@ -3964,7 +3964,7 @@ static void handle_qmp_command(JSONMessageParser
> *parser, GQueue *tokens)
> "The command %s has not been found", cmd_name);
> goto err_out;
> }
> - if (invalid_qmp_mode(mon, cmd, &local_err)) {
> + if (invalid_qmp_mode(mon, cmd_name, &local_err)) {
> goto err_out;
> }
Patch is okay, but if we decide to keep things simple and give all
marshallers external linkage, it's unnecessary.
- [Qemu-devel] [PATCH v3 00/15] qapi: remove the 'middle' mode, marcandre . lureau, 2016/08/08
- [Qemu-devel] [PATCH v3 01/15] qapi-schema: use generated marshaller for 'qmp_capabilities', marcandre . lureau, 2016/08/08
- [Qemu-devel] [PATCH v3 02/15] qapi-schema: add 'device_add', marcandre . lureau, 2016/08/08
- [Qemu-devel] [PATCH v3 03/15] monitor: register gen:false commands manually, marcandre . lureau, 2016/08/08
- [Qemu-devel] [PATCH v3 04/15] monitor: remove usage of generated marshal functions, marcandre . lureau, 2016/08/08
- Re: [Qemu-devel] [PATCH v3 04/15] monitor: remove usage of generated marshal functions,
Markus Armbruster <=
- [Qemu-devel] [PATCH v3 05/15] qapi: add 'export-marshal' command key, marcandre . lureau, 2016/08/08
- [Qemu-devel] [PATCH v3 06/15] monitor: register the qapi generated commands, marcandre . lureau, 2016/08/08
- [Qemu-devel] [PATCH v3 07/15] monitor: remove mhandler.cmd_new, marcandre . lureau, 2016/08/08
- [Qemu-devel] [PATCH v3 08/15] monitor: implement 'qmp_query_commands' without qmp_cmds, marcandre . lureau, 2016/08/08
- [Qemu-devel] [PATCH v3 09/15] qapi: remove the "middle" mode, marcandre . lureau, 2016/08/08
- [Qemu-devel] [PATCH v3 10/15] qapi: check invalid arguments on no-args commands, marcandre . lureau, 2016/08/08