[PATCH v3 RFC] channel: add context parameters to SpiceCoreInterfaceInternal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch and previous ones want to solve the problem of not having a
context in SpiceCoreInterface. SpiceCoreInterface defines a set of
callbacks to handle events in spice-server. These callbacks allow to
handle timers, watch for file descriptors and send channel events.
All these callbacks does not accept a context (usually in C passed as a
void* parameter) so they is hard for them to differentiate the interface
specified.
Unfortunately this structure is used even internally from different
contextes for instance every RedWorker thread have a different context. To
solve this issue some workarounds are used. Currently for timers a variable
depending on the current thread is used while for watches the opaque
parameter to pass to the event callback is used as it currently points just
to RedChannelClient structure.  This however impose some implicit
maintanance problem in the future. What happen for instance if for some
reason a timer is registered during worker initialization, run in another
thread? What if we decide to register a file descriptor callback for
something not a RedChannelClient?  Could be that the program will run
without any issue till some bytes changes and weird thing could happen.

The implementation of this solution is done implementing an internal "core"
interface that have context specification and use it to differentiate the
context instead of relying to some other, hard to maintain, detail. Then an
adapter structure (name inpired to the adapter pattern) will provide the
internal core interface using the external, public, definition (in the
future this technique can be used to extend the external interface without
breaking the ABI).

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---

Changes from v2:
This patch replace basically patch 3 and 4 of previous version.
This is more another style change (use a context not related to
SpiceCoreInterfaceInternal pointer) than a version that wants to
supercedes the old one.
Changing context require to store and pass it explicitly so the
choice between this and the old is quite an opinion.

 server/char-device.c       |  4 ++--
 server/inputs-channel.c    |  3 ++-
 server/main-channel.c      |  4 ++--
 server/main-dispatcher.c   |  6 ++++--
 server/main-dispatcher.h   |  2 +-
 server/red-channel.c       | 17 +++++++++++------
 server/red-channel.h       |  3 +++
 server/red-common.h        |  5 +++--
 server/red-worker.c        | 11 ++++-------
 server/reds-stream.c       |  5 ++---
 server/reds.c              | 20 +++++++++++---------
 server/reds.h              |  1 +
 server/smartcard.c         |  2 +-
 server/sound.c             |  2 +-
 server/spice_timer_queue.c |  3 ++-
 server/spice_timer_queue.h |  3 ++-
 server/spicevmc.c          |  2 +-
 17 files changed, 53 insertions(+), 40 deletions(-)

diff --git a/server/char-device.c b/server/char-device.c
index cefc14d..8d619e9 100644
--- a/server/char-device.c
+++ b/server/char-device.c
@@ -694,7 +694,7 @@ SpiceCharDeviceState *spice_char_device_state_create(SpiceCharDeviceInstance *si
     sif = SPICE_CONTAINEROF(char_dev->sin->base.sif, SpiceCharDeviceInterface, base);
     if (sif->base.minor_version <= 2 ||
         !(sif->flags & SPICE_CHAR_DEVICE_NOTIFY_WRITABLE)) {
-        char_dev->write_to_dev_timer = core->timer_add(spice_char_dev_write_retry, char_dev);
+        char_dev->write_to_dev_timer = core->timer_add(core_ctx, spice_char_dev_write_retry, char_dev);
         if (!char_dev->write_to_dev_timer) {
             spice_error("failed creating char dev write timer");
         }
@@ -793,7 +793,7 @@ int spice_char_device_client_add(SpiceCharDeviceState *dev,
     dev_client->max_send_queue_size = max_send_queue_size;
     dev_client->do_flow_control = do_flow_control;
     if (do_flow_control) {
-        dev_client->wait_for_tokens_timer = core->timer_add(device_client_wait_for_tokens_timeout,
+        dev_client->wait_for_tokens_timer = core->timer_add(core_ctx, device_client_wait_for_tokens_timeout,
                                                             dev_client);
         if (!dev_client->wait_for_tokens_timer) {
             spice_error("failed to create wait for tokens timer");
diff --git a/server/inputs-channel.c b/server/inputs-channel.c
index ba97f0f..0580298 100644
--- a/server/inputs-channel.c
+++ b/server/inputs-channel.c
@@ -656,6 +656,7 @@ void inputs_init(void)
     g_inputs_channel = (InputsChannel *)red_channel_create_parser(
                                     sizeof(InputsChannel),
                                     core,
+                                    core_ctx,
                                     SPICE_CHANNEL_INPUTS, 0,
                                     FALSE, /* handle_acks */
                                     spice_get_client_channel_parser(SPICE_CHANNEL_INPUTS, NULL),
@@ -674,7 +675,7 @@ void inputs_init(void)
     red_channel_set_cap(&g_inputs_channel->base, SPICE_INPUTS_CAP_KEY_SCANCODE);
     reds_register_channel(&g_inputs_channel->base);
 
-    if (!(key_modifiers_timer = core->timer_add(key_modifiers_sender, NULL))) {
+    if (!(key_modifiers_timer = core->timer_add(core_ctx, key_modifiers_sender, NULL))) {
         spice_error("key modifiers timer create failed");
     }
 }
diff --git a/server/main-channel.c b/server/main-channel.c
index eb894b0..39288e6 100644
--- a/server/main-channel.c
+++ b/server/main-channel.c
@@ -1087,7 +1087,7 @@ static MainChannelClient *main_channel_client_create(MainChannel *main_chan, Red
     mcc->connection_id = connection_id;
     mcc->bitrate_per_sec = ~0;
 #ifdef RED_STATISTICS
-    if (!(mcc->ping_timer = core->timer_add(ping_timer_cb, NULL))) {
+    if (!(mcc->ping_timer = core->timer_add(core_ctx, ping_timer_cb, NULL))) {
         spice_error("ping timer create failed");
     }
     mcc->ping_interval = PING_INTERVAL;
@@ -1178,7 +1178,7 @@ MainChannel* main_channel_init(void)
     channel_cbs.handle_migrate_data = main_channel_handle_migrate_data;
 
     // TODO: set the migration flag of the channel
-    channel = red_channel_create_parser(sizeof(MainChannel), core,
+    channel = red_channel_create_parser(sizeof(MainChannel), core, core_ctx,
                                         SPICE_CHANNEL_MAIN, 0,
                                         FALSE, /* handle_acks */
                                         spice_get_client_channel_parser(SPICE_CHANNEL_MAIN, NULL),
diff --git a/server/main-dispatcher.c b/server/main-dispatcher.c
index 77f2071..30fdb61 100644
--- a/server/main-dispatcher.c
+++ b/server/main-dispatcher.c
@@ -50,6 +50,7 @@
 typedef struct {
     Dispatcher base;
     SpiceCoreInterfaceInternal *core;
+    SpiceCoreContext *core_ctx;
 } MainDispatcher;
 
 MainDispatcher main_dispatcher;
@@ -195,12 +196,13 @@ static void dispatcher_handle_read(int fd, int event, void *opaque)
  * Reds routines shouldn't be exposed. Instead reds.c should register the callbacks,
  * and the corresponding operations should be made only via main_dispatcher.
  */
-void main_dispatcher_init(SpiceCoreInterfaceInternal *core)
+void main_dispatcher_init(SpiceCoreInterfaceInternal *core, SpiceCoreContext *ctx)
 {
     memset(&main_dispatcher, 0, sizeof(main_dispatcher));
     main_dispatcher.core = core;
+    main_dispatcher.core_ctx = ctx;
     dispatcher_init(&main_dispatcher.base, MAIN_DISPATCHER_NUM_MESSAGES, &main_dispatcher.base);
-    core->watch_add(main_dispatcher.base.recv_fd, SPICE_WATCH_EVENT_READ,
+    core->watch_add(ctx, main_dispatcher.base.recv_fd, SPICE_WATCH_EVENT_READ,
                     dispatcher_handle_read, &main_dispatcher.base);
     dispatcher_register_handler(&main_dispatcher.base, MAIN_DISPATCHER_CHANNEL_EVENT,
                                 main_dispatcher_handle_channel_event,
diff --git a/server/main-dispatcher.h b/server/main-dispatcher.h
index 1a06229..e57541c 100644
--- a/server/main-dispatcher.h
+++ b/server/main-dispatcher.h
@@ -31,6 +31,6 @@ void main_dispatcher_set_mm_time_latency(RedClient *client, uint32_t latency);
  */
 void main_dispatcher_client_disconnect(RedClient *client);
 
-void main_dispatcher_init(SpiceCoreInterfaceInternal *core);
+void main_dispatcher_init(SpiceCoreInterfaceInternal *core, SpiceCoreContext *core_ctx);
 
 #endif //MAIN_DISPATCHER_H
diff --git a/server/red-channel.c b/server/red-channel.c
index f79605a..313e1fa 100644
--- a/server/red-channel.c
+++ b/server/red-channel.c
@@ -832,7 +832,7 @@ void red_channel_client_start_connectivity_monitoring(RedChannelClient *rcc, uin
      */
     if (rcc->latency_monitor.timer == NULL) {
         rcc->latency_monitor.timer = rcc->channel->core->timer_add(
-            red_channel_client_ping_timer, rcc);
+            rcc->channel->core_ctx, red_channel_client_ping_timer, rcc);
         if (!rcc->client->during_target_migrate) {
             red_channel_client_start_ping_timer(rcc, PING_TEST_IDLE_NET_TIMEOUT_MS);
         }
@@ -841,7 +841,7 @@ void red_channel_client_start_connectivity_monitoring(RedChannelClient *rcc, uin
     if (rcc->connectivity_monitor.timer == NULL) {
         rcc->connectivity_monitor.state = CONNECTIVITY_STATE_CONNECTED;
         rcc->connectivity_monitor.timer = rcc->channel->core->timer_add(
-            red_channel_client_connectivity_timer, rcc);
+            rcc->channel->core_ctx, red_channel_client_connectivity_timer, rcc);
         rcc->connectivity_monitor.timeout = timeout_ms;
         if (!rcc->client->during_target_migrate) {
            rcc->channel->core->timer_start(rcc->connectivity_monitor.timer,
@@ -906,7 +906,8 @@ RedChannelClient *red_channel_client_create(int size, RedChannel *channel, RedCl
     ring_init(&rcc->pipe);
     rcc->pipe_size = 0;
 
-    stream->watch = channel->core->watch_add(stream->socket,
+    stream->watch = channel->core->watch_add(channel->core_ctx,
+                                           stream->socket,
                                            SPICE_WATCH_EVENT_READ,
                                            red_channel_client_event, rcc);
     rcc->id = channel->clients_num;
@@ -917,7 +918,7 @@ RedChannelClient *red_channel_client_create(int size, RedChannel *channel, RedCl
 
     if (monitor_latency && reds_stream_get_family(stream) != AF_UNIX) {
         rcc->latency_monitor.timer = channel->core->timer_add(
-            red_channel_client_ping_timer, rcc);
+            channel->core_ctx, red_channel_client_ping_timer, rcc);
         if (!client->during_target_migrate) {
             red_channel_client_start_ping_timer(rcc, PING_TEST_IDLE_NET_TIMEOUT_MS);
         }
@@ -1009,6 +1010,7 @@ void red_channel_client_default_migrate(RedChannelClient *rcc)
 
 RedChannel *red_channel_create(int size,
                                const SpiceCoreInterfaceInternal *core,
+                               SpiceCoreContext *core_ctx,
                                uint32_t type, uint32_t id,
                                int handle_acks,
                                channel_handle_message_proc handle_message,
@@ -1032,6 +1034,7 @@ RedChannel *red_channel_create(int size,
     memcpy(&channel->channel_cbs, channel_cbs, sizeof(ChannelCbs));
 
     channel->core = core;
+    channel->core_ctx = core_ctx;
     ring_init(&channel->clients);
 
     // TODO: send incoming_cb as parameters instead of duplicating?
@@ -1070,7 +1073,8 @@ static void dummy_watch_update_mask(SpiceWatch *watch, int event_mask)
 {
 }
 
-static SpiceWatch *dummy_watch_add(int fd, int event_mask, SpiceWatchFunc func, void *opaque)
+static SpiceWatch *dummy_watch_add(SpiceCoreContext *ctx,
+                                   int fd, int event_mask, SpiceWatchFunc func, void *opaque)
 {
     return NULL; // apparently allowed?
 }
@@ -1124,6 +1128,7 @@ static int do_nothing_handle_message(RedChannelClient *rcc,
 
 RedChannel *red_channel_create_parser(int size,
                                const SpiceCoreInterfaceInternal *core,
+                               SpiceCoreContext *core_ctx,
                                uint32_t type, uint32_t id,
                                int handle_acks,
                                spice_parse_channel_func_t parser,
@@ -1131,7 +1136,7 @@ RedChannel *red_channel_create_parser(int size,
                                const ChannelCbs *channel_cbs,
                                uint32_t migration_flags)
 {
-    RedChannel *channel = red_channel_create(size, core, type, id,
+    RedChannel *channel = red_channel_create(size, core, core_ctx, type, id,
                                              handle_acks,
                                              do_nothing_handle_message,
                                              channel_cbs,
diff --git a/server/red-channel.h b/server/red-channel.h
index 791bc5b..fce8d5a 100644
--- a/server/red-channel.h
+++ b/server/red-channel.h
@@ -312,6 +312,7 @@ struct RedChannel {
     RingItem link; // channels link for reds
 
     const SpiceCoreInterfaceInternal *core;
+    SpiceCoreContext *core_ctx;
     int handle_acks;
 
     // RedChannel will hold only connected channel clients (logic - when pushing pipe item to all channel clients, there
@@ -360,6 +361,7 @@ struct RedChannel {
  * explicitly destroy the channel */
 RedChannel *red_channel_create(int size,
                                const SpiceCoreInterfaceInternal *core,
+                               SpiceCoreContext *ctx,
                                uint32_t type, uint32_t id,
                                int handle_acks,
                                channel_handle_message_proc handle_message,
@@ -370,6 +372,7 @@ RedChannel *red_channel_create(int size,
  * will become default eventually */
 RedChannel *red_channel_create_parser(int size,
                                const SpiceCoreInterfaceInternal *core,
+                               SpiceCoreContext *ctx,
                                uint32_t type, uint32_t id,
                                int handle_acks,
                                spice_parse_channel_func_t parser,
diff --git a/server/red-common.h b/server/red-common.h
index 3c54fb8..793c5a2 100644
--- a/server/red-common.h
+++ b/server/red-common.h
@@ -40,14 +40,15 @@
 #include "utils.h"
 
 typedef struct SpiceCoreInterfaceInternal SpiceCoreInterfaceInternal;
+typedef struct SpiceCoreContext SpiceCoreContext;
 
 struct SpiceCoreInterfaceInternal {
-    SpiceTimer *(*timer_add)(SpiceTimerFunc func, void *opaque);
+    SpiceTimer *(*timer_add)(SpiceCoreContext *ctx, SpiceTimerFunc func, void *opaque);
     void (*timer_start)(SpiceTimer *timer, uint32_t ms);
     void (*timer_cancel)(SpiceTimer *timer);
     void (*timer_remove)(SpiceTimer *timer);
 
-    SpiceWatch *(*watch_add)(int fd, int event_mask, SpiceWatchFunc func, void *opaque);
+    SpiceWatch *(*watch_add)(SpiceCoreContext *ctx, int fd, int event_mask, SpiceWatchFunc func, void *opaque);
     void (*watch_update_mask)(SpiceWatch *watch, int event_mask);
     void (*watch_remove)(SpiceWatch *watch);
 
diff --git a/server/red-worker.c b/server/red-worker.c
index ce9cc56..dacdcf2 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -531,18 +531,15 @@ static void worker_watch_update_mask(SpiceWatch *watch, int event_mask)
     }
 }
 
-static SpiceWatch *worker_watch_add(int fd, int event_mask, SpiceWatchFunc func, void *opaque)
+static SpiceWatch *worker_watch_add(SpiceCoreContext *ctx,
+                                    int fd, int event_mask, SpiceWatchFunc func, void *opaque)
 {
     /* Since we are a channel core implementation, we always get called from
        red_channel_client_create(), so opaque always is our rcc */
     RedChannelClient *rcc = opaque;
-    struct RedWorker *worker;
+    RedWorker *worker = (RedWorker *) ctx;
     int i;
 
-    /* Since we are called from red_channel_client_create()
-       CommonChannelClient->worker has not been set yet! */
-    worker = SPICE_CONTAINEROF(rcc->channel, CommonChannel, base)->worker;
-
     /* Search for a free slot in our poll_fds & watches arrays */
     for (i = 0; i < MAX_EVENT_SOURCES; i++) {
         if (worker->poll_fds[i].fd == -1) {
@@ -640,7 +637,7 @@ CommonChannel *red_worker_new_channel(RedWorker *worker, int size,
     channel_cbs->alloc_recv_buf = common_alloc_recv_buf;
     channel_cbs->release_recv_buf = common_release_recv_buf;
 
-    channel = red_channel_create_parser(size, &worker_core,
+    channel = red_channel_create_parser(size, &worker_core, (SpiceCoreContext *) worker, 
                                         channel_type, worker->qxl->id,
                                         TRUE /* handle_acks */,
                                         spice_get_client_channel_parser(channel_type, NULL),
diff --git a/server/reds-stream.c b/server/reds-stream.c
index d8e4fe4..407ad94 100644
--- a/server/reds-stream.c
+++ b/server/reds-stream.c
@@ -23,6 +23,7 @@
 #include "red-common.h"
 #include "reds-stream.h"
 #include "common/log.h"
+#include "reds.h"
 
 #include <errno.h>
 #include <netdb.h>
@@ -43,8 +44,6 @@ struct AsyncRead {
 };
 typedef struct AsyncRead AsyncRead;
 
-extern SpiceCoreInterfaceInternal *core;
-
 #if HAVE_SASL
 #include <sasl/sasl.h>
 
@@ -457,7 +456,7 @@ static void async_read_handler(G_GNUC_UNUSED int fd,
                 switch (errno) {
                 case EAGAIN:
                     if (!async->stream->watch) {
-                        async->stream->watch = core->watch_add(async->stream->socket,
+                        async->stream->watch = core->watch_add(core_ctx, async->stream->socket,
                                                                SPICE_WATCH_EVENT_READ,
                                                                async_read_handler, async);
                     }
diff --git a/server/reds.c b/server/reds.c
index d9d0e0a..e45d062 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -73,10 +73,11 @@
 #include "reds-private.h"
 
 SpiceCoreInterfaceInternal *core = NULL;
+SpiceCoreContext *core_ctx = NULL;
 
 static SpiceCoreInterface *core_public = NULL;
 
-static SpiceTimer *adapter_timer_add(SpiceTimerFunc func, void *opaque)
+static SpiceTimer *adapter_timer_add(SpiceCoreContext *ctx, SpiceTimerFunc func, void *opaque)
 {
     return core_public->timer_add(func, opaque);
 }
@@ -96,7 +97,8 @@ static void adapter_timer_remove(SpiceTimer *timer)
     core_public->timer_remove(timer);
 }
 
-static SpiceWatch *adapter_watch_add(int fd, int event_mask, SpiceWatchFunc func, void *opaque)
+static SpiceWatch *adapter_watch_add(SpiceCoreContext *ctx,
+                                     int fd, int event_mask, SpiceWatchFunc func, void *opaque)
 {
     return core_public->watch_add(fd, event_mask, func, opaque);
 }
@@ -2358,11 +2360,11 @@ static RedLinkInfo *reds_init_client_ssl_connection(int socket)
         case REDS_STREAM_SSL_STATUS_ERROR:
             goto error;
         case REDS_STREAM_SSL_STATUS_WAIT_FOR_READ:
-            link->stream->watch = core->watch_add(link->stream->socket, SPICE_WATCH_EVENT_READ,
+            link->stream->watch = core->watch_add(core_ctx, link->stream->socket, SPICE_WATCH_EVENT_READ,
                                             reds_handle_ssl_accept, link);
             break;
         case REDS_STREAM_SSL_STATUS_WAIT_FOR_WRITE:
-            link->stream->watch = core->watch_add(link->stream->socket, SPICE_WATCH_EVENT_WRITE,
+            link->stream->watch = core->watch_add(core_ctx, link->stream->socket, SPICE_WATCH_EVENT_WRITE,
                                                   reds_handle_ssl_accept, link);
             break;
     }
@@ -2555,7 +2557,7 @@ static int reds_init_net(void)
         if (-1 == reds->listen_socket) {
             return -1;
         }
-        reds->listen_watch = core->watch_add(reds->listen_socket,
+        reds->listen_watch = core->watch_add(core_ctx, reds->listen_socket,
                                              SPICE_WATCH_EVENT_READ,
                                              reds_accept, NULL);
         if (reds->listen_watch == NULL) {
@@ -2570,7 +2572,7 @@ static int reds_init_net(void)
         if (-1 == reds->secure_listen_socket) {
             return -1;
         }
-        reds->secure_listen_watch = core->watch_add(reds->secure_listen_socket,
+        reds->secure_listen_watch = core->watch_add(core_ctx, reds->secure_listen_socket,
                                                     SPICE_WATCH_EVENT_READ,
                                                     reds_accept_ssl_connection, NULL);
         if (reds->secure_listen_watch == NULL) {
@@ -2581,7 +2583,7 @@ static int reds_init_net(void)
 
     if (spice_listen_socket_fd != -1 ) {
         reds->listen_socket = spice_listen_socket_fd;
-        reds->listen_watch = core->watch_add(reds->listen_socket,
+        reds->listen_watch = core->watch_add(core_ctx, reds->listen_socket,
                                              SPICE_WATCH_EVENT_READ,
                                              reds_accept, NULL);
         if (reds->listen_watch == NULL) {
@@ -3336,14 +3338,14 @@ static int do_spice_init(SpiceCoreInterface *core_interface)
     init_vd_agent_resources();
     ring_init(&reds->clients);
     reds->num_clients = 0;
-    main_dispatcher_init(core);
+    main_dispatcher_init(core, core_ctx);
     ring_init(&reds->channels);
     ring_init(&reds->mig_target_clients);
     ring_init(&reds->char_devs_states);
     ring_init(&reds->mig_wait_disconnect_clients);
     reds->vm_running = TRUE; /* for backward compatibility */
 
-    if (!(reds->mig_timer = core->timer_add(migrate_timeout, NULL))) {
+    if (!(reds->mig_timer = core->timer_add(core_ctx, migrate_timeout, NULL))) {
         spice_error("migration timer create failed");
     }
 
diff --git a/server/reds.h b/server/reds.h
index f3a9ce4..a79c18a 100644
--- a/server/reds.h
+++ b/server/reds.h
@@ -70,6 +70,7 @@ extern uint32_t renderers[RED_RENDERER_LAST];
 extern uint32_t num_renderers;
 
 extern struct SpiceCoreInterfaceInternal *core;
+extern SpiceCoreContext *core_ctx;
 extern uint32_t streaming_video;
 extern SpiceImageCompression image_compression;
 extern spice_wan_compression_t jpeg_state;
diff --git a/server/smartcard.c b/server/smartcard.c
index 15ebcc9..975d2d4 100644
--- a/server/smartcard.c
+++ b/server/smartcard.c
@@ -848,7 +848,7 @@ static void smartcard_init(void)
     channel_cbs.handle_migrate_data = smartcard_channel_client_handle_migrate_data;
 
     g_smartcard_channel = (SmartCardChannel*)red_channel_create(sizeof(SmartCardChannel),
-                                             core, SPICE_CHANNEL_SMARTCARD, 0,
+                                             core, core_ctx, SPICE_CHANNEL_SMARTCARD, 0,
                                              FALSE /* handle_acks */,
                                              smartcard_channel_handle_message,
                                              &channel_cbs,
diff --git a/server/sound.c b/server/sound.c
index a8cf0b6..532bab8 100644
--- a/server/sound.c
+++ b/server/sound.c
@@ -947,7 +947,7 @@ static SndChannel *__new_channel(SndWorker *worker, int size, uint32_t channel_i
     channel->receive_data.end = channel->receive_data.buf + sizeof(channel->receive_data.buf);
     channel->send_data.marshaller = spice_marshaller_new();
 
-    stream->watch = core->watch_add(stream->socket, SPICE_WATCH_EVENT_READ,
+    stream->watch = core->watch_add(core_ctx, stream->socket, SPICE_WATCH_EVENT_READ,
                                   snd_event, channel);
     if (stream->watch == NULL) {
         spice_printerr("watch_add failed, %s", strerror(errno));
diff --git a/server/spice_timer_queue.c b/server/spice_timer_queue.c
index 12ac131..a17a883 100644
--- a/server/spice_timer_queue.c
+++ b/server/spice_timer_queue.c
@@ -129,7 +129,8 @@ void spice_timer_queue_destroy(void)
     pthread_mutex_unlock(&queue_list_lock);
 }
 
-SpiceTimer *spice_timer_queue_add(SpiceTimerFunc func, void *opaque)
+SpiceTimer *spice_timer_queue_add(SpiceCoreContext *ctx,
+                                  SpiceTimerFunc func, void *opaque)
 {
     SpiceTimer *timer = spice_new0(SpiceTimer, 1);
     SpiceTimerQueue *queue = spice_timer_queue_find_with_lock();
diff --git a/server/spice_timer_queue.h b/server/spice_timer_queue.h
index a84f6cd..cf51a4a 100644
--- a/server/spice_timer_queue.h
+++ b/server/spice_timer_queue.h
@@ -29,7 +29,8 @@ typedef struct SpiceTimerQueue SpiceTimerQueue;
 int spice_timer_queue_create(void);
 void spice_timer_queue_destroy(void);
 
-SpiceTimer *spice_timer_queue_add(SpiceTimerFunc func, void *opaque);
+SpiceTimer *spice_timer_queue_add(SpiceCoreContext *ctx,
+                                  SpiceTimerFunc func, void *opaque);
 void spice_timer_set(SpiceTimer *timer, uint32_t ms);
 void spice_timer_cancel(SpiceTimer *timer);
 void spice_timer_remove(SpiceTimer *timer);
diff --git a/server/spicevmc.c b/server/spicevmc.c
index e38863a..5ee2691 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -519,7 +519,7 @@ SpiceCharDeviceState *spicevmc_device_connect(SpiceCharDeviceInstance *sin,
     channel_cbs.handle_migrate_data = spicevmc_channel_client_handle_migrate_data;
 
     state = (SpiceVmcState*)red_channel_create(sizeof(SpiceVmcState),
-                                   core, channel_type, id[channel_type]++,
+                                   core, core_ctx, channel_type, id[channel_type]++,
                                    FALSE /* handle_acks */,
                                    spicevmc_red_channel_client_handle_message,
                                    &channel_cbs,
-- 
2.4.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]