[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 7/7] spice: Call qemu spice functions indirectly
From: |
Gerd Hoffmann |
Subject: |
Re: [PATCH 7/7] spice: Call qemu spice functions indirectly |
Date: |
Tue, 4 Aug 2020 12:18:21 +0200 |
Hi,
These stubs (picked two examples) ...
> -static inline int qemu_spice_set_passwd(const char *passwd,
> - bool fail_if_connected,
> - bool disconnect_if_connected)
> -{
> - return -1;
> -}
> -static inline void qemu_spice_display_init(void)
> -{
> - /* This must never be called if CONFIG_SPICE is disabled */
> - error_report("spice support is disabled");
> - abort();
> -}
... can simply be moved to this place ...
> --- a/softmmu/vl.c
> +++ b/softmmu/vl.c
> @@ -173,6 +173,30 @@ int icount_align_option;
> QemuUUID qemu_uuid;
> bool qemu_uuid_set;
>
> +static bool qemu_is_not_using_spice(void)
> +{
> + return 0;
> +}
> +
> +static void qemu_spice_init_no_op(void)
> +{
> +}
(I'd suggest to name this qemu_spice_display_init_stub)
> +
> +/*
> + * Only two fields are initialized, that can be used even when SPICE
> + * is not configured or not loaded. Other functions are protected by
> + * checking if using_spice.
> + */
> +QemuSpiceOps qemu_spice = {
> + .in_use = qemu_is_not_using_spice,
> + .init = qemu_spice_init_no_op,
... and hooked up here, i.e.
.init = qemu_spice_display_init_stub,
.set_passwd = qemu_spice_set_passwd_stub,
[ ... ]
Also I'd suggest to place the code in a new file (maybe named
ui/spice-ops.c, or ui/spice-stubs.c) which is compiled into qemu
unconditionally.
take care,
Gerd
- Re: [PATCH 7/7] spice: Call qemu spice functions indirectly,
Gerd Hoffmann <=