[Spice-commits] server/event-loop.c server/red-common.h server/reds.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Oct 10 10:01:56 UTC 2019


 server/event-loop.c |   58 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 server/red-common.h |    1 
 server/reds.c       |   54 ------------------------------------------------
 3 files changed, 59 insertions(+), 54 deletions(-)

New commits:
commit 97d2d1f129d5d76ff895c0948100b1085b7c4d60
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Fri May 31 06:18:01 2019 +0100

    event-loop: Move adapter interface from reds.c
    
    Put more event loop code in event-loop.c.
    This is a preparation patch for the next one.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Victor Toso <victortoso at redhat.com>

diff --git a/server/event-loop.c b/server/event-loop.c
index 812c3a53..1ccfd671 100644
--- a/server/event-loop.c
+++ b/server/event-loop.c
@@ -264,3 +264,61 @@ const SpiceCoreInterfaceInternal event_loop_core = {
     .watch_update_mask = watch_update_mask,
     .watch_remove = watch_remove,
 };
+
+/*
+ * Adapter for SpiceCodeInterface
+ */
+
+static SpiceTimer *adapter_timer_add(const SpiceCoreInterfaceInternal *iface, SpiceTimerFunc func, void *opaque)
+{
+    return iface->public_interface->timer_add(func, opaque);
+}
+
+static void adapter_timer_start(const SpiceCoreInterfaceInternal *iface, SpiceTimer *timer, uint32_t ms)
+{
+    iface->public_interface->timer_start(timer, ms);
+}
+
+static void adapter_timer_cancel(const SpiceCoreInterfaceInternal *iface, SpiceTimer *timer)
+{
+    iface->public_interface->timer_cancel(timer);
+}
+
+static void adapter_timer_remove(const SpiceCoreInterfaceInternal *iface, SpiceTimer *timer)
+{
+    iface->public_interface->timer_remove(timer);
+}
+
+static SpiceWatch *adapter_watch_add(const SpiceCoreInterfaceInternal *iface,
+                                     int fd, int event_mask, SpiceWatchFunc func, void *opaque)
+{
+    // note: Qemu API is fine having a SOCKET on Windows
+    return iface->public_interface->watch_add(fd, event_mask, func, opaque);
+}
+
+static void adapter_watch_update_mask(const SpiceCoreInterfaceInternal *iface, SpiceWatch *watch, int event_mask)
+{
+    iface->public_interface->watch_update_mask(watch, event_mask);
+}
+
+static void adapter_watch_remove(const SpiceCoreInterfaceInternal *iface, SpiceWatch *watch)
+{
+    iface->public_interface->watch_remove(watch);
+}
+
+static void adapter_channel_event(const SpiceCoreInterfaceInternal *iface, int event, SpiceChannelEventInfo *info)
+{
+    if (iface->public_interface->base.minor_version >= 3 && iface->public_interface->channel_event != NULL)
+        iface->public_interface->channel_event(event, info);
+}
+
+const SpiceCoreInterfaceInternal core_interface_adapter = {
+    .timer_add = adapter_timer_add,
+    .timer_start = adapter_timer_start,
+    .timer_cancel = adapter_timer_cancel,
+    .timer_remove = adapter_timer_remove,
+    .watch_add = adapter_watch_add,
+    .watch_update_mask = adapter_watch_update_mask,
+    .watch_remove = adapter_watch_remove,
+    .channel_event = adapter_channel_event,
+};
diff --git a/server/red-common.h b/server/red-common.h
index 223f2869..22ea8fc3 100644
--- a/server/red-common.h
+++ b/server/red-common.h
@@ -71,6 +71,7 @@ struct SpiceCoreInterfaceInternal {
 };
 
 extern const SpiceCoreInterfaceInternal event_loop_core;
+extern const SpiceCoreInterfaceInternal core_interface_adapter;
 
 typedef struct RedsState RedsState;
 
diff --git a/server/reds.c b/server/reds.c
index cd8e796a..990da391 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -83,60 +83,6 @@ static void reds_client_monitors_config(RedsState *reds, VDAgentMonitorsConfig *
 static gboolean reds_use_client_monitors_config(RedsState *reds);
 static void reds_set_video_codecs(RedsState *reds, GArray *video_codecs);
 
-static SpiceTimer *adapter_timer_add(const SpiceCoreInterfaceInternal *iface, SpiceTimerFunc func, void *opaque)
-{
-    return iface->public_interface->timer_add(func, opaque);
-}
-
-static void adapter_timer_start(const SpiceCoreInterfaceInternal *iface, SpiceTimer *timer, uint32_t ms)
-{
-    iface->public_interface->timer_start(timer, ms);
-}
-
-static void adapter_timer_cancel(const SpiceCoreInterfaceInternal *iface, SpiceTimer *timer)
-{
-    iface->public_interface->timer_cancel(timer);
-}
-
-static void adapter_timer_remove(const SpiceCoreInterfaceInternal *iface, SpiceTimer *timer)
-{
-    iface->public_interface->timer_remove(timer);
-}
-
-static SpiceWatch *adapter_watch_add(const SpiceCoreInterfaceInternal *iface,
-                                     int fd, int event_mask, SpiceWatchFunc func, void *opaque)
-{
-    // note: Qemu API is fine having a SOCKET on Windows
-    return iface->public_interface->watch_add(fd, event_mask, func, opaque);
-}
-
-static void adapter_watch_update_mask(const SpiceCoreInterfaceInternal *iface, SpiceWatch *watch, int event_mask)
-{
-    iface->public_interface->watch_update_mask(watch, event_mask);
-}
-
-static void adapter_watch_remove(const SpiceCoreInterfaceInternal *iface, SpiceWatch *watch)
-{
-    iface->public_interface->watch_remove(watch);
-}
-
-static void adapter_channel_event(const SpiceCoreInterfaceInternal *iface, int event, SpiceChannelEventInfo *info)
-{
-    if (iface->public_interface->base.minor_version >= 3 && iface->public_interface->channel_event != NULL)
-        iface->public_interface->channel_event(event, info);
-}
-
-static const SpiceCoreInterfaceInternal core_interface_adapter = {
-    .timer_add = adapter_timer_add,
-    .timer_start = adapter_timer_start,
-    .timer_cancel = adapter_timer_cancel,
-    .timer_remove = adapter_timer_remove,
-    .watch_add = adapter_watch_add,
-    .watch_update_mask = adapter_watch_update_mask,
-    .watch_remove = adapter_watch_remove,
-    .channel_event = adapter_channel_event,
-};
-
 /* Debugging only variable: allow multiple client connections to the spice
  * server */
 #define SPICE_DEBUG_ALLOW_MC_ENV "SPICE_DEBUG_ALLOW_MC"


More information about the Spice-commits mailing list