qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	qemu-devel@nongnu.org, "Markus Armbruster" <armbru@redhat.com>
Subject: Re: [PATCH 02/14] spice: add QemuSpiceOps, move migrate_info
Date: Mon, 19 Oct 2020 11:17:07 +0100	[thread overview]
Message-ID: <20201019101707.GD3565@work-vm> (raw)
In-Reply-To: <20201019075224.14803-3-kraxel@redhat.com>

* Gerd Hoffmann (kraxel@redhat.com) wrote:
> Add QemuSpiceOps struct.  This struct holds function pointers to the
> spice functions.  It will be initialized with pointers to the stub
> functions.  When spice gets initialized the function pointers will
> be re-written to the real functions.
> 
> The spice stubs will move from qemu-spice.h to spice-module.c for that,
> because they will be needed for both "CONFIG_SPICE=n" and "CONFIG_SPICE=y
> but spice module not loaded" cases.
> 
> This patch adds the infrastructure and starts with moving
> qemu_spice_migrate_info() to QemuSpiceOps.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  include/ui/qemu-spice-module.h |  5 +++++
>  include/ui/qemu-spice.h        |  5 -----
>  monitor/misc.c                 |  2 +-
>  ui/spice-core.c                |  5 +++++
>  ui/spice-module.c              | 10 ++++++++++
>  5 files changed, 21 insertions(+), 6 deletions(-)
> 
> diff --git a/include/ui/qemu-spice-module.h b/include/ui/qemu-spice-module.h
> index 1af0e659a109..7a9963dd5810 100644
> --- a/include/ui/qemu-spice-module.h
> +++ b/include/ui/qemu-spice-module.h
> @@ -18,6 +18,11 @@
>  #ifndef QEMU_SPICE_MODULE_H
>  #define QEMU_SPICE_MODULE_H
>  
> +struct QemuSpiceOps {
> +    int (*migrate_info)(const char *h, int p, int t, const char *s);
> +};
> +

I realise that's mostly a move, but if you need to repost, can you
expand those 4 single character parameter names?

Dave

>  extern int using_spice;
> +extern struct QemuSpiceOps qemu_spice;
>  
>  #endif
> diff --git a/include/ui/qemu-spice.h b/include/ui/qemu-spice.h
> index ab523788b9a9..3157016c2bb4 100644
> --- a/include/ui/qemu-spice.h
> +++ b/include/ui/qemu-spice.h
> @@ -60,11 +60,6 @@ static inline int qemu_spice_set_pw_expire(time_t expires)
>  {
>      return -1;
>  }
> -static inline int qemu_spice_migrate_info(const char *h, int p, int t,
> -                                          const char *s)
> -{
> -    return -1;
> -}
>  
>  static inline int qemu_spice_display_add_client(int csock, int skipauth,
>                                                  int tls)
> diff --git a/monitor/misc.c b/monitor/misc.c
> index 4a859fb24a21..32e6a8c13d07 100644
> --- a/monitor/misc.c
> +++ b/monitor/misc.c
> @@ -437,7 +437,7 @@ void qmp_client_migrate_info(const char *protocol, const char *hostname,
>              return;
>          }
>  
> -        if (qemu_spice_migrate_info(hostname,
> +        if (qemu_spice.migrate_info(hostname,
>                                      has_port ? port : -1,
>                                      has_tls_port ? tls_port : -1,
>                                      cert_subject)) {
> diff --git a/ui/spice-core.c b/ui/spice-core.c
> index a7fa5743585f..b03d743cf9b9 100644
> --- a/ui/spice-core.c
> +++ b/ui/spice-core.c
> @@ -993,8 +993,13 @@ int qemu_spice_display_is_running(SimpleSpiceDisplay *ssd)
>      return spice_display_is_running;
>  }
>  
> +static struct QemuSpiceOps real_spice_ops = {
> +    .migrate_info = qemu_spice_migrate_info,
> +};
> +
>  static void spice_register_config(void)
>  {
> +    qemu_spice = real_spice_ops;
>      qemu_add_opts(&qemu_spice_opts);
>  }
>  opts_init(spice_register_config);
> diff --git a/ui/spice-module.c b/ui/spice-module.c
> index f86b0ac517dc..f1939545a684 100644
> --- a/ui/spice-module.c
> +++ b/ui/spice-module.c
> @@ -21,3 +21,13 @@
>  #include "ui/qemu-spice-module.h"
>  
>  int using_spice;
> +
> +static int qemu_spice_migrate_info_stub(const char *h, int p, int t,
> +                                        const char *s)
> +{
> +    return -1;
> +}
> +
> +struct QemuSpiceOps qemu_spice = {
> +    .migrate_info = qemu_spice_migrate_info_stub,
> +};
> -- 
> 2.27.0
> 
-- 
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK



  reply	other threads:[~2020-10-19 10:18 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-19  7:52 [PATCH 00/14] ui: build spice and opengl as module Gerd Hoffmann
2020-10-19  7:52 ` [PATCH 01/14] spice: add module helpers Gerd Hoffmann
2020-10-19  7:52 ` [PATCH 02/14] spice: add QemuSpiceOps, move migrate_info Gerd Hoffmann
2020-10-19 10:17   ` Dr. David Alan Gilbert [this message]
2020-10-19  7:52 ` [PATCH 03/14] spice: move qemu_spice_init() to QemuSpiceOps Gerd Hoffmann
2020-10-19  7:52 ` [PATCH 04/14] spice: move display_init() " Gerd Hoffmann
2020-10-19  7:52 ` [PATCH 05/14] spice: move add_interface() " Gerd Hoffmann
2020-10-19  7:52 ` [PATCH 06/14] spice: move auth functions " Gerd Hoffmann
2020-10-19  7:52 ` [PATCH 07/14] spice: move display_add_client() " Gerd Hoffmann
2020-10-19  7:52 ` [PATCH 08/14] spice: wire up monitor in QemuSpiceOps Gerd Hoffmann
2020-10-19  7:52 ` [PATCH 09/14] spice: load module when enabled on the cmdline Gerd Hoffmann
2020-10-19  7:52 ` [PATCH 10/14] modules: dependencies infrastructure Gerd Hoffmann
2020-10-19  7:52 ` [PATCH 11/14] modules: add spice dependencies Gerd Hoffmann
2020-10-19  7:52 ` [PATCH 12/14] spice: flip modules switch Gerd Hoffmann
2020-10-19  7:52 ` [PATCH 13/14] opengl: build egl-headless display modular Gerd Hoffmann
2020-10-19  7:52 ` [PATCH 14/14] opengl: build opengl helper code modular Gerd Hoffmann
2020-10-20  9:59 ` [PATCH 00/14] ui: build spice and opengl as module Marc-André Lureau
2020-10-26 16:27 ` Bruce Rogers
2020-10-27  5:58   ` Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201019101707.GD3565@work-vm \
    --to=dgilbert@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).