[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 16/26] qapi: add conditions to VNC type/commands
From: |
Dr. David Alan Gilbert |
Subject: |
Re: [Qemu-devel] [PATCH 16/26] qapi: add conditions to VNC type/commands/events on the schema |
Date: |
Fri, 28 Jul 2017 20:00:25 +0100 |
User-agent: |
Mutt/1.8.3 (2017-05-23) |
* Marc-André Lureau (address@hidden) wrote:
> Add #if defined(CONFIG_VNC) in generated code, and adjust the
> qmp/hmp code accordingly.
>
> Signed-off-by: Marc-André Lureau <address@hidden>
> diff --git a/hmp.c b/hmp.c
> index fd80dce758..9454c634bd 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -605,6 +605,7 @@ void hmp_info_blockstats(Monitor *mon, const QDict *qdict)
> qapi_free_BlockStatsList(stats_list);
> }
>
> +#ifdef CONFIG_VNC
> /* Helper for hmp_info_vnc_clients, _servers */
> static void hmp_info_VncBasicInfo(Monitor *mon, VncBasicInfo *info,
> const char *name)
> @@ -692,6 +693,12 @@ void hmp_info_vnc(Monitor *mon, const QDict *qdict)
> qapi_free_VncInfo2List(info2l);
>
> }
> +#else
> +void hmp_info_vnc(Monitor *mon, const QDict *qdict)
> +{
> + warn_report("VNC support is disabled");
> +}
> +#endif
I'm OK with this, so
Acked-by: Dr. David Alan Gilbert <address@hidden>
although you might just be able to add a #ifdef in hmp-commands-info.hx
and avoid the is disabled function, or you might find that with the QMP
returning an error the HMP just passes that error on.
Dave
> #ifdef CONFIG_SPICE
> void hmp_info_spice(Monitor *mon, const QDict *qdict)
> @@ -1708,12 +1715,14 @@ void hmp_eject(Monitor *mon, const QDict *qdict)
> hmp_handle_error(mon, &err);
> }
>
> +#ifdef CONFIG_VNC
> static void hmp_change_read_arg(void *opaque, const char *password,
> void *readline_opaque)
> {
> qmp_change_vnc_password(password, NULL);
> monitor_read_command(opaque, 1);
> }
> +#endif
>
> void hmp_change(Monitor *mon, const QDict *qdict)
> {
> @@ -1724,6 +1733,7 @@ void hmp_change(Monitor *mon, const QDict *qdict)
> BlockdevChangeReadOnlyMode read_only_mode = 0;
> Error *err = NULL;
>
> +#ifdef CONFIG_VNC
> if (strcmp(device, "vnc") == 0) {
> if (read_only) {
> monitor_printf(mon,
> @@ -1738,7 +1748,9 @@ void hmp_change(Monitor *mon, const QDict *qdict)
> }
> }
> qmp_change("vnc", target, !!arg, arg, &err);
> - } else {
> + } else
> +#endif
> + {
> if (read_only) {
> read_only_mode =
> qapi_enum_parse(BlockdevChangeReadOnlyMode_lookup,
> diff --git a/qmp.c b/qmp.c
> index b86201e349..2c90dacb56 100644
> --- a/qmp.c
> +++ b/qmp.c
> @@ -130,22 +130,6 @@ void qmp_cpu_add(int64_t id, Error **errp)
> }
> }
>
> -#ifndef CONFIG_VNC
> -/* If VNC support is enabled, the "true" query-vnc command is
> - defined in the VNC subsystem */
> -VncInfo *qmp_query_vnc(Error **errp)
> -{
> - error_setg(errp, QERR_FEATURE_DISABLED, "vnc");
> - return NULL;
> -};
> -
> -VncInfo2List *qmp_query_vnc_servers(Error **errp)
> -{
> - error_setg(errp, QERR_FEATURE_DISABLED, "vnc");
> - return NULL;
> -};
> -#endif
> -
> #ifndef CONFIG_SPICE
> /*
> * qmp-commands.hx ensures that QMP command query-spice exists only
> @@ -403,23 +387,17 @@ static void qmp_change_vnc(const char *target, bool
> has_arg, const char *arg,
> qmp_change_vnc_listen(target, errp);
> }
> }
> -#else
> -void qmp_change_vnc_password(const char *password, Error **errp)
> -{
> - error_setg(errp, QERR_FEATURE_DISABLED, "vnc");
> -}
> -static void qmp_change_vnc(const char *target, bool has_arg, const char *arg,
> - Error **errp)
> -{
> - error_setg(errp, QERR_FEATURE_DISABLED, "vnc");
> -}
> #endif /* !CONFIG_VNC */
>
> void qmp_change(const char *device, const char *target,
> bool has_arg, const char *arg, Error **errp)
> {
> if (strcmp(device, "vnc") == 0) {
> +#ifdef CONFIG_VNC
> qmp_change_vnc(target, has_arg, arg, errp);
> +#else
> + error_setg(errp, QERR_FEATURE_DISABLED, "vnc");
> +#endif
> } else {
> qmp_blockdev_change_medium(true, device, false, NULL, target,
> has_arg, arg, false, 0, errp);
> --
> 2.14.0.rc0.1.g40ca67566
>
--
Dr. David Alan Gilbert / address@hidden / Manchester, UK
- [Qemu-devel] [PATCH 03/26] qboject: add literal qobject type, (continued)
- [Qemu-devel] [PATCH 03/26] qboject: add literal qobject type, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 04/26] qapi: generate a literal qobject for introspection, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 02/26] qobject: replace dump_qobject() by qobject_to_string(), Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 05/26] visitor: pass size of strings array to enum visitor, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 20/26] tests/qmp-test: add query-qmp-schema test, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 22/26] qapi: make rtc-reset-reinjection depend on TARGET_I386, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 19/26] build-sys: move qapi variables in qapi.mak, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 13/26] qapi2texi: add 'If:' condition to enum values, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 23/26] qapi: make s390 commands depend on TARGET_S390X, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 16/26] qapi: add conditions to VNC type/commands/events on the schema, Marc-André Lureau, 2017/07/27
- Re: [Qemu-devel] [PATCH 16/26] qapi: add conditions to VNC type/commands/events on the schema,
Dr. David Alan Gilbert <=
- [Qemu-devel] [PATCH 08/26] qapi: add 'if' condition on enum member values, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 24/26] qapi: make query-gic-capabilities depend on TARGET_ARM, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 15/26] qapi2texi: add condition to variants, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 12/26] qapi2texi: add 'If:' section to generated documentation, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 21/26] build-sys: make qemu qapi objects per-target, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 14/26] qapi2texi: add 'If:' condition to struct members, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 09/26] qapi: add 'if' condition on struct member, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 18/26] qapi: add conditions to REPLICATION type/commands on the schema, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 06/26] qapi2texi: minor python code simplification, Marc-André Lureau, 2017/07/27
- [Qemu-devel] [PATCH 01/26] qapi: fix type_seen key error, Marc-André Lureau, 2017/07/27