[Spice-devel] [PATCH 2/3] s/CoreInterface/SpiceCoreInterface/

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


Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
---
 server/red_channel.c       |    3 ++-
 server/red_channel.h       |    5 +++--
 server/red_tunnel_worker.c |    5 +++--
 server/red_tunnel_worker.h |    2 +-
 server/reds.c              |   14 ++++----------
 server/reds.h              |    2 +-
 server/spice.h             |    5 +----
 server/vd_interface.h      |   17 +++++------------
 8 files changed, 20 insertions(+), 33 deletions(-)

diff --git a/server/red_channel.c b/server/red_channel.c
index 6eb2ceb..e1bb62a 100644
--- a/server/red_channel.c
+++ b/server/red_channel.c
@@ -228,7 +228,8 @@ static void red_channel_peer_on_out_msg_done(void *opaque)
     }
 }
 
-RedChannel *red_channel_create(int size, RedsStreamContext *peer, CoreInterface *core,
+RedChannel *red_channel_create(int size, RedsStreamContext *peer,
+                               SpiceCoreInterface *core,
                                int migrate, int handle_acks,
                                channel_configure_socket_proc config_socket,
                                channel_disconnect_proc disconnect,
diff --git a/server/red_channel.h b/server/red_channel.h
index 8c8518c..3112c20 100644
--- a/server/red_channel.h
+++ b/server/red_channel.h
@@ -101,7 +101,7 @@ typedef void (*channel_release_pipe_item_proc)(RedChannel *channel,
 
 struct RedChannel {
     RedsStreamContext *peer;
-    CoreInterface *core;
+    SpiceCoreInterface *core;
     int migrate;
     int handle_acks;
 
@@ -141,7 +141,8 @@ struct RedChannel {
 
 /* if one of the callbacks should cause disconnect, use red_channel_shutdown and don't
    explicitly destroy the channel */
-RedChannel *red_channel_create(int size, RedsStreamContext *peer, CoreInterface *core,
+RedChannel *red_channel_create(int size, RedsStreamContext *peer,
+                               SpiceCoreInterface *core,
                                int migrate, int handle_acks,
                                channel_configure_socket_proc config_socket,
                                channel_disconnect_proc disconnect,
diff --git a/server/red_tunnel_worker.c b/server/red_tunnel_worker.c
index 6c3a0ee..9ea8b80 100644
--- a/server/red_tunnel_worker.c
+++ b/server/red_tunnel_worker.c
@@ -534,7 +534,7 @@ struct TunnelWorker {
     Channel channel_interface; // for reds
     TunnelChannel *channel;
 
-    CoreInterface *core_interface;
+    SpiceCoreInterface *core_interface;
     NetWireInterface *vlan_interface;
     RedSlirpNetworkInterface tunnel_interface;
     RedSlirpNetworkInterface null_interface;
@@ -970,7 +970,8 @@ static void tunnel_send_packet(void *opaque_tunnel, const uint8_t *pkt, int pkt_
     net_slirp_input(pkt, pkt_len);
 }
 
-void *red_tunnel_attach(CoreInterface *core_interface, NetWireInterface *vlan_interface)
+void *red_tunnel_attach(SpiceCoreInterface *core_interface,
+                        NetWireInterface *vlan_interface)
 {
     TunnelWorker *worker = spice_new0(TunnelWorker, 1);
 
diff --git a/server/red_tunnel_worker.h b/server/red_tunnel_worker.h
index 5d00a34..18c4cb2 100755
--- a/server/red_tunnel_worker.h
+++ b/server/red_tunnel_worker.h
@@ -24,6 +24,6 @@
 
 #include "vd_interface.h"
 
-void *red_tunnel_attach(CoreInterface *core_interface, NetWireInterface *vlan_interface);
+void *red_tunnel_attach(SpiceCoreInterface *core_interface, NetWireInterface *vlan_interface);
 
 #endif
diff --git a/server/reds.c b/server/reds.c
index 81cd299..a4563d4 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -52,7 +52,7 @@
 #include "ring.h"
 #include "config.h"
 
-CoreInterface *core = NULL;
+SpiceCoreInterface *core = NULL;
 static MigrationInterface *mig = NULL;
 static KeyboardInterface *keyboard = NULL;
 static MouseInterface *mouse = NULL;
@@ -4300,11 +4300,11 @@ static void init_vd_agent_resources()
 
 const char *version_string = VERSION;
 
-static void do_spice_init(CoreInterface *core_interface)
+static void do_spice_init(SpiceCoreInterface *core_interface)
 {
     red_printf("starting %s", version_string);
 
-    if (core_interface->base.major_version != VD_INTERFACE_CORE_MAJOR) {
+    if (core_interface->base.major_version != SPICE_INTERFACE_CORE_MAJOR) {
         red_error("bad core interface version");
     }
     core = core_interface;
@@ -4368,12 +4368,6 @@ static void do_spice_init(CoreInterface *core_interface)
     atexit(reds_exit);
 }
 
-__visible__ void spice_init(CoreInterface *core_interface)
-{
-    spice_server_new();
-    do_spice_init(core_interface);
-}
-
 /* new interface */
 __visible__ SpiceServer *spice_server_new(void)
 {
@@ -4384,7 +4378,7 @@ __visible__ SpiceServer *spice_server_new(void)
     return reds;
 }
 
-__visible__ int spice_server_init(SpiceServer *s, CoreInterface *core)
+__visible__ int spice_server_init(SpiceServer *s, SpiceCoreInterface *core)
 {
     ASSERT(reds == s);
     do_spice_init(core);
diff --git a/server/reds.h b/server/reds.h
index 7796c08..a2dadee 100644
--- a/server/reds.h
+++ b/server/reds.h
@@ -71,7 +71,7 @@ void reds_set_client_mouse_allowed(int is_client_mouse_allowed,
 void reds_register_channel(Channel *channel);
 void reds_unregister_channel(Channel *channel);
 
-extern struct CoreInterface *core;
+extern struct SpiceCoreInterface *core;
 extern uint64_t bitrate_per_sec;
 
 #define IS_LOW_BANDWIDTH() (bitrate_per_sec < 10 * 1024 * 1024)
diff --git a/server/spice.h b/server/spice.h
index e268042..18600e2 100644
--- a/server/spice.h
+++ b/server/spice.h
@@ -23,13 +23,10 @@
 
 #define __visible__ __attribute__ ((visibility ("default")))
 
-/* old interface */
-void spice_init(CoreInterface *core);
-
 /* new interface */
 typedef struct RedsState SpiceServer;
 SpiceServer *spice_server_new(void);
-int spice_server_init(SpiceServer *s, CoreInterface *core);
+int spice_server_init(SpiceServer *s, SpiceCoreInterface *core);
 void spice_server_destroy(SpiceServer *s);
 
 #define SPICE_ADDR_FLAG_IPV4_ONLY (1 << 0)
diff --git a/server/vd_interface.h b/server/vd_interface.h
index 6476bd4..fb40bb0 100644
--- a/server/vd_interface.h
+++ b/server/vd_interface.h
@@ -47,14 +47,10 @@ struct SpiceBaseInterface {
     uint32_t minor_version;
 };
 
-#define VD_INTERFACE_CORE "core"
-#define VD_INTERFACE_CORE_MAJOR 1
-#define VD_INTERFACE_CORE_MINOR 2
-typedef struct CoreInterface CoreInterface;
-typedef enum {
-    VD_INTERFACE_ADDING,
-    VD_INTERFACE_REMOVING,
-} SpiceBaseInterfaceChangeType;
+#define SPICE_INTERFACE_CORE "core"
+#define SPICE_INTERFACE_CORE_MAJOR 1
+#define SPICE_INTERFACE_CORE_MINOR 2
+typedef struct SpiceCoreInterface SpiceCoreInterface;
 
 typedef enum {
     VD_LOG_ERROR = 1,
@@ -62,9 +58,6 @@ typedef enum {
     VD_LOG_INFO,
 } LogLevel;
 
-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)
 
@@ -74,7 +67,7 @@ typedef void (*SpiceWatchFunc)(int fd, int event, void *opaque);
 typedef struct SpiceTimer SpiceTimer;
 typedef void (*SpiceTimerFunc)(void *opaque);
 
-struct CoreInterface {
+struct SpiceCoreInterface {
     SpiceBaseInterface base;
 
     SpiceTimer *(*timer_add)(SpiceTimerFunc func, void *opaque);
-- 
1.6.6.1



More information about the Spice-devel mailing list