[Spice-devel] [PATCH 21/39] s/CoreInterface/SpiceCoreInterface/

Gerd Hoffmann kraxel at redhat.com
Tue May 18 08:42:58 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 3f46147..9f02822 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 e222f63..1fc92e5 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 cf1f317..d4da0b3 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 606c9dd..9f3a61c 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 b81e0b3..740de36 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -54,7 +54,7 @@
 #include "red_tunnel_worker.h"
 #endif
 
-CoreInterface *core = NULL;
+SpiceCoreInterface *core = NULL;
 static MigrationInterface *mig = NULL;
 static KeyboardInterface *keyboard = NULL;
 static MouseInterface *mouse = NULL;
@@ -4267,11 +4267,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;
@@ -4335,12 +4335,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)
 {
@@ -4351,7 +4345,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 60eef4a..9a171f6 100644
--- a/server/reds.h
+++ b/server/reds.h
@@ -67,7 +67,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 5b768ef..caf2830 100644
--- a/server/spice.h
+++ b/server/spice.h
@@ -21,13 +21,10 @@
 #include <sys/socket.h>
 #include "vd_interface.h"
 
-/* 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 6b86dc8..abfe088 100644
--- a/server/vd_interface.h
+++ b/server/vd_interface.h
@@ -50,14 +50,10 @@ struct SpiceBaseInstance {
     SpiceBaseInterface *sif;
 };
 
-#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,
@@ -65,9 +61,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)
 
@@ -77,7 +70,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