[Spice-devel] [PATCH 19/23] server: use red_channel_get_message_serial

Alon Levy alevy at redhat.com
Fri Feb 11 09:23:07 PST 2011


---
 server/red_client_shared_cache.h |    6 +++---
 server/red_tunnel_worker.c       |    4 ++--
 server/red_worker.c              |    7 +------
 3 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/server/red_client_shared_cache.h b/server/red_client_shared_cache.h
index 75112c3..74553c0 100644
--- a/server/red_client_shared_cache.h
+++ b/server/red_client_shared_cache.h
@@ -40,7 +40,7 @@ static int FUNC_NAME(hit)(CACHE *cache, uint64_t id, int *lossy, CHANNEL *channe
     NewCacheItem *item;
     uint64_t serial;
 
-    serial = channel_message_serial((RedChannel *)channel);
+    serial = red_channel_get_message_serial((RedChannel *)channel);
     pthread_mutex_lock(&cache->lock);
     item = cache->hash_table[CACHE_HASH_KEY(id)];
 
@@ -88,7 +88,7 @@ static int FUNC_NAME(add)(CACHE *cache, uint64_t id, uint32_t size, int lossy, C
     ASSERT(size > 0);
 
     item = spice_new(NewCacheItem, 1);
-    serial = channel_message_serial((RedChannel *)channel);
+    serial = red_channel_get_message_serial((RedChannel *)channel);
 
     pthread_mutex_lock(&cache->lock);
 
@@ -172,7 +172,7 @@ static void FUNC_NAME(reset)(CACHE *cache, CHANNEL *channel, SpiceMsgWaitForChan
     uint64_t serial;
     uint32_t i;
 
-    serial = channel_message_serial((RedChannel *)channel);
+    serial = red_channel_get_message_serial((RedChannel *)channel);
     pthread_mutex_lock(&cache->lock);
     PRIVATE_FUNC_NAME(clear)(cache);
 
diff --git a/server/red_tunnel_worker.c b/server/red_tunnel_worker.c
index 5f20ddb..fdbe46e 100644
--- a/server/red_tunnel_worker.c
+++ b/server/red_tunnel_worker.c
@@ -2173,8 +2173,8 @@ static int tunnel_channel_handle_migrate_data(TunnelChannel *channel,
         goto error;
     }
 
-    ASSERT(channel->base.send_data.header.serial == 0);
-    channel->base.send_data.header.serial = migrate_data->message_serial;
+    ASSERT(red_channel_get_message_serial(&channel->base) == 0);
+    red_channel_set_message_serial(&channel->base, migrate_data->message_serial);
 
     net_slirp_state_restore(migrate_data->data + migrate_data->slirp_state);
 
diff --git a/server/red_worker.c b/server/red_worker.c
index 97218d7..f3c3dff 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -1259,11 +1259,6 @@ static inline void red_pipe_add_image_item_after(RedWorker *worker, ImageItem *i
     red_channel_pipe_add_after(&worker->display_channel->common.base, &item->link, pos);
 }
 
-static inline uint64_t channel_message_serial(RedChannel *channel)
-{
-    return channel->send_data.header->serial;
-}
-
 static void release_image_item(ImageItem *item)
 {
     if (!--item->refs) {
@@ -7626,7 +7621,7 @@ static void display_channel_send_migrate_data(DisplayChannel *display_channel)
     ASSERT(MAX_CACHE_CLIENTS == 4); //MIGRATE_DATA_VERSION dependent
     display_data.version = DISPLAY_MIGRATE_DATA_VERSION;
 
-    display_data.message_serial = channel_message_serial((RedChannel *)display_channel);
+    display_data.message_serial = red_channel_get_message_serial((RedChannel *)display_channel);
 
     display_data.pixmap_cache_freezer = pixmap_cache_freeze(display_channel->pixmap_cache);
     display_data.pixmap_cache_id = display_channel->pixmap_cache->id;
-- 
1.7.4



More information about the Spice-devel mailing list