[Spice-devel] [RFC PATCH spice 0.8 02/19] server: handle migration interface addition

Alon Levy alevy at redhat.com
Mon Sep 19 07:55:55 PDT 2011


On Mon, Sep 19, 2011 at 12:46:55PM +0300, Yonit Halperin wrote:
> 
> Signed-off-by: Yonit Halperin <yhalperi at redhat.com>
> ---
>  server/reds.c |   15 +++++++++++++++
>  server/reds.h |    4 ++++
>  2 files changed, 19 insertions(+), 0 deletions(-)
> 
> diff --git a/server/reds.c b/server/reds.c
> index f082c53..05ebf6e 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -73,6 +73,7 @@ static SpiceKbdInstance *keyboard = NULL;
>  static SpiceMouseInstance *mouse = NULL;
>  static SpiceTabletInstance *tablet = NULL;
>  static SpiceCharDeviceInstance *vdagent = NULL;
> +static SpiceMigrateInstance *migration_interface = NULL;
>  
>  #define MIGRATION_NOTIFY_SPICE_KEY "spice_mig_ext"
>  
> @@ -4345,6 +4346,20 @@ SPICE_GNUC_VISIBLE int spice_server_add_interface(SpiceServer *s,
>          red_printf("unsupported net wire interface");
>          return -1;
>  #endif
> +    } else if (strcmp(interface->type, SPICE_INTERFACE_MIGRATION) == 0) {
> +        red_printf("SPICE_INTERFACE_MIGRATION");
> +        if (migration_interface) {
> +            red_printf("already have migration");
> +            return -1;
> +        }
> +
> +        if (interface->major_version != SPICE_INTERFACE_MIGRATION_MAJOR ||
> +            interface->minor_version > SPICE_INTERFACE_MIGRATION_MINOR) {
> +            red_printf("unsupported migration interface");
> +            return -1;
> +        }
> +        migration_interface = SPICE_CONTAINEROF(sin, SpiceMigrateInstance, base);
> +        migration_interface->st = spice_new0(SpiceMigrateState, 1);

Please update the corresponding spice_server_remove_interface. Not sure if it we
actually free any of the other interfaces so I don't want you to check for that here
as a requirement for this patch, but at least the remove should cover the case.

>      }
>  
>      return 0;
> diff --git a/server/reds.h b/server/reds.h
> index 463c94f..b60681a 100644
> --- a/server/reds.h
> +++ b/server/reds.h
> @@ -119,6 +119,10 @@ struct SpiceNetWireState {
>      struct TunnelWorker *worker;
>  };
>  
> +struct SpiceMigrateState {
> +    int dummy;
> +};
> +
>  void reds_channel_dispose(Channel *channel);
>  
>  ssize_t reds_stream_read(RedsStream *s, void *buf, size_t nbyte);
> -- 
> 1.7.4.4
> 


More information about the Spice-devel mailing list