[Spice-devel] [PATCH spice] RFC: add the NBD channel

Marc-André Lureau marcandre.lureau at gmail.com
Wed Jun 5 08:35:40 PDT 2013


See spice.proto RFC
---
 server/reds.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/server/reds.c b/server/reds.c
index ae02e09..dd3005d 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -1455,7 +1455,8 @@ static int reds_send_link_ack(RedLinkInfo *link)
 
     ack.error = SPICE_LINK_ERR_OK;
 
-    channel = reds_find_channel(link->link_mess->channel_type, 0);
+    channel = reds_find_channel(link->link_mess->channel_type,
+                                link->link_mess->channel_id);
     if (!channel) {
         spice_assert(link->link_mess->channel_type == SPICE_CHANNEL_MAIN);
         spice_assert(reds->main_channel);
@@ -3610,6 +3611,7 @@ SPICE_GNUC_VISIBLE void spice_server_char_device_wakeup(SpiceCharDeviceInstance*
 #define SUBTYPE_SMARTCARD "smartcard"
 #define SUBTYPE_USBREDIR "usbredir"
 #define SUBTYPE_PORT "port"
+#define SUBTYPE_NBD "nbd"
 
 const char *spice_server_char_device_recognized_subtypes_list[] = {
     SUBTYPE_VDAGENT,
@@ -3617,6 +3619,7 @@ const char *spice_server_char_device_recognized_subtypes_list[] = {
     SUBTYPE_SMARTCARD,
 #endif
     SUBTYPE_USBREDIR,
+    SUBTYPE_NBD,
     NULL,
 };
 
@@ -3683,6 +3686,9 @@ static int spice_server_char_device_add_interface(SpiceServer *s,
     else if (strcmp(char_device->subtype, SUBTYPE_USBREDIR) == 0) {
         dev_state = spicevmc_device_connect(char_device, SPICE_CHANNEL_USBREDIR);
     }
+    else if (strcmp(char_device->subtype, SUBTYPE_NBD) == 0) {
+        dev_state = spicevmc_device_connect(char_device, SPICE_CHANNEL_NBD);
+    }
     else if (strcmp(char_device->subtype, SUBTYPE_PORT) == 0) {
         dev_state = spicevmc_device_connect(char_device, SPICE_CHANNEL_PORT);
     }
@@ -3719,6 +3725,7 @@ static void spice_server_char_device_remove_interface(SpiceBaseInstance *sin)
     }
 #endif
     else if (strcmp(char_device->subtype, SUBTYPE_USBREDIR) == 0 ||
+             strcmp(char_device->subtype, SUBTYPE_NBD) == 0 ||
              strcmp(char_device->subtype, SUBTYPE_PORT) == 0) {
         spicevmc_device_disconnect(char_device);
     } else {
@@ -4240,6 +4247,7 @@ SPICE_GNUC_VISIBLE int spice_server_set_channel_security(SpiceServer *s, const c
         [ SPICE_CHANNEL_SMARTCARD] = "smartcard",
 #endif
         [ SPICE_CHANNEL_USBREDIR ] = "usbredir",
+        [ SPICE_CHANNEL_NBD ] = "nbd",
     };
     int i;
 
-- 
1.8.3.rc1.49.g8d97506



More information about the Spice-devel mailing list