Re: [PATCH spice-gtk 5/5] Teach spicy to use a NBD channel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi


On Thu, Jun 6, 2013 at 12:36 AM, Alon Levy <alevy@xxxxxxxxxx> wrote:
>
> @@ -1475,6 +1543,7 @@ static void port_opened(SpiceChannel *channel,
> GParamSpec *pspec,
>          /* only send a break event and disconnect */
>          if (g_strcmp0(name, "org.spice.spicy.break") == 0) {
>              spice_port_event(port, SPICE_PORT_EVENT_BREAK);
> +            spice_channel_flush_async(channel, NULL, port_flushed_cb, conn);

Here, and

>          }
>
>          /* handle the first spicy port and connect it to stdin/out */
> @@ -1486,7 +1555,6 @@ static void port_opened(SpiceChannel *channel,
> GParamSpec *pspec,
>          if (port == stdin_port)
>              goto end;
>
> -        spice_channel_flush_async(channel, NULL, port_flushed_cb, conn);

Here.

 
This is because that code was treating any Spice port and flushing it. But this conflict with SpiceNbd channel, which are SpicePort too. So I just moved the flush where it belonged.


>      } else {
>          if (port == stdin_port)
>              stdin_port = NULL;
> @@ -1565,6 +1633,15 @@ static void channel_new(SpiceSession *s, SpiceChannel
> *channel, gpointer data)
>                           G_CALLBACK(port_data), conn);
>          spice_channel_connect(channel);
>      }
> +
> +    if (SPICE_IS_NBD_CHANNEL(channel)) {
> +        SpiceNbdChannel *nbd = SPICE_NBD_CHANNEL(channel);
> +        update_nbd_sensitive(conn);
> +        SPICE_DEBUG("new nbd channel");
> +        conn->nbd_channel = nbd;
> +        spice_channel_connect(channel);
> +        update_nbd_export(conn, nbd_file);
> +    }
>  }
>
>  static void channel_destroy(SpiceSession *s, SpiceChannel *channel, gpointer
>  data)
> @@ -1593,6 +1670,10 @@ static void channel_destroy(SpiceSession *s,
> SpiceChannel *channel, gpointer dat
>          update_auto_usbredir_sensitive(conn);
>      }
>
> +    if (SPICE_IS_NBD_CHANNEL(channel)) {
> +        update_nbd_sensitive(conn);
> +    }
> +
>      if (SPICE_IS_PORT_CHANNEL(channel)) {
>          if (SPICE_PORT_CHANNEL(channel) == stdin_port)
>              stdin_port = NULL;
> @@ -1693,6 +1774,12 @@ static GOptionEntry cmd_entries[] = {
>          .description      = N_("Set the window title"),
>          .arg_description  = N_("<title>"),
>      },{
> +        .long_name        = "nbd-file",
> +        .arg              = G_OPTION_ARG_FILENAME,
> +        .arg_data         = &nbd_file,
> +        .description      = N_("image file (for NBD channels)"),
> +        .arg_description  = N_("<FILE>"),
> +    },{
>          /* end of list */
>      }
>  };
> @@ -1888,6 +1975,7 @@ int main(int argc, char *argv[])
>      g_key_file_free(keyfile);
>
>      g_free(spicy_title);
> +    g_free(nbd_file);
>
>      setup_terminal(true);
>      return 0;
> --
> 1.8.3.rc1.49.g8d97506
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>



--
Marc-André Lureau
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]