[Spice-devel] [PATCH 5/5] remove CommonGraphicsChannelClient structure

Frediano Ziglio fziglio at redhat.com
Sat May 7 13:49:55 UTC 2016


Was just containing a RedChannelClient field

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/cache-item.tmpl.c |  2 +-
 server/cursor-channel.c  |  4 ++--
 server/dcc.c             | 10 +++++-----
 server/dcc.h             |  8 ++++----
 server/display-channel.c |  4 ++--
 server/display-channel.h |  2 +-
 server/red-worker.h      |  4 ----
 server/stream.c          |  2 +-
 8 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/server/cache-item.tmpl.c b/server/cache-item.tmpl.c
index 0617bea..81dc1d7 100644
--- a/server/cache-item.tmpl.c
+++ b/server/cache-item.tmpl.c
@@ -82,7 +82,7 @@ static void FUNC_NAME(remove)(CHANNELCLIENT *channel_client, RedCacheItem *item)
     channel_client->VAR_NAME(available) += item->size;
 
     red_pipe_item_init(&item->u.pipe_data, RED_PIPE_ITEM_TYPE_INVAL_ONE);
-    red_channel_client_pipe_add_tail_and_push(&channel_client->common.base, &item->u.pipe_data); // for now
+    red_channel_client_pipe_add_tail_and_push(&channel_client->base, &item->u.pipe_data); // for now
 }
 
 static int FUNC_NAME(add)(CHANNELCLIENT *channel_client, uint64_t id, size_t size)
diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index 967782c..4e13f68 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -67,7 +67,7 @@ struct CursorChannel {
 };
 
 struct CursorChannelClient {
-    CommonGraphicsChannelClient common;
+    RedChannelClient base;
 
     RedCacheItem *cursor_cache[CURSOR_CACHE_HASH_SIZE];
     Ring cursor_cache_lru;
@@ -76,7 +76,7 @@ struct CursorChannelClient {
 };
 
 
-#define RCC_TO_CCC(rcc) SPICE_CONTAINEROF((rcc), CursorChannelClient, common.base)
+#define RCC_TO_CCC(rcc) SPICE_CONTAINEROF((rcc), CursorChannelClient, base)
 
 #define CLIENT_CURSOR_CACHE
 #include "cache-item.tmpl.c"
diff --git a/server/dcc.c b/server/dcc.c
index 8a79f89..701d30d 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -549,15 +549,15 @@ void dcc_push_monitors_config(DisplayChannelClient *dcc)
         return;
     }
 
-    if (!red_channel_client_test_remote_cap(&dcc->common.base,
+    if (!red_channel_client_test_remote_cap(&dcc->base,
                                             SPICE_DISPLAY_CAP_MONITORS_CONFIG)) {
         return;
     }
 
-    mci = red_monitors_config_item_new(dcc->common.base.channel,
+    mci = red_monitors_config_item_new(dcc->base.channel,
                                        monitors_config_ref(dc->monitors_config));
-    red_channel_client_pipe_add(&dcc->common.base, &mci->pipe_item);
-    red_channel_client_push(&dcc->common.base);
+    red_channel_client_pipe_add(&dcc->base, &mci->pipe_item);
+    red_channel_client_push(&dcc->base);
 }
 
 static RedSurfaceDestroyItem *red_surface_destroy_item_new(RedChannel *channel,
@@ -1222,7 +1222,7 @@ int dcc_compress_image(DisplayChannelClient *dcc,
         goto lz_compress;
 #ifdef USE_LZ4
     case SPICE_IMAGE_COMPRESSION_LZ4:
-        if (red_channel_client_test_remote_cap(&dcc->common.base,
+        if (red_channel_client_test_remote_cap(&dcc->base,
                                                SPICE_DISPLAY_CAP_LZ4_COMPRESSION)) {
             success = dcc_compress_image_lz4(dcc, dest, src, o_comp_data);
             break;
diff --git a/server/dcc.h b/server/dcc.h
index ae60eb7..4cf7378 100644
--- a/server/dcc.h
+++ b/server/dcc.h
@@ -55,7 +55,7 @@ typedef struct FreeList {
 } FreeList;
 
 struct DisplayChannelClient {
-    CommonGraphicsChannelClient common;
+    RedChannelClient base;
     int is_low_bandwidth;
     uint32_t id;
     SpiceImageCompression image_compression;
@@ -117,10 +117,10 @@ struct DisplayChannelClient {
 };
 
 #define DCC_TO_WORKER(dcc)                                              \
-    (SPICE_CONTAINEROF((dcc)->common.base.channel, CommonGraphicsChannel, base)->worker)
+    (SPICE_CONTAINEROF((dcc)->base.channel, CommonGraphicsChannel, base)->worker)
 #define DCC_TO_DC(dcc)                                                  \
-     SPICE_CONTAINEROF((dcc)->common.base.channel, DisplayChannel, common.base)
-#define RCC_TO_DCC(rcc) SPICE_CONTAINEROF((rcc), DisplayChannelClient, common.base)
+     SPICE_CONTAINEROF((dcc)->base.channel, DisplayChannel, common.base)
+#define RCC_TO_DCC(rcc) SPICE_CONTAINEROF((rcc), DisplayChannelClient, base)
 
 typedef struct RedSurfaceCreateItem {
     SpiceMsgSurfaceCreate surface_create;
diff --git a/server/display-channel.c b/server/display-channel.c
index a037e88..2c4b68f 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -510,14 +510,14 @@ static int current_add_equal(DisplayChannel *display, DrawItem *item, TreeItem *
             /* dpi contains a sublist of dcc's, ordered the same */
             while (worker_ring_item) {
                 dcc = SPICE_CONTAINEROF(worker_ring_item, DisplayChannelClient,
-                                        common.base.channel_link);
+                                        base.channel_link);
                 dpi = SPICE_CONTAINEROF(dpi_ring_item, RedDrawablePipeItem, base);
                 while (worker_ring_item && (!dpi || dcc != dpi->dcc)) {
                     dcc_prepend_drawable(dcc, drawable);
                     worker_ring_item = ring_next(&RED_CHANNEL(display)->clients,
                                                  worker_ring_item);
                     dcc = SPICE_CONTAINEROF(worker_ring_item, DisplayChannelClient,
-                                            common.base.channel_link);
+                                            base.channel_link);
                 }
 
                 if (dpi_ring_item) {
diff --git a/server/display-channel.h b/server/display-channel.h
index 84ec8ab..b9d6b9c 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -227,7 +227,7 @@ struct DisplayChannel {
 };
 
 #define LINK_TO_DCC(ptr) SPICE_CONTAINEROF(ptr, DisplayChannelClient,   \
-                                           common.base.channel_link)
+                                           base.channel_link)
 #define DCC_FOREACH_SAFE(link, next, dcc, channel)                      \
     SAFE_FOREACH(link, next, channel,  &(channel)->clients, dcc, LINK_TO_DCC(link))
 
diff --git a/server/red-worker.h b/server/red-worker.h
index 3798186..f12459d 100644
--- a/server/red-worker.h
+++ b/server/red-worker.h
@@ -24,10 +24,6 @@
 
 typedef struct RedWorker RedWorker;
 
-typedef struct CommonGraphicsChannelClient {
-    RedChannelClient base;
-} CommonGraphicsChannelClient;
-
 int common_channel_config_socket(RedChannelClient *rcc);
 
 #define COMMON_CLIENT_TIMEOUT (NSEC_PER_SEC * 30)
diff --git a/server/stream.c b/server/stream.c
index 0b676c1..986360f 100644
--- a/server/stream.c
+++ b/server/stream.c
@@ -682,7 +682,7 @@ static void update_client_playback_delay(void *opaque, uint32_t delay_ms)
 {
     StreamAgent *agent = opaque;
     DisplayChannelClient *dcc = agent->dcc;
-    RedsState *reds = red_channel_get_server(dcc->common.base.channel);
+    RedsState *reds = red_channel_get_server(dcc->base.channel);
 
     dcc_update_streams_max_latency(dcc, agent);
 
-- 
2.5.5



More information about the Spice-devel mailing list