[Spice-devel] [PATCH 1/3] VDInterface: redesign.

Gerd Hoffmann kraxel at redhat.com
Tue Mar 30 03:10:40 PDT 2010


VDInterface has been renamed to SpiceBaseInterface. Dropped base_version
element, shlib versioning should be used instead.  Dropped id element,
it is passed to spice_server_add_interface() instead.  Now
SpiceBaseInterface has static information only, multiple interface
instances can share it.

Added SpiceInterfaceState struct for maintaining state information.
Adapted spice_server_{add,remove}_interface() functions to the new
world.

Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
---
 server/red_dispatcher.c |    8 +-
 server/red_dispatcher.h |    2 +-
 server/reds.c           |  335 ++++++++++++++++++++++++-----------------------
 server/reds.h           |    6 +
 server/snd_worker.c     |    6 +-
 server/spice.h          |    9 +-
 server/vd_interface.h   |   38 +++---
 7 files changed, 207 insertions(+), 197 deletions(-)

diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c
index 17bf24c..e71623f 100644
--- a/server/red_dispatcher.c
+++ b/server/red_dispatcher.c
@@ -455,7 +455,7 @@ uint32_t red_dispatcher_qxl_ram_size()
     return qxl_info.qxl_ram_size;
 }
 
-RedDispatcher *red_dispatcher_init(QXLInterface *qxl_interface)
+RedDispatcher *red_dispatcher_init(QXLInterface *qxl_interface, int id)
 {
     RedDispatcher *dispatcher;
     int channels[2];
@@ -486,7 +486,7 @@ RedDispatcher *red_dispatcher_init(QXLInterface *qxl_interface)
     dispatcher = spice_new0(RedDispatcher, 1);
     dispatcher->channel = channels[0];
     init_data.qxl_interface = dispatcher->qxl_interface = qxl_interface;
-    init_data.id = qxl_interface->base.id;
+    init_data.id = id;
     init_data.channel = channels[1];
     init_data.pending = &dispatcher->pending;
     init_data.num_renderers = num_renderers;
@@ -540,7 +540,7 @@ RedDispatcher *red_dispatcher_init(QXLInterface *qxl_interface)
 
     reds_channel = spice_new0(Channel, 1);
     reds_channel->type = SPICE_CHANNEL_DISPLAY;
-    reds_channel->id = qxl_interface->base.id;
+    reds_channel->id = id;
     reds_channel->link = red_dispatcher_set_peer;
     reds_channel->shutdown = red_dispatcher_shutdown_peer;
     reds_channel->migrate = red_dispatcher_migrate;
@@ -549,7 +549,7 @@ RedDispatcher *red_dispatcher_init(QXLInterface *qxl_interface)
 
     cursor_channel = spice_new0(Channel, 1);
     cursor_channel->type = SPICE_CHANNEL_CURSOR;
-    cursor_channel->id = qxl_interface->base.id;
+    cursor_channel->id = id;
     cursor_channel->link = red_dispatcher_set_cursor_peer;
     cursor_channel->shutdown = red_dispatcher_shutdown_cursor_peer;
     cursor_channel->migrate = red_dispatcher_cursor_migrate;
diff --git a/server/red_dispatcher.h b/server/red_dispatcher.h
index 9482bc4..15e3445 100644
--- a/server/red_dispatcher.h
+++ b/server/red_dispatcher.h
@@ -19,7 +19,7 @@
 #define _H_RED_DISPATCHER
 
 
-struct RedDispatcher *red_dispatcher_init(QXLInterface *qxl_interface);
+struct RedDispatcher *red_dispatcher_init(QXLInterface *qxl_interface, int id);
 
 void red_dispatcher_set_mm_time(uint32_t);
 void red_dispatcher_on_ic_change();
diff --git a/server/reds.c b/server/reds.c
index 867c11c..81cd299 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -357,7 +357,6 @@ typedef struct PingItem {
     int size;
 } PingItem;
 
-
 #define ZERO_BUF_SIZE 4096
 
 static uint8_t zero_page[ZERO_BUF_SIZE] = {0};
@@ -4035,159 +4034,181 @@ static void attach_to_red_agent(VDIPortInterface *interface)
     reds_send_agent_connected();
 }
 
-static void interface_change_notifier(void *opaque, VDInterface *interface,
-                                      VDInterfaceChangeType change)
+__visible__ SpiceInterfaceState *
+spice_server_add_interface(SpiceServer *s, SpiceBaseInterface *interface,
+                           int id, void *opaque)
 {
-    if (interface->base_version != VM_INTERFACE_VERSION) {
-        red_printf("unsuported base interface version");
-        return;
-    }
-    switch (change) {
-    case VD_INTERFACE_ADDING:
-        if (strcmp(interface->type, VD_INTERFACE_KEYBOARD) == 0) {
-            red_printf("VD_INTERFACE_KEYBOARD");
-            if (keyboard) {
-                red_printf("already have keyboard");
-                return;
-            }
-            if (interface->major_version != VD_INTERFACE_KEYBOARD_MAJOR ||
-                interface->minor_version < VD_INTERFACE_KEYBOARD_MINOR) {
-                red_printf("unsuported keyboard interface");
-                return;
-            }
-            keyboard = (KeyboardInterface *)interface;
-            if (keyboard->register_leds_notifier) {
-                if (!keyboard->register_leds_notifier(keyboard, reds_on_keyboard_leds_change, NULL)) {
-                    red_error("register leds notifier failed");
-                }
-            }
-        } else if (strcmp(interface->type, VD_INTERFACE_MOUSE) == 0) {
-            red_printf("VD_INTERFACE_MOUSE");
-            if (mouse) {
-                red_printf("already have mouse");
-                return;
-            }
-            if (interface->major_version != VD_INTERFACE_MOUSE_MAJOR ||
-                interface->minor_version < VD_INTERFACE_MOUSE_MINOR) {
-                red_printf("unsuported mouse interface");
-                return;
-            }
-            mouse = (MouseInterface *)interface;
-        } else if (strcmp(interface->type, VD_INTERFACE_MIGRATION) == 0) {
-            red_printf("VD_INTERFACE_MIGRATION");
-            if (mig) {
-                red_printf("already have migration");
-                return;
-            }
-            if (interface->major_version != VD_INTERFACE_MIGRATION_MAJOR ||
-                interface->minor_version < VD_INTERFACE_MIGRATION_MINOR) {
-                red_printf("unsuported migration interface");
-                return;
-            }
-            mig = (MigrationInterface *)interface;
-            reds->mig_notifier = mig->register_notifiers(mig, MIGRATION_NOTIFY_SPICE_KEY,
-                                                         reds_mig_started, reds_mig_finished,
-                                                         reds_mig_recv, NULL);
-            if (reds->mig_notifier == INVALID_VD_OBJECT_REF) {
-                red_error("migration register failed");
-            }
-        } else if (strcmp(interface->type, VD_INTERFACE_QXL) == 0) {
-            QXLInterface *qxl_interface;
+    SpiceInterfaceState *is = NULL;
 
-            red_printf("VD_INTERFACE_QXL");
-            if (interface->major_version != VD_INTERFACE_QXL_MAJOR ||
-                interface->minor_version < VD_INTERFACE_QXL_MINOR) {
-                red_printf("unsuported qxl interface");
-                return;
-            }
-            qxl_interface = (QXLInterface *)interface;
-            red_dispatcher_init(qxl_interface);
-        } else if (strcmp(interface->type, VD_INTERFACE_TABLET) == 0) {
-            red_printf("VD_INTERFACE_TABLET");
-            if (tablet) {
-                red_printf("already have tablet");
-                return;
-            }
-            if (interface->major_version != VD_INTERFACE_TABLET_MAJOR ||
-                interface->minor_version < VD_INTERFACE_TABLET_MINOR) {
-                red_printf("unsuported tablet interface");
-                return;
+    ASSERT(reds == s);
+
+    if (strcmp(interface->type, VD_INTERFACE_KEYBOARD) == 0) {
+        red_printf("VD_INTERFACE_KEYBOARD");
+        if (keyboard) {
+            red_printf("already have keyboard");
+            return NULL;
+        }
+        if (interface->major_version != VD_INTERFACE_KEYBOARD_MAJOR ||
+            interface->minor_version < VD_INTERFACE_KEYBOARD_MINOR) {
+            red_printf("unsuported keyboard interface");
+            return NULL;
+        }
+        keyboard = (KeyboardInterface *)interface;
+        if (keyboard->register_leds_notifier) {
+            if (!keyboard->register_leds_notifier(keyboard, reds_on_keyboard_leds_change, NULL)) {
+                red_error("register leds notifier failed");
             }
-            tablet = (TabletInterface *)interface;
+        }
+
+    } else if (strcmp(interface->type, VD_INTERFACE_MOUSE) == 0) {
+        red_printf("VD_INTERFACE_MOUSE");
+        if (mouse) {
+            red_printf("already have mouse");
+            return NULL;
+        }
+        if (interface->major_version != VD_INTERFACE_MOUSE_MAJOR ||
+            interface->minor_version < VD_INTERFACE_MOUSE_MINOR) {
+            red_printf("unsuported mouse interface");
+            return NULL;
+        }
+        mouse = (MouseInterface *)interface;
+
+    } else if (strcmp(interface->type, VD_INTERFACE_MIGRATION) == 0) {
+        red_printf("VD_INTERFACE_MIGRATION");
+        if (mig) {
+            red_printf("already have migration");
+            return NULL;
+        }
+        if (interface->major_version != VD_INTERFACE_MIGRATION_MAJOR ||
+            interface->minor_version < VD_INTERFACE_MIGRATION_MINOR) {
+            red_printf("unsuported migration interface");
+            return NULL;
+        }
+        mig = (MigrationInterface *)interface;
+        reds->mig_notifier = mig->register_notifiers(mig, MIGRATION_NOTIFY_SPICE_KEY,
+                                                     reds_mig_started, reds_mig_finished,
+                                                     reds_mig_recv, NULL);
+        if (reds->mig_notifier == INVALID_VD_OBJECT_REF) {
+            red_error("migration register failed");
+        }
+
+    } else if (strcmp(interface->type, VD_INTERFACE_QXL) == 0) {
+        QXLInterface *qxl_interface;
+
+        red_printf("VD_INTERFACE_QXL");
+        if (interface->major_version != VD_INTERFACE_QXL_MAJOR ||
+            interface->minor_version < VD_INTERFACE_QXL_MINOR) {
+            red_printf("unsuported qxl interface");
+            return NULL;
+        }
+        qxl_interface = (QXLInterface *)interface;
+        red_dispatcher_init(qxl_interface, id);
+
+    } else if (strcmp(interface->type, VD_INTERFACE_TABLET) == 0) {
+        red_printf("VD_INTERFACE_TABLET");
+        if (tablet) {
+            red_printf("already have tablet");
+            return NULL;
+        }
+        if (interface->major_version != VD_INTERFACE_TABLET_MAJOR ||
+            interface->minor_version < VD_INTERFACE_TABLET_MINOR) {
+            red_printf("unsuported tablet interface");
+            return NULL;
+        }
+        tablet = (TabletInterface *)interface;
+        reds_update_mouse_mode();
+        if (reds->is_client_mouse_allowed) {
+            tablet->set_logical_size(tablet, reds->monitor_mode.x_res,
+                                     reds->monitor_mode.y_res);
+        }
+
+    } else if (strcmp(interface->type, VD_INTERFACE_PLAYBACK) == 0) {
+        red_printf("VD_INTERFACE_PLAYBACK");
+        if (interface->major_version != VD_INTERFACE_PLAYBACK_MAJOR ||
+            interface->minor_version < VD_INTERFACE_PLAYBACK_MINOR) {
+            red_printf("unsuported playback interface");
+            return NULL;
+        }
+        snd_attach_playback((PlaybackInterface *)interface);
+
+    } else if (strcmp(interface->type, VD_INTERFACE_RECORD) == 0) {
+        red_printf("VD_INTERFACE_RECORD");
+        if (interface->major_version != VD_INTERFACE_RECORD_MAJOR ||
+            interface->minor_version < VD_INTERFACE_RECORD_MINOR) {
+            red_printf("unsuported record interface");
+            return NULL;
+        }
+        snd_attach_record((RecordInterface *)interface);
+
+    } else if (strcmp(interface->type, VD_INTERFACE_VDI_PORT) == 0) {
+        red_printf("VD_INTERFACE_VDI_PORT");
+        if (vdagent) {
+            red_printf("vdi port already attached");
+            return NULL;
+        }
+        if (interface->major_version != VD_INTERFACE_VDI_PORT_MAJOR ||
+            interface->minor_version < VD_INTERFACE_VDI_PORT_MINOR) {
+            red_printf("unsuported vdi port interface");
+            return NULL;
+        }
+        attach_to_red_agent((VDIPortInterface *)interface);
+
+    } else if (strcmp(interface->type, VD_INTERFACE_NET_WIRE) == 0) {
+        NetWireInterface * net_wire = (NetWireInterface *)interface;
+        red_printf("VD_INTERFACE_NET_WIRE");
+        if (red_tunnel) {
+            red_printf("net wire already attached");
+            return NULL;
+        }
+        if (interface->major_version != VD_INTERFACE_NET_WIRE_MAJOR ||
+            interface->minor_version < VD_INTERFACE_NET_WIRE_MINOR) {
+            red_printf("unsuported net wire interface");
+            return NULL;
+        }
+        red_tunnel = red_tunnel_attach(core, net_wire);
+    }
+
+    if (!is)
+        is = spice_malloc0(sizeof(*is));
+
+    is->server = s;
+    is->base   = interface;
+    is->opaque = opaque;
+    return is;
+}
+
+__visible__ int spice_server_remove_interface(SpiceInterfaceState *is)
+{
+    SpiceBaseInterface *interface = is->base;
+
+    ASSERT(reds == is->server);
+    if (strcmp(interface->type, VD_INTERFACE_TABLET) == 0) {
+        red_printf("remove VD_INTERFACE_TABLET");
+        if (interface == (SpiceBaseInterface *)tablet) {
+            tablet = NULL;
             reds_update_mouse_mode();
-            if (reds->is_client_mouse_allowed) {
-                tablet->set_logical_size(tablet, reds->monitor_mode.x_res,
-                                         reds->monitor_mode.y_res);
-            }
-        } else if (strcmp(interface->type, VD_INTERFACE_PLAYBACK) == 0) {
-            red_printf("VD_INTERFACE_PLAYBACK");
-            if (interface->major_version != VD_INTERFACE_PLAYBACK_MAJOR ||
-                interface->minor_version < VD_INTERFACE_PLAYBACK_MINOR) {
-                red_printf("unsuported playback interface");
-                return;
-            }
-            snd_attach_playback((PlaybackInterface *)interface);
-        } else if (strcmp(interface->type, VD_INTERFACE_RECORD) == 0) {
-            red_printf("VD_INTERFACE_RECORD");
-            if (interface->major_version != VD_INTERFACE_RECORD_MAJOR ||
-                interface->minor_version < VD_INTERFACE_RECORD_MINOR) {
-                red_printf("unsuported record interface");
-                return;
-            }
-            snd_attach_record((RecordInterface *)interface);
-        } else if (strcmp(interface->type, VD_INTERFACE_VDI_PORT) == 0) {
-            red_printf("VD_INTERFACE_VDI_PORT");
-            if (vdagent) {
-                red_printf("vdi port already attached");
-                return;
-            }
-            if (interface->major_version != VD_INTERFACE_VDI_PORT_MAJOR ||
-                interface->minor_version < VD_INTERFACE_VDI_PORT_MINOR) {
-                red_printf("unsuported vdi port interface");
-                return;
-            }
-            attach_to_red_agent((VDIPortInterface *)interface);
-        } else if (strcmp(interface->type, VD_INTERFACE_NET_WIRE) == 0) {
-            NetWireInterface * net_wire = (NetWireInterface *)interface;
-            red_printf("VD_INTERFACE_NET_WIRE");
-            if (red_tunnel) {
-                red_printf("net wire already attached");
-                return;
-            }
-            if (interface->major_version != VD_INTERFACE_NET_WIRE_MAJOR ||
-                interface->minor_version < VD_INTERFACE_NET_WIRE_MINOR) {
-                red_printf("unsuported net wire interface");
-                return;
-            }
-            red_tunnel = red_tunnel_attach(core, net_wire);
         }
-        break;
-    case VD_INTERFACE_REMOVING:
-        if (strcmp(interface->type, VD_INTERFACE_TABLET) == 0) {
-            red_printf("remove VD_INTERFACE_TABLET");
-            if (interface == (VDInterface *)tablet) {
-                tablet = NULL;
-                reds_update_mouse_mode();
-            }
-            break;
-        } else if (strcmp(interface->type, VD_INTERFACE_PLAYBACK) == 0) {
-            red_printf("remove VD_INTERFACE_PLAYBACK");
-            snd_detach_playback((PlaybackInterface *)interface);
-            break;
-        } else if (strcmp(interface->type, VD_INTERFACE_RECORD) == 0) {
-            red_printf("remove VD_INTERFACE_RECORD");
-            snd_detach_record((RecordInterface *)interface);
-            break;
-        } else if (strcmp(interface->type, VD_INTERFACE_VDI_PORT) == 0) {
-            red_printf("remove VD_INTERFACE_VDI_PORT");
-            if (interface == (VDInterface *)vdagent) {
-                reds_agent_remove();
-            }
-            break;
+
+    } else if (strcmp(interface->type, VD_INTERFACE_PLAYBACK) == 0) {
+        red_printf("remove VD_INTERFACE_PLAYBACK");
+        snd_detach_playback((PlaybackInterface *)interface);
+
+    } else if (strcmp(interface->type, VD_INTERFACE_RECORD) == 0) {
+        red_printf("remove VD_INTERFACE_RECORD");
+        snd_detach_record((RecordInterface *)interface);
+
+    } else if (strcmp(interface->type, VD_INTERFACE_VDI_PORT) == 0) {
+        red_printf("remove VD_INTERFACE_VDI_PORT");
+        if (interface == (SpiceBaseInterface *)vdagent) {
+            reds_agent_remove();
         }
+
+    } else {
         red_error("VD_INTERFACE_REMOVING unsupported");
-        break;
+        return -1;
     }
+
+    return 0;
 }
 
 static void free_external_agent_buff(VDIPortBuf *in_buf)
@@ -4283,10 +4304,6 @@ static void do_spice_init(CoreInterface *core_interface)
 {
     red_printf("starting %s", version_string);
 
-    if (core_interface->base.base_version != VM_INTERFACE_VERSION) {
-        red_error("bad base interface version");
-    }
-
     if (core_interface->base.major_version != VD_INTERFACE_CORE_MAJOR) {
         red_error("bad core interface version");
     }
@@ -4556,23 +4573,9 @@ __visible__ int spice_server_add_renderer(SpiceServer *s, const char *name)
     return 0;
 }
 
-__visible__ int spice_server_add_interface(SpiceServer *s, VDInterface *interface)
-{
-    ASSERT(reds == s);
-    interface_change_notifier(NULL, interface, VD_INTERFACE_ADDING);
-    return 0;
-}
-
-__visible__ int spice_server_remove_interface(SpiceServer *s, VDInterface *interface)
+__visible__ int spice_server_kbd_leds(SpiceInterfaceState *is, int leds)
 {
-    ASSERT(reds == s);
-    interface_change_notifier(NULL, interface, VD_INTERFACE_REMOVING);
-    return 0;
-}
-
-__visible__ int spice_server_kbd_leds(SpiceServer *s, KeyboardInterface *kbd, int leds)
-{
-    ASSERT(reds == s);
+    ASSERT(reds == is->server);
     reds_on_keyboard_leds_change(NULL, leds);
     return 0;
 }
diff --git a/server/reds.h b/server/reds.h
index 02752b5..7796c08 100644
--- a/server/reds.h
+++ b/server/reds.h
@@ -56,6 +56,12 @@ typedef struct Channel {
     void *data;
 } Channel;
 
+struct SpiceInterfaceState {
+    SpiceServer *server;
+    SpiceBaseInterface *base;
+    void *opaque;
+};
+
 void reds_desable_mm_timer();
 void reds_enable_mm_timer();
 void reds_update_mm_timer(uint32_t mm_time);
diff --git a/server/snd_worker.c b/server/snd_worker.c
index 2108fc4..cecfb3b 100644
--- a/server/snd_worker.c
+++ b/server/snd_worker.c
@@ -142,7 +142,7 @@ typedef struct PlaybackChannel {
 
 struct SndWorker {
     Channel base;
-    VDInterface *interface;
+    SpiceBaseInterface *interface;
     SndChannel *connection;
     SndWorker *next;
 };
@@ -1192,7 +1192,7 @@ static void remove_worker(SndWorker *worker)
     red_printf("not found");
 }
 
-static SndWorker *find_worker(VDInterface *interface)
+static SndWorker *find_worker(SpiceBaseInterface *interface)
 {
     SndWorker *worker = workers;
     while (worker) {
@@ -1242,7 +1242,7 @@ void snd_attach_record(RecordInterface *interface)
     reds_register_channel(&record_worker->base);
 }
 
-static void snd_detach_common(VDInterface *interface)
+static void snd_detach_common(SpiceBaseInterface *interface)
 {
     SndWorker *worker = find_worker(interface);
 
diff --git a/server/spice.h b/server/spice.h
index b61e957..e268042 100644
--- a/server/spice.h
+++ b/server/spice.h
@@ -45,9 +45,12 @@ int spice_server_set_tls(SpiceServer *s, int port,
                          const char *private_key_file, const char *key_passwd,
                          const char *dh_key_file, const char *ciphersuite);
 
-int spice_server_add_interface(SpiceServer *s, VDInterface *interface);
-int spice_server_remove_interface(SpiceServer *s, VDInterface *interface);
-int spice_server_kbd_leds(SpiceServer *s, KeyboardInterface *kbd, int leds);
+SpiceInterfaceState *spice_server_add_interface(SpiceServer *s,
+                                                SpiceBaseInterface *interface,
+                                                int id,
+                                                void *opaque);
+int spice_server_remove_interface(SpiceInterfaceState *is);
+int spice_server_kbd_leds(SpiceInterfaceState *is, int leds);
 
 typedef enum {
     SPICE_IMAGE_COMPRESS_INVALID  = 0,
diff --git a/server/vd_interface.h b/server/vd_interface.h
index c5a1a5a..6476bd4 100644
--- a/server/vd_interface.h
+++ b/server/vd_interface.h
@@ -36,17 +36,15 @@
 #define VM_INTERFACE_VERSION 1
 typedef unsigned long VDObjectRef;
 #define INVALID_VD_OBJECT_REF 0
-typedef struct VDInterface VDInterface;
 
-struct VDInterface {
-    uint32_t base_version;
+typedef struct SpiceBaseInterface SpiceBaseInterface;
+typedef struct SpiceInterfaceState SpiceInterfaceState;
+
+struct SpiceBaseInterface {
     const char *type;
-    unsigned int id;
     const char *description;
-    //todo: swap minor major order on VM_INTERFACE_VERSION change
-    //      (here and in spacific interfaces)
-    uint32_t minor_version;
     uint32_t major_version;
+    uint32_t minor_version;
 };
 
 #define VD_INTERFACE_CORE "core"
@@ -56,7 +54,7 @@ typedef struct CoreInterface CoreInterface;
 typedef enum {
     VD_INTERFACE_ADDING,
     VD_INTERFACE_REMOVING,
-} VDInterfaceChangeType;
+} SpiceBaseInterfaceChangeType;
 
 typedef enum {
     VD_LOG_ERROR = 1,
@@ -64,8 +62,8 @@ typedef enum {
     VD_LOG_INFO,
 } LogLevel;
 
-typedef void (*vd_interface_change_notifier_t)(void *opaque, VDInterface *interface,
-                                               VDInterfaceChangeType change);
+typedef void (*vd_interface_change_notifier_t)(void *opaque, SpiceBaseInterface *interface,
+                                               SpiceBaseInterfaceChangeType change);
 
 #define SPICE_WATCH_EVENT_READ  (1 << 0)
 #define SPICE_WATCH_EVENT_WRITE (1 << 1)
@@ -77,7 +75,7 @@ typedef struct SpiceTimer SpiceTimer;
 typedef void (*SpiceTimerFunc)(void *opaque);
 
 struct CoreInterface {
-    VDInterface base;
+    SpiceBaseInterface base;
 
     SpiceTimer *(*timer_add)(SpiceTimerFunc func, void *opaque);
     void (*timer_start)(SpiceTimer *timer, uint32_t ms);
@@ -177,7 +175,7 @@ struct QXLDevSurfaceCreate {
 };
 
 struct QXLInterface {
-    VDInterface base;
+    SpiceBaseInterface base;
 
     uint16_t pci_vendor;
     uint16_t pci_id;
@@ -208,7 +206,7 @@ typedef struct KeyboardInterface KeyboardInterface;
 typedef void (*keyborad_leads_notifier_t)(void *opaque, uint8_t leds);
 
 struct KeyboardInterface {
-    VDInterface base;
+    SpiceBaseInterface base;
 
     void (*push_scan_freg)(KeyboardInterface *keyboard, uint8_t frag);
     uint8_t (*get_leds)(KeyboardInterface *keyboard);
@@ -223,7 +221,7 @@ struct KeyboardInterface {
 typedef struct MouseInterface MouseInterface;
 
 struct MouseInterface {
-    VDInterface base;
+    SpiceBaseInterface base;
 
     void (*moution)(MouseInterface* mouse, int dx, int dy, int dz,
                     uint32_t buttons_state);
@@ -236,7 +234,7 @@ struct MouseInterface {
 typedef struct TabletInterface TabletInterface;
 
 struct TabletInterface {
-    VDInterface base;
+    SpiceBaseInterface base;
 
     void (*set_logical_size)(TabletInterface* tablet, int width, int height);
     void (*position)(TabletInterface* tablet, int x, int y, uint32_t buttons_state);
@@ -253,7 +251,7 @@ typedef void (*migration_notify_finished_t)(void *opaque, int completed);
 typedef void (*migration_notify_recv_t)(void *opaque, int fd);
 
 struct MigrationInterface {
-    VDInterface base;
+    SpiceBaseInterface base;
 
     VDObjectRef (*register_notifiers)(MigrationInterface* mig, const char *key,
                                       migration_notify_started_t,
@@ -312,7 +310,7 @@ struct PlaybackPlug {
 };
 
 struct PlaybackInterface {
-    VDInterface base;
+    SpiceBaseInterface base;
 
     VDObjectRef (*plug)(PlaybackInterface *playback, PlaybackPlug* plug, int *enable);
     void (*unplug)(PlaybackInterface *playback, VDObjectRef);
@@ -338,7 +336,7 @@ struct RecordPlug {
 };
 
 struct RecordInterface {
-    VDInterface base;
+    SpiceBaseInterface base;
 
     VDObjectRef (*plug)(RecordInterface *recorder, RecordPlug* plug, int *enable);
     void (*unplug)(RecordInterface *recorder, VDObjectRef);
@@ -357,7 +355,7 @@ struct VDIPortPlug {
 };
 
 struct VDIPortInterface {
-    VDInterface base;
+    SpiceBaseInterface base;
 
     VDObjectRef (*plug)(VDIPortInterface *port, VDIPortPlug* plug);
     void (*unplug)(VDIPortInterface *port, VDObjectRef plug);
@@ -373,7 +371,7 @@ typedef struct NetWireInterface NetWireInterface;
 typedef void (*net_wire_packet_route_proc_t)(void *opaque, const uint8_t *pkt, int pkt_len);
 
 struct NetWireInterface {
-    VDInterface base;
+    SpiceBaseInterface base;
 
     struct in_addr (*get_ip)(NetWireInterface *vlan);
     int (*can_send_packet)(NetWireInterface *vlan);
-- 
1.6.6.1



More information about the Spice-devel mailing list