summaryrefslogtreecommitdiffstats
path: root/server/red_client_shared_cache.h
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2010-11-13 13:23:02 +0200
committerAlon Levy <alevy@redhat.com>2011-08-23 17:42:36 +0300
commit7e8e13593ee681cf04c349bca57dd225d7802494 (patch)
treef47be108ffe570dfa942502b8bad837551db4720 /server/red_client_shared_cache.h
parent75b6a305ff9c42a89c9db91277027d5dc6d103ef (diff)
downloadspice-7e8e13593ee681cf04c349bca57dd225d7802494.tar.gz
spice-7e8e13593ee681cf04c349bca57dd225d7802494.tar.xz
spice-7e8e13593ee681cf04c349bca57dd225d7802494.zip
server/red_channel (all): introduce RedChannelClient
This commit adds a RedChannelClient that now owns the stream connection, but still doesn't own the pipe. There is only a single RCC per RC right now (and RC still means RedChannel, RedClient will be introduced later). All internal api changes are in server/red_channel.h, hence the need to update all channels. red_worker.c is affected the most because it makes use of direct access to some of RedChannel still. API changes: 1. red_channel_client_create added. rec_channel_create -> (red_channel_create, red_channel_client_create) 2. two way connection: rcc->channel, channel->rcc (later channel will hold a list, and there will be a RedClient to hold the list of channels per client) 3. seperation of channel disconnect and channel_client_disconnect TODO: usbredir added untested.
Diffstat (limited to 'server/red_client_shared_cache.h')
-rw-r--r--server/red_client_shared_cache.h17
1 files changed, 11 insertions, 6 deletions
diff --git a/server/red_client_shared_cache.h b/server/red_client_shared_cache.h
index 74553c0c..dddccc62 100644
--- a/server/red_client_shared_cache.h
+++ b/server/red_client_shared_cache.h
@@ -26,6 +26,7 @@
#define FUNC_NAME(name) pixmap_cache_##name
#define PRIVATE_FUNC_NAME(name) __pixmap_cache_##name
#define CHANNEL DisplayChannel
+#define CHANNEL_FROM_RCC(rcc) SPICE_CONTAINEROF(rcc->channel, CHANNEL, common.base);
#define CACH_GENERATION pixmap_cache_generation
#define INVAL_ALL_VERB SPICE_MSG_DISPLAY_INVAL_ALL_PIXMAPS
#else
@@ -35,12 +36,13 @@
#endif
-static int FUNC_NAME(hit)(CACHE *cache, uint64_t id, int *lossy, CHANNEL *channel)
+static int FUNC_NAME(hit)(CACHE *cache, uint64_t id, int *lossy, RedChannelClient *rcc)
{
+ CHANNEL *channel = CHANNEL_FROM_RCC(rcc);
NewCacheItem *item;
uint64_t serial;
- serial = red_channel_get_message_serial((RedChannel *)channel);
+ serial = red_channel_client_get_message_serial(rcc);
pthread_mutex_lock(&cache->lock);
item = cache->hash_table[CACHE_HASH_KEY(id)];
@@ -79,8 +81,9 @@ static int FUNC_NAME(set_lossy)(CACHE *cache, uint64_t id, int lossy)
return !!item;
}
-static int FUNC_NAME(add)(CACHE *cache, uint64_t id, uint32_t size, int lossy, CHANNEL *channel)
+static int FUNC_NAME(add)(CACHE *cache, uint64_t id, uint32_t size, int lossy, RedChannelClient *rcc)
{
+ CHANNEL *channel = CHANNEL_FROM_RCC(rcc);
NewCacheItem *item;
uint64_t serial;
int key;
@@ -88,7 +91,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 = red_channel_get_message_serial((RedChannel *)channel);
+ serial = red_channel_client_get_message_serial(rcc);
pthread_mutex_lock(&cache->lock);
@@ -166,13 +169,14 @@ static void PRIVATE_FUNC_NAME(clear)(CACHE *cache)
cache->items = 0;
}
-static void FUNC_NAME(reset)(CACHE *cache, CHANNEL *channel, SpiceMsgWaitForChannels* sync_data)
+static void FUNC_NAME(reset)(CACHE *cache, RedChannelClient *rcc, SpiceMsgWaitForChannels* sync_data)
{
+ CHANNEL *channel = CHANNEL_FROM_RCC(rcc);
uint8_t wait_count;
uint64_t serial;
uint32_t i;
- serial = red_channel_get_message_serial((RedChannel *)channel);
+ serial = red_channel_client_get_message_serial(rcc);
pthread_mutex_lock(&cache->lock);
PRIVATE_FUNC_NAME(clear)(cache);
@@ -230,4 +234,5 @@ static void FUNC_NAME(destroy)(CACHE *cache)
#undef FUNC_NAME
#undef VAR_NAME
#undef CHANNEL
+#undef CHANNEL_FROM_RCC