[Spice-devel] [PATCH 10/16] Rename all RedPipeItem subclasses
Jonathon Jongsma
jjongsma at redhat.com
Tue Apr 19 16:00:04 UTC 2016
Use 'Red' prefix to match internal type naming convention
---
server/cache-item.h | 6 +-
server/cache-item.tmpl.c | 18 ++--
server/cursor-channel.c | 71 ++++++++--------
server/dcc-send.c | 155 ++++++++++++++++++----------------
server/dcc.c | 189 +++++++++++++++++++++--------------------
server/dcc.h | 24 +++---
server/display-channel.c | 22 ++---
server/display-channel.h | 46 +++++-----
server/inputs-channel.c | 52 ++++++------
server/main-channel.c | 214 +++++++++++++++++++++++------------------------
server/red-channel.c | 34 ++++----
server/red-channel.h | 10 +--
server/red-worker.h | 16 ++--
server/reds.c | 35 ++++----
server/smartcard.c | 53 ++++++------
server/spicevmc.c | 56 ++++++-------
server/stream.c | 26 +++---
server/stream.h | 10 +--
18 files changed, 529 insertions(+), 508 deletions(-)
diff --git a/server/cache-item.h b/server/cache-item.h
index 90c82d3..7dde902 100644
--- a/server/cache-item.h
+++ b/server/cache-item.h
@@ -21,14 +21,14 @@
#include "red-channel.h"
#include "common/ring.h"
-typedef struct CacheItem CacheItem;
+typedef struct RedCacheItem RedCacheItem;
-struct CacheItem {
+struct RedCacheItem {
union {
RedPipeItem pipe_data;
struct {
RingItem lru_link;
- CacheItem *next;
+ RedCacheItem *next;
} cache_data;
} u;
uint64_t id;
diff --git a/server/cache-item.tmpl.c b/server/cache-item.tmpl.c
index d63e576..0617bea 100644
--- a/server/cache-item.tmpl.c
+++ b/server/cache-item.tmpl.c
@@ -48,9 +48,9 @@
#define CHANNEL_FROM_RCC(rcc) SPICE_CONTAINEROF((rcc)->channel, CHANNEL, common.base);
-static CacheItem *FUNC_NAME(find)(CHANNELCLIENT *channel_client, uint64_t id)
+static RedCacheItem *FUNC_NAME(find)(CHANNELCLIENT *channel_client, uint64_t id)
{
- CacheItem *item = channel_client->CACHE_NAME[CACHE_HASH_KEY(id)];
+ RedCacheItem *item = channel_client->CACHE_NAME[CACHE_HASH_KEY(id)];
while (item) {
if (item->id == id) {
@@ -63,9 +63,9 @@ static CacheItem *FUNC_NAME(find)(CHANNELCLIENT *channel_client, uint64_t id)
return item;
}
-static void FUNC_NAME(remove)(CHANNELCLIENT *channel_client, CacheItem *item)
+static void FUNC_NAME(remove)(CHANNELCLIENT *channel_client, RedCacheItem *item)
{
- CacheItem **now;
+ RedCacheItem **now;
spice_assert(item);
now = &channel_client->CACHE_NAME[CACHE_HASH_KEY(item->id)];
@@ -81,20 +81,20 @@ static void FUNC_NAME(remove)(CHANNELCLIENT *channel_client, CacheItem *item)
channel_client->VAR_NAME(items)--;
channel_client->VAR_NAME(available) += item->size;
- red_pipe_item_init(&item->u.pipe_data, PIPE_ITEM_TYPE_INVAL_ONE);
+ 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
}
static int FUNC_NAME(add)(CHANNELCLIENT *channel_client, uint64_t id, size_t size)
{
- CacheItem *item;
+ RedCacheItem *item;
int key;
- item = spice_new(CacheItem, 1);
+ item = spice_new(RedCacheItem, 1);
channel_client->VAR_NAME(available) -= size;
while (channel_client->VAR_NAME(available) < 0) {
- CacheItem *tail = (CacheItem *)ring_get_tail(&channel_client->VAR_NAME(lru));
+ RedCacheItem *tail = (RedCacheItem *)ring_get_tail(&channel_client->VAR_NAME(lru));
if (!tail) {
channel_client->VAR_NAME(available) += size;
free(item);
@@ -119,7 +119,7 @@ static void FUNC_NAME(reset)(CHANNELCLIENT *channel_client, long size)
for (i = 0; i < CACHE_HASH_SIZE; i++) {
while (channel_client->CACHE_NAME[i]) {
- CacheItem *item = channel_client->CACHE_NAME[i];
+ RedCacheItem *item = channel_client->CACHE_NAME[i];
channel_client->CACHE_NAME[i] = item->u.cache_data.next;
free(item);
}
diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index e2bb706..697d61d 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -32,9 +32,9 @@
#define CURSOR_CACHE_HASH_KEY(id) ((id) & CURSOR_CACHE_HASH_MASK)
enum {
- PIPE_ITEM_TYPE_CURSOR = PIPE_ITEM_TYPE_COMMON_LAST,
- PIPE_ITEM_TYPE_CURSOR_INIT,
- PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE,
+ RED_PIPE_ITEM_TYPE_CURSOR = RED_PIPE_ITEM_TYPE_COMMON_LAST,
+ RED_PIPE_ITEM_TYPE_CURSOR_INIT,
+ RED_PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE,
};
typedef struct CursorItem {
@@ -45,11 +45,11 @@ typedef struct CursorItem {
G_STATIC_ASSERT(sizeof(CursorItem) <= QXL_CURSUR_DEVICE_DATA_SIZE);
-typedef struct CursorPipeItem {
+typedef struct RedCursorPipeItem {
RedPipeItem base;
CursorItem *cursor_item;
int refs;
-} CursorPipeItem;
+} RedCursorPipeItem;
struct CursorChannel {
CommonGraphicsChannel common; // Must be the first thing
@@ -69,7 +69,7 @@ struct CursorChannel {
struct CursorChannelClient {
CommonGraphicsChannelClient common;
- CacheItem *cursor_cache[CURSOR_CACHE_HASH_SIZE];
+ RedCacheItem *cursor_cache[CURSOR_CACHE_HASH_SIZE];
Ring cursor_cache_lru;
long cursor_cache_available;
uint32_t cursor_cache_items;
@@ -134,9 +134,9 @@ static void cursor_set_item(CursorChannel *cursor, CursorItem *item)
static RedPipeItem *new_cursor_pipe_item(RedChannelClient *rcc, void *data, int num)
{
- CursorPipeItem *item = spice_malloc0(sizeof(CursorPipeItem));
+ RedCursorPipeItem *item = spice_malloc0(sizeof(RedCursorPipeItem));
- red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_CURSOR);
+ red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_CURSOR);
item->refs = 1;
item->cursor_item = data;
item->cursor_item->refs++;
@@ -203,7 +203,8 @@ void cursor_channel_disconnect(CursorChannel *cursor_channel)
}
-static void put_cursor_pipe_item(CursorChannelClient *ccc, CursorPipeItem *pipe_item)
+static void put_cursor_pipe_item(CursorChannelClient *ccc,
+ RedCursorPipeItem *pipe_item)
{
spice_return_if_fail(pipe_item);
spice_return_if_fail(pipe_item->refs > 0);
@@ -232,15 +233,15 @@ static void cursor_channel_client_release_item_before_push(CursorChannelClient *
RedPipeItem *item)
{
switch (item->type) {
- case PIPE_ITEM_TYPE_CURSOR: {
- CursorPipeItem *cursor_pipe_item = SPICE_CONTAINEROF(item, CursorPipeItem, base);
+ case RED_PIPE_ITEM_TYPE_CURSOR: {
+ RedCursorPipeItem *cursor_pipe_item = SPICE_CONTAINEROF(item, RedCursorPipeItem, base);
put_cursor_pipe_item(ccc, cursor_pipe_item);
break;
}
- case PIPE_ITEM_TYPE_INVAL_ONE:
- case PIPE_ITEM_TYPE_VERB:
- case PIPE_ITEM_TYPE_CURSOR_INIT:
- case PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE:
+ case RED_PIPE_ITEM_TYPE_INVAL_ONE:
+ case RED_PIPE_ITEM_TYPE_VERB:
+ case RED_PIPE_ITEM_TYPE_CURSOR_INIT:
+ case RED_PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE:
free(item);
break;
default:
@@ -252,8 +253,8 @@ static void cursor_channel_client_release_item_after_push(CursorChannelClient *c
RedPipeItem *item)
{
switch (item->type) {
- case PIPE_ITEM_TYPE_CURSOR: {
- CursorPipeItem *cursor_pipe_item = SPICE_CONTAINEROF(item, CursorPipeItem, base);
+ case RED_PIPE_ITEM_TYPE_CURSOR: {
+ RedCursorPipeItem *cursor_pipe_item = SPICE_CONTAINEROF(item, RedCursorPipeItem, base);
put_cursor_pipe_item(ccc, cursor_pipe_item);
break;
}
@@ -285,7 +286,8 @@ static void red_marshall_cursor_init(RedChannelClient *rcc, SpiceMarshaller *bas
}
static void cursor_marshall(RedChannelClient *rcc,
- SpiceMarshaller *m, CursorPipeItem *cursor_pipe_item)
+ SpiceMarshaller *m,
+ RedCursorPipeItem *cursor_pipe_item)
{
CursorChannel *cursor_channel = SPICE_CONTAINEROF(rcc->channel, CursorChannel, common.base);
CursorChannelClient *ccc = RCC_TO_CCC(rcc);
@@ -338,7 +340,8 @@ static void cursor_marshall(RedChannelClient *rcc,
}
static inline void red_marshall_inval(RedChannelClient *rcc,
- SpiceMarshaller *base_marshaller, CacheItem *cach_item)
+ SpiceMarshaller *base_marshaller,
+ RedCacheItem *cach_item)
{
SpiceMsgDisplayInvalOne inval_one;
@@ -354,20 +357,20 @@ static void cursor_channel_send_item(RedChannelClient *rcc, RedPipeItem *pipe_it
CursorChannelClient *ccc = RCC_TO_CCC(rcc);
switch (pipe_item->type) {
- case PIPE_ITEM_TYPE_CURSOR:
- cursor_marshall(rcc, m, SPICE_CONTAINEROF(pipe_item, CursorPipeItem, base));
+ case RED_PIPE_ITEM_TYPE_CURSOR:
+ cursor_marshall(rcc, m, SPICE_CONTAINEROF(pipe_item, RedCursorPipeItem, base));
break;
- case PIPE_ITEM_TYPE_INVAL_ONE:
- red_marshall_inval(rcc, m, (CacheItem *)pipe_item);
+ case RED_PIPE_ITEM_TYPE_INVAL_ONE:
+ red_marshall_inval(rcc, m, (RedCacheItem *)pipe_item);
break;
- case PIPE_ITEM_TYPE_VERB:
- red_marshall_verb(rcc, (VerbItem*)pipe_item);
+ case RED_PIPE_ITEM_TYPE_VERB:
+ red_marshall_verb(rcc, (RedVerbItem*)pipe_item);
break;
- case PIPE_ITEM_TYPE_CURSOR_INIT:
+ case RED_PIPE_ITEM_TYPE_CURSOR_INIT:
red_reset_cursor_cache(rcc);
red_marshall_cursor_init(rcc, m, pipe_item);
break;
- case PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE:
+ case RED_PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE:
red_reset_cursor_cache(rcc);
red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_INVAL_ALL, NULL);
break;
@@ -379,7 +382,7 @@ static void cursor_channel_send_item(RedChannelClient *rcc, RedPipeItem *pipe_it
red_channel_client_begin_send_message(rcc);
}
-static CursorPipeItem *cursor_pipe_item_ref(CursorPipeItem *item)
+static RedCursorPipeItem *cursor_pipe_item_ref(RedCursorPipeItem *item)
{
spice_return_val_if_fail(item, NULL);
spice_return_val_if_fail(item->refs > 0, NULL);
@@ -391,11 +394,11 @@ static CursorPipeItem *cursor_pipe_item_ref(CursorPipeItem *item)
static void cursor_channel_hold_pipe_item(RedChannelClient *rcc, RedPipeItem *item)
{
- CursorPipeItem *cursor_pipe_item;
+ RedCursorPipeItem *cursor_pipe_item;
spice_return_if_fail(item);
- cursor_pipe_item = SPICE_CONTAINEROF(item, CursorPipeItem, base);
+ cursor_pipe_item = SPICE_CONTAINEROF(item, RedCursorPipeItem, base);
cursor_pipe_item_ref(cursor_pipe_item);
}
@@ -443,7 +446,7 @@ void cursor_channel_client_migrate(CursorChannelClient* client)
spice_return_if_fail(client);
rcc = RED_CHANNEL_CLIENT(client);
- red_channel_client_pipe_add_type(rcc, PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE);
+ red_channel_client_pipe_add_type(rcc, RED_PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE);
red_channel_client_default_migrate(rcc);
}
@@ -531,7 +534,7 @@ void cursor_channel_reset(CursorChannel *cursor)
cursor->cursor_trail_length = cursor->cursor_trail_frequency = 0;
if (red_channel_is_connected(channel)) {
- red_channel_pipes_add_type(channel, PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE);
+ red_channel_pipes_add_type(channel, RED_PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE);
if (!cursor->common.during_target_migrate) {
red_pipes_add_verb(channel, SPICE_MSG_CURSOR_RESET);
}
@@ -555,9 +558,9 @@ void cursor_channel_init(CursorChannel *cursor, CursorChannelClient *client)
if (client)
red_channel_client_pipe_add_type(RED_CHANNEL_CLIENT(client),
- PIPE_ITEM_TYPE_CURSOR_INIT);
+ RED_PIPE_ITEM_TYPE_CURSOR_INIT);
else
- red_channel_pipes_add_type(RED_CHANNEL(cursor), PIPE_ITEM_TYPE_CURSOR_INIT);
+ red_channel_pipes_add_type(RED_CHANNEL(cursor), RED_PIPE_ITEM_TYPE_CURSOR_INIT);
}
void cursor_channel_set_mouse_mode(CursorChannel *cursor, uint32_t mode)
diff --git a/server/dcc-send.c b/server/dcc-send.c
index 799d5df..efbc454 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -514,7 +514,7 @@ static void fill_attr(SpiceMarshaller *m, SpiceLineAttr *attr)
static void marshall_qxl_draw_fill(RedChannelClient *rcc,
SpiceMarshaller *base_marshaller,
- DrawablePipeItem *dpi)
+ RedDrawablePipeItem *dpi)
{
Drawable *item = dpi->drawable;
RedDrawable *drawable = item->red_drawable;
@@ -608,9 +608,9 @@ static int pipe_rendered_drawables_intersect_with_areas(DisplayChannelClient *dc
{
Drawable *drawable;
- if (pipe_item->type != PIPE_ITEM_TYPE_DRAW)
+ if (pipe_item->type != RED_PIPE_ITEM_TYPE_DRAW)
continue;
- drawable = SPICE_CONTAINEROF(pipe_item, DrawablePipeItem, dpi_pipe_item)->drawable;
+ drawable = SPICE_CONTAINEROF(pipe_item, RedDrawablePipeItem, dpi_pipe_item)->drawable;
if (ring_item_is_linked(&drawable->list_link))
continue; // item hasn't been rendered
@@ -699,12 +699,12 @@ static void red_pipe_replace_rendered_drawables_with_images(DisplayChannelClient
pipe_item;
pipe_item = (RedPipeItem *)ring_prev(pipe, &pipe_item->link)) {
Drawable *drawable;
- DrawablePipeItem *dpi;
- ImageItem *image;
+ RedDrawablePipeItem *dpi;
+ RedImageItem *image;
- if (pipe_item->type != PIPE_ITEM_TYPE_DRAW)
+ if (pipe_item->type != RED_PIPE_ITEM_TYPE_DRAW)
continue;
- dpi = SPICE_CONTAINEROF(pipe_item, DrawablePipeItem, dpi_pipe_item);
+ dpi = SPICE_CONTAINEROF(pipe_item, RedDrawablePipeItem, dpi_pipe_item);
drawable = dpi->drawable;
if (ring_item_is_linked(&drawable->list_link))
continue; // item hasn't been rendered
@@ -803,7 +803,7 @@ static void red_add_lossless_drawable_dependencies(RedChannelClient *rcc,
static void red_lossy_marshall_qxl_draw_fill(RedChannelClient *rcc,
SpiceMarshaller *m,
- DrawablePipeItem *dpi)
+ RedDrawablePipeItem *dpi)
{
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
Drawable *item = dpi->drawable;
@@ -860,7 +860,8 @@ static void red_lossy_marshall_qxl_draw_fill(RedChannelClient *rcc,
static FillBitsType red_marshall_qxl_draw_opaque(RedChannelClient *rcc,
SpiceMarshaller *base_marshaller,
- DrawablePipeItem *dpi, int src_allowed_lossy)
+ RedDrawablePipeItem *dpi,
+ int src_allowed_lossy)
{
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
Drawable *item = dpi->drawable;
@@ -893,7 +894,7 @@ static FillBitsType red_marshall_qxl_draw_opaque(RedChannelClient *rcc,
static void red_lossy_marshall_qxl_draw_opaque(RedChannelClient *rcc,
SpiceMarshaller *m,
- DrawablePipeItem *dpi)
+ RedDrawablePipeItem *dpi)
{
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
Drawable *item = dpi->drawable;
@@ -958,7 +959,8 @@ static void red_lossy_marshall_qxl_draw_opaque(RedChannelClient *rcc,
static FillBitsType red_marshall_qxl_draw_copy(RedChannelClient *rcc,
SpiceMarshaller *base_marshaller,
- DrawablePipeItem *dpi, int src_allowed_lossy)
+ RedDrawablePipeItem *dpi,
+ int src_allowed_lossy)
{
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
Drawable *item = dpi->drawable;
@@ -984,7 +986,7 @@ static FillBitsType red_marshall_qxl_draw_copy(RedChannelClient *rcc,
static void red_lossy_marshall_qxl_draw_copy(RedChannelClient *rcc,
SpiceMarshaller *base_marshaller,
- DrawablePipeItem *dpi)
+ RedDrawablePipeItem *dpi)
{
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
Drawable *item = dpi->drawable;
@@ -1009,7 +1011,7 @@ static void red_lossy_marshall_qxl_draw_copy(RedChannelClient *rcc,
static void red_marshall_qxl_draw_transparent(RedChannelClient *rcc,
SpiceMarshaller *base_marshaller,
- DrawablePipeItem *dpi)
+ RedDrawablePipeItem *dpi)
{
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
Drawable *item = dpi->drawable;
@@ -1029,7 +1031,7 @@ static void red_marshall_qxl_draw_transparent(RedChannelClient *rcc,
static void red_lossy_marshall_qxl_draw_transparent(RedChannelClient *rcc,
SpiceMarshaller *base_marshaller,
- DrawablePipeItem *dpi)
+ RedDrawablePipeItem *dpi)
{
Drawable *item = dpi->drawable;
RedDrawable *drawable = item->red_drawable;
@@ -1056,7 +1058,7 @@ static void red_lossy_marshall_qxl_draw_transparent(RedChannelClient *rcc,
static FillBitsType red_marshall_qxl_draw_alpha_blend(RedChannelClient *rcc,
SpiceMarshaller *base_marshaller,
- DrawablePipeItem *dpi,
+ RedDrawablePipeItem *dpi,
int src_allowed_lossy)
{
Drawable *item = dpi->drawable;
@@ -1081,7 +1083,7 @@ static FillBitsType red_marshall_qxl_draw_alpha_blend(RedChannelClient *rcc,
static void red_lossy_marshall_qxl_draw_alpha_blend(RedChannelClient *rcc,
SpiceMarshaller *base_marshaller,
- DrawablePipeItem *dpi)
+ RedDrawablePipeItem *dpi)
{
Drawable *item = dpi->drawable;
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
@@ -1108,7 +1110,7 @@ static void red_lossy_marshall_qxl_draw_alpha_blend(RedChannelClient *rcc,
static void red_marshall_qxl_copy_bits(RedChannelClient *rcc,
SpiceMarshaller *base_marshaller,
- DrawablePipeItem *dpi)
+ RedDrawablePipeItem *dpi)
{
Drawable *item = dpi->drawable;
RedDrawable *drawable = item->red_drawable;
@@ -1123,7 +1125,7 @@ static void red_marshall_qxl_copy_bits(RedChannelClient *rcc,
static void red_lossy_marshall_qxl_copy_bits(RedChannelClient *rcc,
SpiceMarshaller *base_marshaller,
- DrawablePipeItem *dpi)
+ RedDrawablePipeItem *dpi)
{
Drawable *item = dpi->drawable;
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
@@ -1152,7 +1154,7 @@ static void red_lossy_marshall_qxl_copy_bits(RedChannelClient *rcc,
static void red_marshall_qxl_draw_blend(RedChannelClient *rcc,
SpiceMarshaller *base_marshaller,
- DrawablePipeItem *dpi)
+ RedDrawablePipeItem *dpi)
{
Drawable *item = dpi->drawable;
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
@@ -1176,7 +1178,7 @@ static void red_marshall_qxl_draw_blend(RedChannelClient *rcc,
static void red_lossy_marshall_qxl_draw_blend(RedChannelClient *rcc,
SpiceMarshaller *base_marshaller,
- DrawablePipeItem *dpi)
+ RedDrawablePipeItem *dpi)
{
Drawable *item = dpi->drawable;
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
@@ -1218,7 +1220,7 @@ static void red_lossy_marshall_qxl_draw_blend(RedChannelClient *rcc,
static void red_marshall_qxl_draw_blackness(RedChannelClient *rcc,
SpiceMarshaller *base_marshaller,
- DrawablePipeItem *dpi)
+ RedDrawablePipeItem *dpi)
{
Drawable *item = dpi->drawable;
RedDrawable *drawable = item->red_drawable;
@@ -1238,7 +1240,7 @@ static void red_marshall_qxl_draw_blackness(RedChannelClient *rcc,
static void red_lossy_marshall_qxl_draw_blackness(RedChannelClient *rcc,
SpiceMarshaller *base_marshaller,
- DrawablePipeItem *dpi)
+ RedDrawablePipeItem *dpi)
{
Drawable *item = dpi->drawable;
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
@@ -1252,7 +1254,7 @@ static void red_lossy_marshall_qxl_draw_blackness(RedChannelClient *rcc,
static void red_marshall_qxl_draw_whiteness(RedChannelClient *rcc,
SpiceMarshaller *base_marshaller,
- DrawablePipeItem *dpi)
+ RedDrawablePipeItem *dpi)
{
Drawable *item = dpi->drawable;
RedDrawable *drawable = item->red_drawable;
@@ -1272,7 +1274,7 @@ static void red_marshall_qxl_draw_whiteness(RedChannelClient *rcc,
static void red_lossy_marshall_qxl_draw_whiteness(RedChannelClient *rcc,
SpiceMarshaller *base_marshaller,
- DrawablePipeItem *dpi)
+ RedDrawablePipeItem *dpi)
{
Drawable *item = dpi->drawable;
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
@@ -1312,7 +1314,7 @@ static void red_lossy_marshall_qxl_draw_inverse(RedChannelClient *rcc,
static void red_marshall_qxl_draw_rop3(RedChannelClient *rcc,
SpiceMarshaller *base_marshaller,
- DrawablePipeItem *dpi)
+ RedDrawablePipeItem *dpi)
{
Drawable *item = dpi->drawable;
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
@@ -1341,7 +1343,7 @@ static void red_marshall_qxl_draw_rop3(RedChannelClient *rcc,
static void red_lossy_marshall_qxl_draw_rop3(RedChannelClient *rcc,
SpiceMarshaller *base_marshaller,
- DrawablePipeItem *dpi)
+ RedDrawablePipeItem *dpi)
{
Drawable *item = dpi->drawable;
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
@@ -1396,7 +1398,7 @@ static void red_lossy_marshall_qxl_draw_rop3(RedChannelClient *rcc,
static void red_marshall_qxl_draw_composite(RedChannelClient *rcc,
SpiceMarshaller *base_marshaller,
- DrawablePipeItem *dpi)
+ RedDrawablePipeItem *dpi)
{
Drawable *item = dpi->drawable;
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
@@ -1421,7 +1423,7 @@ static void red_marshall_qxl_draw_composite(RedChannelClient *rcc,
static void red_lossy_marshall_qxl_draw_composite(RedChannelClient *rcc,
SpiceMarshaller *base_marshaller,
- DrawablePipeItem *dpi)
+ RedDrawablePipeItem *dpi)
{
Drawable *item = dpi->drawable;
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
@@ -1477,7 +1479,7 @@ static void red_lossy_marshall_qxl_draw_composite(RedChannelClient *rcc,
static void red_marshall_qxl_draw_stroke(RedChannelClient *rcc,
SpiceMarshaller *base_marshaller,
- DrawablePipeItem *dpi)
+ RedDrawablePipeItem *dpi)
{
Drawable *item = dpi->drawable;
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
@@ -1502,7 +1504,7 @@ static void red_marshall_qxl_draw_stroke(RedChannelClient *rcc,
static void red_lossy_marshall_qxl_draw_stroke(RedChannelClient *rcc,
SpiceMarshaller *base_marshaller,
- DrawablePipeItem *dpi)
+ RedDrawablePipeItem *dpi)
{
Drawable *item = dpi->drawable;
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
@@ -1557,7 +1559,7 @@ static void red_lossy_marshall_qxl_draw_stroke(RedChannelClient *rcc,
static void red_marshall_qxl_draw_text(RedChannelClient *rcc,
SpiceMarshaller *base_marshaller,
- DrawablePipeItem *dpi)
+ RedDrawablePipeItem *dpi)
{
Drawable *item = dpi->drawable;
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
@@ -1584,7 +1586,7 @@ static void red_marshall_qxl_draw_text(RedChannelClient *rcc,
static void red_lossy_marshall_qxl_draw_text(RedChannelClient *rcc,
SpiceMarshaller *base_marshaller,
- DrawablePipeItem *dpi)
+ RedDrawablePipeItem *dpi)
{
Drawable *item = dpi->drawable;
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
@@ -1768,8 +1770,8 @@ static int red_marshall_stream_data(RedChannelClient *rcc,
}
static inline void marshall_inval_palette(RedChannelClient *rcc,
- SpiceMarshaller *base_marshaller,
- CacheItem *cache_item)
+ SpiceMarshaller *base_marshaller,
+ RedCacheItem *cache_item)
{
SpiceMsgDisplayInvalOne inval_one;
@@ -1915,7 +1917,9 @@ static void display_channel_marshall_reset_cache(RedChannelClient *rcc,
&wait);
}
-static void red_marshall_image(RedChannelClient *rcc, SpiceMarshaller *m, ImageItem *item)
+static void red_marshall_image(RedChannelClient *rcc,
+ SpiceMarshaller *m,
+ RedImageItem *item)
{
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
DisplayChannel *display = DCC_TO_DC(dcc);
@@ -2009,7 +2013,7 @@ static void red_marshall_image(RedChannelClient *rcc, SpiceMarshaller *m, ImageI
static void marshall_lossy_qxl_drawable(RedChannelClient *rcc,
SpiceMarshaller *base_marshaller,
- DrawablePipeItem *dpi)
+ RedDrawablePipeItem *dpi)
{
Drawable *item = dpi->drawable;
switch (item->red_drawable->type) {
@@ -2061,7 +2065,8 @@ static void marshall_lossy_qxl_drawable(RedChannelClient *rcc,
}
static void marshall_lossless_qxl_drawable(RedChannelClient *rcc,
- SpiceMarshaller *m, DrawablePipeItem *dpi)
+ SpiceMarshaller *m,
+ RedDrawablePipeItem *dpi)
{
Drawable *item = dpi->drawable;
RedDrawable *drawable = item->red_drawable;
@@ -2115,7 +2120,8 @@ static void marshall_lossless_qxl_drawable(RedChannelClient *rcc,
}
static void marshall_qxl_drawable(RedChannelClient *rcc,
- SpiceMarshaller *m, DrawablePipeItem *dpi)
+ SpiceMarshaller *m,
+ RedDrawablePipeItem *dpi)
{
spice_return_if_fail(rcc);
@@ -2173,7 +2179,7 @@ static void marshall_stream_start(RedChannelClient *rcc,
static void marshall_stream_clip(RedChannelClient *rcc,
SpiceMarshaller *base_marshaller,
- StreamClipItem *item)
+ RedStreamClipItem *item)
{
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
StreamAgent *agent = item->stream_agent;
@@ -2203,7 +2209,7 @@ static void marshall_stream_end(RedChannelClient *rcc,
}
static void marshall_upgrade(RedChannelClient *rcc, SpiceMarshaller *m,
- UpgradeItem *item)
+ RedUpgradeItem *item)
{
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
RedDrawable *red_drawable;
@@ -2319,7 +2325,7 @@ static void marshall_gl_draw(RedChannelClient *rcc,
SpiceMarshaller *m,
RedPipeItem *item)
{
- GlDrawItem *p = SPICE_CONTAINEROF(item, GlDrawItem, base);
+ RedGlDrawItem *p = SPICE_CONTAINEROF(item, RedGlDrawItem, base);
red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_GL_DRAW, NULL);
spice_marshall_msg_display_gl_draw(m, &p->draw);
@@ -2367,80 +2373,81 @@ void dcc_send_item(DisplayChannelClient *dcc, RedPipeItem *pipe_item)
reset_send_data(dcc);
switch (pipe_item->type) {
- case PIPE_ITEM_TYPE_DRAW: {
- DrawablePipeItem *dpi = SPICE_CONTAINEROF(pipe_item, DrawablePipeItem, dpi_pipe_item);
+ case RED_PIPE_ITEM_TYPE_DRAW: {
+ RedDrawablePipeItem *dpi = SPICE_CONTAINEROF(pipe_item, RedDrawablePipeItem, dpi_pipe_item);
marshall_qxl_drawable(rcc, m, dpi);
break;
}
- case PIPE_ITEM_TYPE_INVAL_ONE:
- marshall_inval_palette(rcc, m, (CacheItem *)pipe_item);
+ case RED_PIPE_ITEM_TYPE_INVAL_ONE:
+ marshall_inval_palette(rcc, m, (RedCacheItem *)pipe_item);
break;
- case PIPE_ITEM_TYPE_STREAM_CREATE: {
+ case RED_PIPE_ITEM_TYPE_STREAM_CREATE: {
StreamAgent *agent = SPICE_CONTAINEROF(pipe_item, StreamAgent, create_item);
marshall_stream_start(rcc, m, agent);
break;
}
- case PIPE_ITEM_TYPE_STREAM_CLIP: {
- StreamClipItem* clip_item = (StreamClipItem *)pipe_item;
+ case RED_PIPE_ITEM_TYPE_STREAM_CLIP: {
+ RedStreamClipItem* clip_item = (RedStreamClipItem *)pipe_item;
marshall_stream_clip(rcc, m, clip_item);
break;
}
- case PIPE_ITEM_TYPE_STREAM_DESTROY: {
+ case RED_PIPE_ITEM_TYPE_STREAM_DESTROY: {
StreamAgent *agent = SPICE_CONTAINEROF(pipe_item, StreamAgent, destroy_item);
marshall_stream_end(rcc, m, agent);
break;
}
- case PIPE_ITEM_TYPE_UPGRADE:
- marshall_upgrade(rcc, m, (UpgradeItem *)pipe_item);
+ case RED_PIPE_ITEM_TYPE_UPGRADE:
+ marshall_upgrade(rcc, m, (RedUpgradeItem *)pipe_item);
break;
- case PIPE_ITEM_TYPE_VERB:
- red_marshall_verb(rcc, (VerbItem*)pipe_item);
+ case RED_PIPE_ITEM_TYPE_VERB:
+ red_marshall_verb(rcc, (RedVerbItem*)pipe_item);
break;
- case PIPE_ITEM_TYPE_MIGRATE_DATA:
+ case RED_PIPE_ITEM_TYPE_MIGRATE_DATA:
display_channel_marshall_migrate_data(rcc, m);
break;
- case PIPE_ITEM_TYPE_IMAGE:
- red_marshall_image(rcc, m, (ImageItem *)pipe_item);
+ case RED_PIPE_ITEM_TYPE_IMAGE:
+ red_marshall_image(rcc, m, (RedImageItem *)pipe_item);
break;
- case PIPE_ITEM_TYPE_PIXMAP_SYNC:
+ case RED_PIPE_ITEM_TYPE_PIXMAP_SYNC:
display_channel_marshall_pixmap_sync(rcc, m);
break;
- case PIPE_ITEM_TYPE_PIXMAP_RESET:
+ case RED_PIPE_ITEM_TYPE_PIXMAP_RESET:
display_channel_marshall_reset_cache(rcc, m);
break;
- case PIPE_ITEM_TYPE_INVAL_PALETTE_CACHE:
+ case RED_PIPE_ITEM_TYPE_INVAL_PALETTE_CACHE:
dcc_palette_cache_reset(dcc);
red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_INVAL_ALL_PALETTES, NULL);
break;
- case PIPE_ITEM_TYPE_CREATE_SURFACE: {
- SurfaceCreateItem *surface_create = SPICE_CONTAINEROF(pipe_item, SurfaceCreateItem,
- pipe_item);
+ case RED_PIPE_ITEM_TYPE_CREATE_SURFACE: {
+ RedSurfaceCreateItem *surface_create = SPICE_CONTAINEROF(pipe_item, RedSurfaceCreateItem,
+ pipe_item);
marshall_surface_create(rcc, m, &surface_create->surface_create);
break;
}
- case PIPE_ITEM_TYPE_DESTROY_SURFACE: {
- SurfaceDestroyItem *surface_destroy = SPICE_CONTAINEROF(pipe_item, SurfaceDestroyItem,
- pipe_item);
+ case RED_PIPE_ITEM_TYPE_DESTROY_SURFACE: {
+ RedSurfaceDestroyItem *surface_destroy = SPICE_CONTAINEROF(pipe_item, RedSurfaceDestroyItem,
+ pipe_item);
marshall_surface_destroy(rcc, m, surface_destroy->surface_destroy.surface_id);
break;
}
- case PIPE_ITEM_TYPE_MONITORS_CONFIG: {
- MonitorsConfigItem *monconf_item = SPICE_CONTAINEROF(pipe_item,
- MonitorsConfigItem, pipe_item);
+ case RED_PIPE_ITEM_TYPE_MONITORS_CONFIG: {
+ RedMonitorsConfigItem *monconf_item = SPICE_CONTAINEROF(pipe_item,
+ RedMonitorsConfigItem,
+ pipe_item);
marshall_monitors_config(rcc, m, monconf_item->monitors_config);
break;
}
- case PIPE_ITEM_TYPE_STREAM_ACTIVATE_REPORT: {
- StreamActivateReportItem *report_item = SPICE_CONTAINEROF(pipe_item,
- StreamActivateReportItem,
- pipe_item);
+ case RED_PIPE_ITEM_TYPE_STREAM_ACTIVATE_REPORT: {
+ RedStreamActivateReportItem *report_item = SPICE_CONTAINEROF(pipe_item,
+ RedStreamActivateReportItem,
+ pipe_item);
marshall_stream_activate_report(rcc, m, report_item->stream_id);
break;
}
- case PIPE_ITEM_TYPE_GL_SCANOUT:
+ case RED_PIPE_ITEM_TYPE_GL_SCANOUT:
marshall_gl_scanout(rcc, m, pipe_item);
break;
- case PIPE_ITEM_TYPE_GL_DRAW:
+ case RED_PIPE_ITEM_TYPE_GL_DRAW:
marshall_gl_draw(rcc, m, pipe_item);
break;
default:
diff --git a/server/dcc.c b/server/dcc.c
index cf30f92..2ba6459 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -24,13 +24,16 @@
#define DISPLAY_CLIENT_SHORT_TIMEOUT 15000000000ULL //nano
-static SurfaceCreateItem *surface_create_item_new(RedChannel* channel,
- uint32_t surface_id, uint32_t width,
- uint32_t height, uint32_t format, uint32_t flags)
+static RedSurfaceCreateItem *red_surface_create_item_new(RedChannel* channel,
+ uint32_t surface_id,
+ uint32_t width,
+ uint32_t height,
+ uint32_t format,
+ uint32_t flags)
{
- SurfaceCreateItem *create;
+ RedSurfaceCreateItem *create;
- create = spice_malloc(sizeof(SurfaceCreateItem));
+ create = spice_malloc(sizeof(RedSurfaceCreateItem));
create->surface_create.surface_id = surface_id;
create->surface_create.width = width;
@@ -38,13 +41,13 @@ static SurfaceCreateItem *surface_create_item_new(RedChannel* channel,
create->surface_create.flags = flags;
create->surface_create.format = format;
- red_pipe_item_init(&create->pipe_item, PIPE_ITEM_TYPE_CREATE_SURFACE);
+ red_pipe_item_init(&create->pipe_item, RED_PIPE_ITEM_TYPE_CREATE_SURFACE);
return create;
}
int dcc_drawable_is_in_pipe(DisplayChannelClient *dcc, Drawable *drawable)
{
- DrawablePipeItem *dpi;
+ RedDrawablePipeItem *dpi;
RingItem *dpi_link, *dpi_next;
DRAWABLE_FOREACH_DPI_SAFE(drawable, dpi_link, dpi_next, dpi) {
@@ -77,14 +80,14 @@ int dcc_clear_surface_drawables_from_pipe(DisplayChannelClient *dcc, int surface
item = (RedPipeItem *) ring;
while ((item = (RedPipeItem *)ring_next(ring, (RingItem *)item))) {
Drawable *drawable;
- DrawablePipeItem *dpi = NULL;
+ RedDrawablePipeItem *dpi = NULL;
int depend_found = FALSE;
- if (item->type == PIPE_ITEM_TYPE_DRAW) {
- dpi = SPICE_CONTAINEROF(item, DrawablePipeItem, dpi_pipe_item);
+ if (item->type == RED_PIPE_ITEM_TYPE_DRAW) {
+ dpi = SPICE_CONTAINEROF(item, RedDrawablePipeItem, dpi_pipe_item);
drawable = dpi->drawable;
- } else if (item->type == PIPE_ITEM_TYPE_UPGRADE) {
- drawable = ((UpgradeItem *)item)->drawable;
+ } else if (item->type == RED_PIPE_ITEM_TYPE_UPGRADE) {
+ drawable = ((RedUpgradeItem *)item)->drawable;
} else {
continue;
}
@@ -138,7 +141,7 @@ void dcc_create_surface(DisplayChannelClient *dcc, int surface_id)
{
DisplayChannel *display;
RedSurface *surface;
- SurfaceCreateItem *create;
+ RedSurfaceCreateItem *create;
uint32_t flags;
if (!dcc) {
@@ -154,21 +157,25 @@ void dcc_create_surface(DisplayChannelClient *dcc, int surface_id)
return;
}
surface = &display->surfaces[surface_id];
- create = surface_create_item_new(RED_CHANNEL_CLIENT(dcc)->channel,
- surface_id, surface->context.width, surface->context.height,
- surface->context.format, flags);
+ create = red_surface_create_item_new(RED_CHANNEL_CLIENT(dcc)->channel,
+ surface_id, surface->context.width,
+ surface->context.height,
+ surface->context.format, flags);
dcc->surface_client_created[surface_id] = TRUE;
red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), &create->pipe_item);
}
// adding the pipe item after pos. If pos == NULL, adding to head.
-ImageItem *dcc_add_surface_area_image(DisplayChannelClient *dcc, int surface_id,
- SpiceRect *area, RedPipeItem *pos, int can_lossy)
+RedImageItem *dcc_add_surface_area_image(DisplayChannelClient *dcc,
+ int surface_id,
+ SpiceRect *area,
+ RedPipeItem *pos,
+ int can_lossy)
{
DisplayChannel *display = DCC_TO_DC(dcc);
RedSurface *surface = &display->surfaces[surface_id];
SpiceCanvas *canvas = surface->context.canvas;
- ImageItem *item;
+ RedImageItem *item;
int stride;
int width;
int height;
@@ -182,9 +189,9 @@ ImageItem *dcc_add_surface_area_image(DisplayChannelClient *dcc, int surface_id,
bpp = SPICE_SURFACE_FMT_DEPTH(surface->context.format) / 8;
stride = width * bpp;
- item = (ImageItem *)spice_malloc_n_m(height, stride, sizeof(ImageItem));
+ item = (RedImageItem *)spice_malloc_n_m(height, stride, sizeof(RedImageItem));
- red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_IMAGE);
+ red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_IMAGE);
item->surface_id = surface_id;
item->image_format =
@@ -274,9 +281,10 @@ static void add_drawable_surface_images(DisplayChannelClient *dcc, Drawable *dra
dcc_push_surface_image(dcc, drawable->surface_id);
}
-void drawable_pipe_item_free(RedPipeItem *item)
+void red_drawable_pipe_item_free(RedPipeItem *item)
{
- DrawablePipeItem *dpi = SPICE_CONTAINEROF(item, DrawablePipeItem, dpi_pipe_item);
+ RedDrawablePipeItem *dpi = SPICE_CONTAINEROF(item, RedDrawablePipeItem,
+ dpi_pipe_item);
DisplayChannel *display = DCC_TO_DC(dpi->dcc);
spice_assert(item->refcount == 0);
@@ -287,24 +295,25 @@ void drawable_pipe_item_free(RedPipeItem *item)
free(dpi);
}
-static DrawablePipeItem *drawable_pipe_item_new(DisplayChannelClient *dcc, Drawable *drawable)
+static RedDrawablePipeItem *red_drawable_pipe_item_new(DisplayChannelClient *dcc,
+ Drawable *drawable)
{
- DrawablePipeItem *dpi;
+ RedDrawablePipeItem *dpi;
dpi = spice_malloc0(sizeof(*dpi));
dpi->drawable = drawable;
dpi->dcc = dcc;
ring_item_init(&dpi->base);
ring_add(&drawable->pipes, &dpi->base);
- red_pipe_item_init_full(&dpi->dpi_pipe_item, PIPE_ITEM_TYPE_DRAW,
- (GDestroyNotify)drawable_pipe_item_free);
+ red_pipe_item_init_full(&dpi->dpi_pipe_item, RED_PIPE_ITEM_TYPE_DRAW,
+ (GDestroyNotify)red_drawable_pipe_item_free);
drawable->refs++;
return dpi;
}
void dcc_prepend_drawable(DisplayChannelClient *dcc, Drawable *drawable)
{
- DrawablePipeItem *dpi = drawable_pipe_item_new(dcc, drawable);
+ RedDrawablePipeItem *dpi = red_drawable_pipe_item_new(dcc, drawable);
add_drawable_surface_images(dcc, drawable);
red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), &dpi->dpi_pipe_item);
@@ -312,7 +321,7 @@ void dcc_prepend_drawable(DisplayChannelClient *dcc, Drawable *drawable)
void dcc_append_drawable(DisplayChannelClient *dcc, Drawable *drawable)
{
- DrawablePipeItem *dpi = drawable_pipe_item_new(dcc, drawable);
+ RedDrawablePipeItem *dpi = red_drawable_pipe_item_new(dcc, drawable);
add_drawable_surface_images(dcc, drawable);
red_channel_client_pipe_add_tail_and_push(RED_CHANNEL_CLIENT(dcc), &dpi->dpi_pipe_item);
@@ -320,7 +329,7 @@ void dcc_append_drawable(DisplayChannelClient *dcc, Drawable *drawable)
void dcc_add_drawable_after(DisplayChannelClient *dcc, Drawable *drawable, RedPipeItem *pos)
{
- DrawablePipeItem *dpi = drawable_pipe_item_new(dcc, drawable);
+ RedDrawablePipeItem *dpi = red_drawable_pipe_item_new(dcc, drawable);
add_drawable_surface_images(dcc, drawable);
red_channel_client_pipe_add_after(RED_CHANNEL_CLIENT(dcc), &dpi->dpi_pipe_item, pos);
@@ -336,8 +345,8 @@ static void dcc_init_stream_agents(DisplayChannelClient *dcc)
agent->stream = &display->streams_buf[i];
region_init(&agent->vis_region);
region_init(&agent->clip);
- red_pipe_item_init(&agent->create_item, PIPE_ITEM_TYPE_STREAM_CREATE);
- red_pipe_item_init(&agent->destroy_item, PIPE_ITEM_TYPE_STREAM_DESTROY);
+ red_pipe_item_init(&agent->create_item, RED_PIPE_ITEM_TYPE_STREAM_CREATE);
+ red_pipe_item_init(&agent->destroy_item, RED_PIPE_ITEM_TYPE_STREAM_DESTROY);
}
dcc->use_mjpeg_encoder_rate_control =
red_channel_client_test_remote_cap(RED_CHANNEL_CLIENT(dcc), SPICE_DISPLAY_CAP_STREAM_REPORT);
@@ -447,7 +456,7 @@ void dcc_start(DisplayChannelClient *dcc)
red_channel_client_ack_zero_messages_window(RED_CHANNEL_CLIENT(dcc));
if (display->surfaces[0].context.canvas) {
display_channel_current_flush(display, 0);
- red_channel_client_pipe_add_type(rcc, PIPE_ITEM_TYPE_INVAL_PALETTE_CACHE);
+ red_channel_client_pipe_add_type(rcc, RED_PIPE_ITEM_TYPE_INVAL_PALETTE_CACHE);
dcc_create_surface(dcc, 0);
dcc_push_surface_image(dcc, 0);
dcc_push_monitors_config(dcc);
@@ -497,7 +506,7 @@ void dcc_stop(DisplayChannelClient *dcc)
void dcc_stream_agent_clip(DisplayChannelClient* dcc, StreamAgent *agent)
{
- StreamClipItem *item = stream_clip_item_new(agent);
+ RedStreamClipItem *item = red_stream_clip_item_new(agent);
int n_rects;
item->clip_type = SPICE_CLIP_TYPE_RECTS;
@@ -510,22 +519,22 @@ void dcc_stream_agent_clip(DisplayChannelClient* dcc, StreamAgent *agent)
red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), (RedPipeItem *)item);
}
-static void monitors_config_item_free(MonitorsConfigItem *item)
+static void red_monitors_config_item_free(RedMonitorsConfigItem *item)
{
monitors_config_unref(item->monitors_config);
free(item);
}
-static MonitorsConfigItem *monitors_config_item_new(RedChannel* channel,
- MonitorsConfig *monitors_config)
+static RedMonitorsConfigItem *red_monitors_config_item_new(RedChannel* channel,
+ MonitorsConfig *monitors_config)
{
- MonitorsConfigItem *mci;
+ RedMonitorsConfigItem *mci;
- mci = (MonitorsConfigItem *)spice_malloc(sizeof(*mci));
+ mci = (RedMonitorsConfigItem *)spice_malloc(sizeof(*mci));
mci->monitors_config = monitors_config;
- red_pipe_item_init_full(&mci->pipe_item, PIPE_ITEM_TYPE_MONITORS_CONFIG,
- (GDestroyNotify)monitors_config_item_free);
+ red_pipe_item_init_full(&mci->pipe_item, RED_PIPE_ITEM_TYPE_MONITORS_CONFIG,
+ (GDestroyNotify)red_monitors_config_item_free);
return mci;
}
@@ -533,7 +542,7 @@ void dcc_push_monitors_config(DisplayChannelClient *dcc)
{
DisplayChannel *dc = DCC_TO_DC(dcc);
MonitorsConfig *monitors_config = dc->monitors_config;
- MonitorsConfigItem *mci;
+ RedMonitorsConfigItem *mci;
if (monitors_config == NULL) {
spice_warning("monitors_config is NULL");
@@ -545,27 +554,27 @@ void dcc_push_monitors_config(DisplayChannelClient *dcc)
return;
}
- mci = monitors_config_item_new(dcc->common.base.channel,
- monitors_config_ref(dc->monitors_config));
+ mci = red_monitors_config_item_new(dcc->common.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);
}
-static SurfaceDestroyItem *surface_destroy_item_new(RedChannel *channel,
- uint32_t surface_id)
+static RedSurfaceDestroyItem *red_surface_destroy_item_new(RedChannel *channel,
+ uint32_t surface_id)
{
- SurfaceDestroyItem *destroy;
+ RedSurfaceDestroyItem *destroy;
- destroy = spice_malloc(sizeof(SurfaceDestroyItem));
+ destroy = spice_malloc(sizeof(RedSurfaceDestroyItem));
destroy->surface_destroy.surface_id = surface_id;
- red_pipe_item_init(&destroy->pipe_item, PIPE_ITEM_TYPE_DESTROY_SURFACE);
+ red_pipe_item_init(&destroy->pipe_item, RED_PIPE_ITEM_TYPE_DESTROY_SURFACE);
return destroy;
}
RedPipeItem *dcc_gl_scanout_item_new(RedChannelClient *rcc, void *data, int num)
{
- GlScanoutUnixItem *item = spice_new(GlScanoutUnixItem, 1);
+ RedGlScanoutUnixItem *item = spice_new(RedGlScanoutUnixItem, 1);
spice_return_val_if_fail(item != NULL, NULL);
/* FIXME: on !unix peer, start streaming with a video codec */
@@ -576,7 +585,7 @@ RedPipeItem *dcc_gl_scanout_item_new(RedChannelClient *rcc, void *data, int num)
return NULL;
}
- red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_GL_SCANOUT);
+ red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_GL_SCANOUT);
return &item->base;
}
@@ -585,7 +594,7 @@ RedPipeItem *dcc_gl_draw_item_new(RedChannelClient *rcc, void *data, int num)
{
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
const SpiceMsgDisplayGlDraw *draw = data;
- GlDrawItem *item = spice_new(GlDrawItem, 1);
+ RedGlDrawItem *item = spice_new(RedGlDrawItem, 1);
spice_return_val_if_fail(item != NULL, NULL);
if (!red_channel_client_test_remote_cap(rcc, SPICE_DISPLAY_CAP_GL_SCANOUT)) {
@@ -596,7 +605,7 @@ RedPipeItem *dcc_gl_draw_item_new(RedChannelClient *rcc, void *data, int num)
dcc->gl_draw_ongoing = TRUE;
item->draw = *draw;
- red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_GL_DRAW);
+ red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_GL_DRAW);
return &item->base;
}
@@ -605,7 +614,7 @@ void dcc_destroy_surface(DisplayChannelClient *dcc, uint32_t surface_id)
{
DisplayChannel *display;
RedChannel *channel;
- SurfaceDestroyItem *destroy;
+ RedSurfaceDestroyItem *destroy;
if (!dcc) {
return;
@@ -620,7 +629,7 @@ void dcc_destroy_surface(DisplayChannelClient *dcc, uint32_t surface_id)
}
dcc->surface_client_created[surface_id] = FALSE;
- destroy = surface_destroy_item_new(channel, surface_id);
+ destroy = red_surface_destroy_item_new(channel, surface_id);
red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), &destroy->pipe_item);
}
@@ -1302,7 +1311,7 @@ int dcc_pixmap_cache_unlocked_add(DisplayChannelClient *dcc, uint64_t id,
if (cache->generation != dcc->pixmap_cache_generation) {
if (!dcc->pending_pixmaps_sync) {
red_channel_client_pipe_add_type(
- RED_CHANNEL_CLIENT(dcc), PIPE_ITEM_TYPE_PIXMAP_SYNC);
+ RED_CHANNEL_CLIENT(dcc), RED_PIPE_ITEM_TYPE_PIXMAP_SYNC);
dcc->pending_pixmaps_sync = TRUE;
}
free(item);
@@ -1554,9 +1563,9 @@ int dcc_handle_migrate_data(DisplayChannelClient *dcc, uint32_t size, void *mess
if (migrate_data->pixmap_cache_freezer) {
/* activating the cache. The cache will start to be active after
- * pixmap_cache_reset is called, when handling PIPE_ITEM_TYPE_PIXMAP_RESET */
+ * pixmap_cache_reset is called, when handling RED_PIPE_ITEM_TYPE_PIXMAP_RESET */
dcc->pixmap_cache->size = migrate_data->pixmap_cache_size;
- red_channel_client_pipe_add_type(RED_CHANNEL_CLIENT(dcc), PIPE_ITEM_TYPE_PIXMAP_RESET);
+ red_channel_client_pipe_add_type(RED_CHANNEL_CLIENT(dcc), RED_PIPE_ITEM_TYPE_PIXMAP_RESET);
}
if (dcc_handle_migrate_glz_dictionary(dcc, migrate_data)) {
@@ -1585,7 +1594,7 @@ int dcc_handle_migrate_data(DisplayChannelClient *dcc, uint32_t size, void *mess
spice_return_val_if_fail(surfaces_restored, FALSE);
- red_channel_client_pipe_add_type(RED_CHANNEL_CLIENT(dcc), PIPE_ITEM_TYPE_INVAL_PALETTE_CACHE);
+ red_channel_client_pipe_add_type(RED_CHANNEL_CLIENT(dcc), RED_PIPE_ITEM_TYPE_INVAL_PALETTE_CACHE);
/* enable sending messages */
red_channel_client_ack_zero_messages_window(RED_CHANNEL_CLIENT(dcc));
return TRUE;
@@ -1594,16 +1603,16 @@ int dcc_handle_migrate_data(DisplayChannelClient *dcc, uint32_t size, void *mess
static void release_item_after_push(DisplayChannelClient *dcc, RedPipeItem *item)
{
switch (item->type) {
- case PIPE_ITEM_TYPE_DRAW:
- case PIPE_ITEM_TYPE_IMAGE:
- case PIPE_ITEM_TYPE_STREAM_CLIP:
- case PIPE_ITEM_TYPE_MONITORS_CONFIG:
- case PIPE_ITEM_TYPE_UPGRADE:
+ case RED_PIPE_ITEM_TYPE_DRAW:
+ case RED_PIPE_ITEM_TYPE_IMAGE:
+ case RED_PIPE_ITEM_TYPE_STREAM_CLIP:
+ case RED_PIPE_ITEM_TYPE_MONITORS_CONFIG:
+ case RED_PIPE_ITEM_TYPE_UPGRADE:
red_pipe_item_unref(item);
break;
- case PIPE_ITEM_TYPE_GL_SCANOUT:
- case PIPE_ITEM_TYPE_GL_DRAW:
- case PIPE_ITEM_TYPE_VERB:
+ case RED_PIPE_ITEM_TYPE_GL_SCANOUT:
+ case RED_PIPE_ITEM_TYPE_GL_DRAW:
+ case RED_PIPE_ITEM_TYPE_VERB:
free(item);
break;
default:
@@ -1619,49 +1628,49 @@ static void release_item_before_push(DisplayChannelClient *dcc, RedPipeItem *ite
spice_debug("item.type: %d", item->type);
switch (item->type) {
- case PIPE_ITEM_TYPE_DRAW: {
- DrawablePipeItem *dpi = SPICE_CONTAINEROF(item, DrawablePipeItem, dpi_pipe_item);
+ case RED_PIPE_ITEM_TYPE_DRAW: {
+ RedDrawablePipeItem *dpi = SPICE_CONTAINEROF(item, RedDrawablePipeItem, dpi_pipe_item);
ring_remove(&dpi->base);
red_pipe_item_unref(item);
break;
}
- case PIPE_ITEM_TYPE_STREAM_CREATE: {
+ case RED_PIPE_ITEM_TYPE_STREAM_CREATE: {
StreamAgent *agent = SPICE_CONTAINEROF(item, StreamAgent, create_item);
stream_agent_unref(display, agent);
break;
}
- case PIPE_ITEM_TYPE_STREAM_DESTROY: {
+ case RED_PIPE_ITEM_TYPE_STREAM_DESTROY: {
StreamAgent *agent = SPICE_CONTAINEROF(item, StreamAgent, destroy_item);
stream_agent_unref(display, agent);
break;
}
- case PIPE_ITEM_TYPE_STREAM_CLIP:
- case PIPE_ITEM_TYPE_UPGRADE:
- case PIPE_ITEM_TYPE_IMAGE:
- case PIPE_ITEM_TYPE_MONITORS_CONFIG:
+ case RED_PIPE_ITEM_TYPE_STREAM_CLIP:
+ case RED_PIPE_ITEM_TYPE_UPGRADE:
+ case RED_PIPE_ITEM_TYPE_IMAGE:
+ case RED_PIPE_ITEM_TYPE_MONITORS_CONFIG:
red_pipe_item_unref(item);
break;
- case PIPE_ITEM_TYPE_CREATE_SURFACE: {
- SurfaceCreateItem *surface_create = SPICE_CONTAINEROF(item, SurfaceCreateItem,
- pipe_item);
+ case RED_PIPE_ITEM_TYPE_CREATE_SURFACE: {
+ RedSurfaceCreateItem *surface_create = SPICE_CONTAINEROF(item, RedSurfaceCreateItem,
+ pipe_item);
free(surface_create);
break;
}
- case PIPE_ITEM_TYPE_DESTROY_SURFACE: {
- SurfaceDestroyItem *surface_destroy = SPICE_CONTAINEROF(item, SurfaceDestroyItem,
- pipe_item);
+ case RED_PIPE_ITEM_TYPE_DESTROY_SURFACE: {
+ RedSurfaceDestroyItem *surface_destroy = SPICE_CONTAINEROF(item, RedSurfaceDestroyItem,
+ pipe_item);
free(surface_destroy);
break;
}
- case PIPE_ITEM_TYPE_INVAL_ONE:
- case PIPE_ITEM_TYPE_VERB:
- case PIPE_ITEM_TYPE_MIGRATE_DATA:
- case PIPE_ITEM_TYPE_PIXMAP_SYNC:
- case PIPE_ITEM_TYPE_PIXMAP_RESET:
- case PIPE_ITEM_TYPE_INVAL_PALETTE_CACHE:
- case PIPE_ITEM_TYPE_STREAM_ACTIVATE_REPORT:
- case PIPE_ITEM_TYPE_GL_SCANOUT:
- case PIPE_ITEM_TYPE_GL_DRAW:
+ case RED_PIPE_ITEM_TYPE_INVAL_ONE:
+ case RED_PIPE_ITEM_TYPE_VERB:
+ case RED_PIPE_ITEM_TYPE_MIGRATE_DATA:
+ case RED_PIPE_ITEM_TYPE_PIXMAP_SYNC:
+ case RED_PIPE_ITEM_TYPE_PIXMAP_RESET:
+ case RED_PIPE_ITEM_TYPE_INVAL_PALETTE_CACHE:
+ case RED_PIPE_ITEM_TYPE_STREAM_ACTIVATE_REPORT:
+ case RED_PIPE_ITEM_TYPE_GL_SCANOUT:
+ case RED_PIPE_ITEM_TYPE_GL_DRAW:
free(item);
break;
default:
diff --git a/server/dcc.h b/server/dcc.h
index 52cd22a..509a6c6 100644
--- a/server/dcc.h
+++ b/server/dcc.h
@@ -82,7 +82,7 @@ struct DisplayChannelClient {
uint32_t pixmap_cache_generation;
int pending_pixmaps_sync;
- CacheItem *palette_cache[PALETTE_CACHE_HASH_SIZE];
+ RedCacheItem *palette_cache[PALETTE_CACHE_HASH_SIZE];
Ring palette_cache_lru;
long palette_cache_available;
uint32_t palette_cache_items;
@@ -121,21 +121,21 @@ struct DisplayChannelClient {
SPICE_CONTAINEROF((dcc)->common.base.channel, DisplayChannel, common.base)
#define RCC_TO_DCC(rcc) SPICE_CONTAINEROF((rcc), DisplayChannelClient, common.base)
-typedef struct SurfaceCreateItem {
+typedef struct RedSurfaceCreateItem {
SpiceMsgSurfaceCreate surface_create;
RedPipeItem pipe_item;
-} SurfaceCreateItem;
+} RedSurfaceCreateItem;
-typedef struct GlScanoutUnixItem {
+typedef struct RedGlScanoutUnixItem {
RedPipeItem base;
-} GlScanoutUnixItem;
+} RedGlScanoutUnixItem;
-typedef struct GlDrawItem {
+typedef struct RedGlDrawItem {
RedPipeItem base;
SpiceMsgDisplayGlDraw draw;
-} GlDrawItem;
+} RedGlDrawItem;
-typedef struct ImageItem {
+typedef struct RedImageItem {
RedPipeItem base;
SpicePoint pos;
int width;
@@ -147,15 +147,15 @@ typedef struct ImageItem {
uint32_t image_flags;
int can_lossy;
uint8_t data[0];
-} ImageItem;
+} RedImageItem;
-typedef struct DrawablePipeItem {
+typedef struct RedDrawablePipeItem {
RingItem base; /* link for a list of pipe items held by Drawable */
RedPipeItem dpi_pipe_item; /* link for the client's pipe itself */
Drawable *drawable;
DisplayChannelClient *dcc;
uint8_t refs;
-} DrawablePipeItem;
+} RedDrawablePipeItem;
DisplayChannelClient* dcc_new (DisplayChannel *display,
RedClient *client,
@@ -186,7 +186,7 @@ void dcc_create_surface (DisplayCha
int surface_id);
void dcc_push_surface_image (DisplayChannelClient *dcc,
int surface_id);
-ImageItem * dcc_add_surface_area_image (DisplayChannelClient *dcc,
+RedImageItem * dcc_add_surface_area_image (DisplayChannelClient *dcc,
int surface_id,
SpiceRect *area,
RedPipeItem *pos,
diff --git a/server/display-channel.c b/server/display-channel.c
index d24b6a6..74cc357 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -344,7 +344,7 @@ static void pipes_add_drawable(DisplayChannel *display, Drawable *drawable)
static void pipes_add_drawable_after(DisplayChannel *display,
Drawable *drawable, Drawable *pos_after)
{
- DrawablePipeItem *dpi_pos_after;
+ RedDrawablePipeItem *dpi_pos_after;
RingItem *dpi_link, *dpi_next;
DisplayChannelClient *dcc;
int num_other_linked = 0;
@@ -403,11 +403,11 @@ static void current_remove_drawable(DisplayChannel *display, Drawable *item)
static void drawable_remove_from_pipes(Drawable *drawable)
{
- DrawablePipeItem *dpi;
+ RedDrawablePipeItem *dpi;
RingItem *item, *next;
RING_FOREACH_SAFE(item, next, &drawable->pipes) {
- dpi = SPICE_CONTAINEROF(item, DrawablePipeItem, base);
+ dpi = SPICE_CONTAINEROF(item, RedDrawablePipeItem, base);
if (red_pipe_item_is_linked(&dpi->dpi_pipe_item)) {
red_channel_client_pipe_remove_and_release(RED_CHANNEL_CLIENT(dpi->dcc),
&dpi->dpi_pipe_item);
@@ -504,7 +504,7 @@ static int current_add_equal(DisplayChannel *display, DrawItem *item, TreeItem *
if (is_same_drawable(drawable, other_drawable)) {
DisplayChannelClient *dcc;
- DrawablePipeItem *dpi;
+ RedDrawablePipeItem *dpi;
RingItem *worker_ring_item, *dpi_ring_item;
other_drawable->refs++;
@@ -518,7 +518,7 @@ static int current_add_equal(DisplayChannel *display, DrawItem *item, TreeItem *
while (worker_ring_item) {
dcc = SPICE_CONTAINEROF(worker_ring_item, DisplayChannelClient,
common.base.channel_link);
- dpi = SPICE_CONTAINEROF(dpi_ring_item, DrawablePipeItem, base);
+ 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,
@@ -1849,7 +1849,7 @@ void display_channel_destroy_surfaces(DisplayChannel *display)
spice_warn_if_fail(ring_is_empty(&display->streams));
if (red_channel_is_connected(RED_CHANNEL(display))) {
- red_channel_pipes_add_type(RED_CHANNEL(display), PIPE_ITEM_TYPE_INVAL_PALETTE_CACHE);
+ red_channel_pipes_add_type(RED_CHANNEL(display), RED_PIPE_ITEM_TYPE_INVAL_PALETTE_CACHE);
red_pipes_add_verb(RED_CHANNEL(display), SPICE_MSG_DISPLAY_STREAM_DESTROY_ALL);
}
@@ -1970,10 +1970,10 @@ static void hold_item(RedChannelClient *rcc, RedPipeItem *item)
spice_return_if_fail(item);
switch (item->type) {
- case PIPE_ITEM_TYPE_DRAW:
- case PIPE_ITEM_TYPE_IMAGE:
- case PIPE_ITEM_TYPE_STREAM_CLIP:
- case PIPE_ITEM_TYPE_UPGRADE:
+ case RED_PIPE_ITEM_TYPE_DRAW:
+ case RED_PIPE_ITEM_TYPE_IMAGE:
+ case RED_PIPE_ITEM_TYPE_STREAM_CLIP:
+ case RED_PIPE_ITEM_TYPE_UPGRADE:
red_pipe_item_ref(item);
break;
default:
@@ -1994,7 +1994,7 @@ static int handle_migrate_flush_mark(RedChannelClient *rcc)
DisplayChannel *display_channel = SPICE_CONTAINEROF(rcc->channel, DisplayChannel, common.base);
RedChannel *channel = RED_CHANNEL(display_channel);
- red_channel_pipes_add_type(channel, PIPE_ITEM_TYPE_MIGRATE_DATA);
+ red_channel_pipes_add_type(channel, RED_PIPE_ITEM_TYPE_MIGRATE_DATA);
return TRUE;
}
diff --git a/server/display-channel.h b/server/display-channel.h
index 13f1499..9050716 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -81,7 +81,7 @@ struct Drawable {
uint32_t process_commands_generation;
};
-#define LINK_TO_DPI(ptr) SPICE_CONTAINEROF((ptr), DrawablePipeItem, base)
+#define LINK_TO_DPI(ptr) SPICE_CONTAINEROF((ptr), RedDrawablePipeItem, base)
#define DRAWABLE_FOREACH_DPI_SAFE(drawable, link, next, dpi) \
SAFE_FOREACH(link, next, drawable, &(drawable)->pipes, dpi, LINK_TO_DPI(link))
@@ -91,22 +91,22 @@ struct Drawable {
SAFE_FOREACH(link, next, drawable, &(drawable)->glz_ring, glz, LINK_TO_GLZ(link))
enum {
- PIPE_ITEM_TYPE_DRAW = PIPE_ITEM_TYPE_COMMON_LAST,
- PIPE_ITEM_TYPE_IMAGE,
- PIPE_ITEM_TYPE_STREAM_CREATE,
- PIPE_ITEM_TYPE_STREAM_CLIP,
- PIPE_ITEM_TYPE_STREAM_DESTROY,
- PIPE_ITEM_TYPE_UPGRADE,
- PIPE_ITEM_TYPE_MIGRATE_DATA,
- PIPE_ITEM_TYPE_PIXMAP_SYNC,
- PIPE_ITEM_TYPE_PIXMAP_RESET,
- PIPE_ITEM_TYPE_INVAL_PALETTE_CACHE,
- PIPE_ITEM_TYPE_CREATE_SURFACE,
- PIPE_ITEM_TYPE_DESTROY_SURFACE,
- PIPE_ITEM_TYPE_MONITORS_CONFIG,
- PIPE_ITEM_TYPE_STREAM_ACTIVATE_REPORT,
- PIPE_ITEM_TYPE_GL_SCANOUT,
- PIPE_ITEM_TYPE_GL_DRAW,
+ RED_PIPE_ITEM_TYPE_DRAW = RED_PIPE_ITEM_TYPE_COMMON_LAST,
+ RED_PIPE_ITEM_TYPE_IMAGE,
+ RED_PIPE_ITEM_TYPE_STREAM_CREATE,
+ RED_PIPE_ITEM_TYPE_STREAM_CLIP,
+ RED_PIPE_ITEM_TYPE_STREAM_DESTROY,
+ RED_PIPE_ITEM_TYPE_UPGRADE,
+ RED_PIPE_ITEM_TYPE_MIGRATE_DATA,
+ RED_PIPE_ITEM_TYPE_PIXMAP_SYNC,
+ RED_PIPE_ITEM_TYPE_PIXMAP_RESET,
+ RED_PIPE_ITEM_TYPE_INVAL_PALETTE_CACHE,
+ RED_PIPE_ITEM_TYPE_CREATE_SURFACE,
+ RED_PIPE_ITEM_TYPE_DESTROY_SURFACE,
+ RED_PIPE_ITEM_TYPE_MONITORS_CONFIG,
+ RED_PIPE_ITEM_TYPE_STREAM_ACTIVATE_REPORT,
+ RED_PIPE_ITEM_TYPE_GL_SCANOUT,
+ RED_PIPE_ITEM_TYPE_GL_DRAW,
};
typedef struct MonitorsConfig {
@@ -116,10 +116,10 @@ typedef struct MonitorsConfig {
QXLHead heads[0];
} MonitorsConfig;
-typedef struct MonitorsConfigItem {
+typedef struct RedMonitorsConfigItem {
RedPipeItem pipe_item;
MonitorsConfig *monitors_config;
-} MonitorsConfigItem;
+} RedMonitorsConfigItem;
MonitorsConfig* monitors_config_new (QXLHead *heads, ssize_t nheads,
ssize_t max);
@@ -237,17 +237,17 @@ static inline int get_stream_id(DisplayChannel *display, Stream *stream)
return (int)(stream - display->streams_buf);
}
-typedef struct SurfaceDestroyItem {
+typedef struct RedSurfaceDestroyItem {
SpiceMsgSurfaceDestroy surface_destroy;
RedPipeItem pipe_item;
-} SurfaceDestroyItem;
+} RedSurfaceDestroyItem;
-typedef struct UpgradeItem {
+typedef struct RedUpgradeItem {
RedPipeItem base;
DisplayChannelClient *dcc;
Drawable *drawable;
SpiceClipRects *rects;
-} UpgradeItem;
+} RedUpgradeItem;
DisplayChannel* display_channel_new (SpiceServer *reds,
diff --git a/server/inputs-channel.c b/server/inputs-channel.c
index 81a8d4a..d1af9cf 100644
--- a/server/inputs-channel.c
+++ b/server/inputs-channel.c
@@ -116,25 +116,25 @@ struct InputsChannel {
};
enum {
- PIPE_ITEM_INPUTS_INIT = PIPE_ITEM_TYPE_CHANNEL_BASE,
- PIPE_ITEM_MOUSE_MOTION_ACK,
- PIPE_ITEM_KEY_MODIFIERS,
- PIPE_ITEM_MIGRATE_DATA,
+ RED_PIPE_ITEM_INPUTS_INIT = RED_PIPE_ITEM_TYPE_CHANNEL_BASE,
+ RED_PIPE_ITEM_MOUSE_MOTION_ACK,
+ RED_PIPE_ITEM_KEY_MODIFIERS,
+ RED_PIPE_ITEM_MIGRATE_DATA,
};
-typedef struct InputsPipeItem {
+typedef struct RedInputsPipeItem {
RedPipeItem base;
-} InputsPipeItem;
+} RedInputsPipeItem;
-typedef struct KeyModifiersPipeItem {
+typedef struct RedKeyModifiersPipeItem {
RedPipeItem base;
uint8_t modifiers;
-} KeyModifiersPipeItem;
+} RedKeyModifiersPipeItem;
-typedef struct InputsInitPipeItem {
+typedef struct RedInputsInitPipeItem {
RedPipeItem base;
uint8_t modifiers;
-} InputsInitPipeItem;
+} RedInputsInitPipeItem;
static SpiceTimer *key_modifiers_timer;
@@ -229,12 +229,12 @@ static uint8_t kbd_get_leds(SpiceKbdInstance *sin)
return sif->get_leds(sin);
}
-static RedPipeItem *inputs_key_modifiers_item_new(
+static RedPipeItem *red_inputs_key_modifiers_item_new(
RedChannelClient *rcc, void *data, int num)
{
- KeyModifiersPipeItem *item = spice_malloc(sizeof(KeyModifiersPipeItem));
+ RedKeyModifiersPipeItem *item = spice_malloc(sizeof(RedKeyModifiersPipeItem));
- red_pipe_item_init(&item->base, PIPE_ITEM_KEY_MODIFIERS);
+ red_pipe_item_init(&item->base, RED_PIPE_ITEM_KEY_MODIFIERS);
item->modifiers = *(uint8_t *)data;
return &item->base;
}
@@ -265,30 +265,30 @@ static void inputs_channel_send_item(RedChannelClient *rcc, RedPipeItem *base)
SpiceMarshaller *m = red_channel_client_get_marshaller(rcc);
switch (base->type) {
- case PIPE_ITEM_KEY_MODIFIERS:
+ case RED_PIPE_ITEM_KEY_MODIFIERS:
{
SpiceMsgInputsKeyModifiers key_modifiers;
red_channel_client_init_send_data(rcc, SPICE_MSG_INPUTS_KEY_MODIFIERS, base);
key_modifiers.modifiers =
- SPICE_CONTAINEROF(base, KeyModifiersPipeItem, base)->modifiers;
+ SPICE_CONTAINEROF(base, RedKeyModifiersPipeItem, base)->modifiers;
spice_marshall_msg_inputs_key_modifiers(m, &key_modifiers);
break;
}
- case PIPE_ITEM_INPUTS_INIT:
+ case RED_PIPE_ITEM_INPUTS_INIT:
{
SpiceMsgInputsInit inputs_init;
red_channel_client_init_send_data(rcc, SPICE_MSG_INPUTS_INIT, base);
inputs_init.keyboard_modifiers =
- SPICE_CONTAINEROF(base, InputsInitPipeItem, base)->modifiers;
+ SPICE_CONTAINEROF(base, RedInputsInitPipeItem, base)->modifiers;
spice_marshall_msg_inputs_init(m, &inputs_init);
break;
}
- case PIPE_ITEM_MOUSE_MOTION_ACK:
+ case RED_PIPE_ITEM_MOUSE_MOTION_ACK:
red_channel_client_init_send_data(rcc, SPICE_MSG_INPUTS_MOUSE_MOTION_ACK, base);
break;
- case PIPE_ITEM_MIGRATE_DATA:
+ case RED_PIPE_ITEM_MIGRATE_DATA:
inputs_channel_send_migrate_data(rcc, m, base);
break;
default:
@@ -339,7 +339,7 @@ static int inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, ui
if (++icc->motion_count % SPICE_INPUT_MOTION_ACK_BUNCH == 0 &&
!inputs_channel->src_during_migrate) {
- red_channel_client_pipe_add_type(rcc, PIPE_ITEM_MOUSE_MOTION_ACK);
+ red_channel_client_pipe_add_type(rcc, RED_PIPE_ITEM_MOUSE_MOTION_ACK);
icc->motion_count = 0;
}
if (mouse && reds_get_mouse_mode(reds) == SPICE_MOUSE_MODE_SERVER) {
@@ -357,7 +357,7 @@ static int inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, ui
if (++icc->motion_count % SPICE_INPUT_MOTION_ACK_BUNCH == 0 &&
!inputs_channel->src_during_migrate) {
- red_channel_client_pipe_add_type(rcc, PIPE_ITEM_MOUSE_MOTION_ACK);
+ red_channel_client_pipe_add_type(rcc, RED_PIPE_ITEM_MOUSE_MOTION_ACK);
icc->motion_count = 0;
}
if (reds_get_mouse_mode(reds) != SPICE_MOUSE_MODE_CLIENT) {
@@ -500,10 +500,10 @@ static void inputs_channel_on_disconnect(RedChannelClient *rcc)
static void inputs_pipe_add_init(RedChannelClient *rcc)
{
- InputsInitPipeItem *item = spice_malloc(sizeof(InputsInitPipeItem));
+ RedInputsInitPipeItem *item = spice_malloc(sizeof(RedInputsInitPipeItem));
InputsChannel *inputs = SPICE_CONTAINEROF(rcc->channel, InputsChannel, base);
- red_pipe_item_init(&item->base, PIPE_ITEM_INPUTS_INIT);
+ red_pipe_item_init(&item->base, RED_PIPE_ITEM_INPUTS_INIT);
item->modifiers = kbd_get_leds(inputs_channel_get_keyboard(inputs));
red_channel_client_pipe_add_push(rcc, &item->base);
}
@@ -569,7 +569,7 @@ static void inputs_channel_push_keyboard_modifiers(InputsChannel *inputs, uint8_
return;
}
red_channel_pipes_new_add_push(&inputs->base,
- inputs_key_modifiers_item_new, (void*)&modifiers);
+ red_inputs_key_modifiers_item_new, (void*)&modifiers);
}
void inputs_channel_on_keyboard_leds_change(InputsChannel *inputs, uint8_t leds)
@@ -585,7 +585,7 @@ static void key_modifiers_sender(void *opaque)
static int inputs_channel_handle_migrate_flush_mark(RedChannelClient *rcc)
{
- red_channel_client_pipe_add_type(rcc, PIPE_ITEM_MIGRATE_DATA);
+ red_channel_client_pipe_add_type(rcc, RED_PIPE_ITEM_MIGRATE_DATA);
return TRUE;
}
@@ -612,7 +612,7 @@ static int inputs_channel_handle_migrate_data(RedChannelClient *rcc,
for (; icc->motion_count >= SPICE_INPUT_MOTION_ACK_BUNCH;
icc->motion_count -= SPICE_INPUT_MOTION_ACK_BUNCH) {
- red_channel_client_pipe_add_type(rcc, PIPE_ITEM_MOUSE_MOTION_ACK);
+ red_channel_client_pipe_add_type(rcc, RED_PIPE_ITEM_MOUSE_MOTION_ACK);
}
return TRUE;
}
diff --git a/server/main-channel.c b/server/main-channel.c
index b904e33..33f8eed 100644
--- a/server/main-channel.c
+++ b/server/main-channel.c
@@ -60,54 +60,54 @@
static const uint8_t zero_page[ZERO_BUF_SIZE] = {0};
enum {
- PIPE_ITEM_TYPE_MAIN_CHANNELS_LIST = PIPE_ITEM_TYPE_CHANNEL_BASE,
- PIPE_ITEM_TYPE_MAIN_PING,
- PIPE_ITEM_TYPE_MAIN_MOUSE_MODE,
- PIPE_ITEM_TYPE_MAIN_AGENT_DISCONNECTED,
- PIPE_ITEM_TYPE_MAIN_AGENT_TOKEN,
- PIPE_ITEM_TYPE_MAIN_AGENT_DATA,
- PIPE_ITEM_TYPE_MAIN_MIGRATE_DATA,
- PIPE_ITEM_TYPE_MAIN_INIT,
- PIPE_ITEM_TYPE_MAIN_NOTIFY,
- PIPE_ITEM_TYPE_MAIN_MIGRATE_BEGIN,
- PIPE_ITEM_TYPE_MAIN_MIGRATE_BEGIN_SEAMLESS,
- PIPE_ITEM_TYPE_MAIN_MIGRATE_SWITCH_HOST,
- PIPE_ITEM_TYPE_MAIN_MULTI_MEDIA_TIME,
- PIPE_ITEM_TYPE_MAIN_NAME,
- PIPE_ITEM_TYPE_MAIN_UUID,
- PIPE_ITEM_TYPE_MAIN_AGENT_CONNECTED_TOKENS,
+ RED_PIPE_ITEM_TYPE_MAIN_CHANNELS_LIST = RED_PIPE_ITEM_TYPE_CHANNEL_BASE,
+ RED_PIPE_ITEM_TYPE_MAIN_PING,
+ RED_PIPE_ITEM_TYPE_MAIN_MOUSE_MODE,
+ RED_PIPE_ITEM_TYPE_MAIN_AGENT_DISCONNECTED,
+ RED_PIPE_ITEM_TYPE_MAIN_AGENT_TOKEN,
+ RED_PIPE_ITEM_TYPE_MAIN_AGENT_DATA,
+ RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_DATA,
+ RED_PIPE_ITEM_TYPE_MAIN_INIT,
+ RED_PIPE_ITEM_TYPE_MAIN_NOTIFY,
+ RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_BEGIN,
+ RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_BEGIN_SEAMLESS,
+ RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_SWITCH_HOST,
+ RED_PIPE_ITEM_TYPE_MAIN_MULTI_MEDIA_TIME,
+ RED_PIPE_ITEM_TYPE_MAIN_NAME,
+ RED_PIPE_ITEM_TYPE_MAIN_UUID,
+ RED_PIPE_ITEM_TYPE_MAIN_AGENT_CONNECTED_TOKENS,
};
-typedef struct RefsPipeItem {
+typedef struct RedRefsPipeItem {
RedPipeItem base;
int *refs;
-} RefsPipeItem;
+} RedRefsPipeItem;
-typedef struct PingPipeItem {
+typedef struct RedPingPipeItem {
RedPipeItem base;
int size;
-} PingPipeItem;
+} RedPingPipeItem;
-typedef struct MouseModePipeItem {
+typedef struct RedMouseModePipeItem {
RedPipeItem base;
int current_mode;
int is_client_mouse_allowed;
-} MouseModePipeItem;
+} RedMouseModePipeItem;
-typedef struct TokensPipeItem {
+typedef struct RedTokensPipeItem {
RedPipeItem base;
int tokens;
-} TokensPipeItem;
+} RedTokensPipeItem;
-typedef struct AgentDataPipeItem {
+typedef struct RedAgentDataPipeItem {
RedPipeItem base;
uint8_t* data;
size_t len;
spice_marshaller_item_free_func free_data;
void *opaque;
-} AgentDataPipeItem;
+} RedAgentDataPipeItem;
-typedef struct InitPipeItem {
+typedef struct RedInitPipeItem {
RedPipeItem base;
int connection_id;
int display_channels_hint;
@@ -115,27 +115,27 @@ typedef struct InitPipeItem {
int is_client_mouse_allowed;
int multi_media_time;
int ram_hint;
-} InitPipeItem;
+} RedInitPipeItem;
-typedef struct NamePipeItem {
+typedef struct RedNamePipeItem {
RedPipeItem base;
SpiceMsgMainName msg;
-} NamePipeItem;
+} RedNamePipeItem;
-typedef struct UuidPipeItem {
+typedef struct RedUuidPipeItem {
RedPipeItem base;
SpiceMsgMainUuid msg;
-} UuidPipeItem;
+} RedUuidPipeItem;
-typedef struct NotifyPipeItem {
+typedef struct RedNotifyPipeItem {
RedPipeItem base;
char *msg;
-} NotifyPipeItem;
+} RedNotifyPipeItem;
-typedef struct MultiMediaTimePipeItem {
+typedef struct RedMultiMediaTimePipeItem {
RedPipeItem base;
int time;
-} MultiMediaTimePipeItem;
+} RedMultiMediaTimePipeItem;
struct MainChannelClient {
RedChannelClient base;
@@ -223,29 +223,29 @@ typedef struct MainMouseModeItemInfo {
static RedPipeItem *main_mouse_mode_item_new(RedChannelClient *rcc, void *data, int num)
{
- MouseModePipeItem *item = spice_malloc(sizeof(MouseModePipeItem));
+ RedMouseModePipeItem *item = spice_malloc(sizeof(RedMouseModePipeItem));
MainMouseModeItemInfo *info = data;
- red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_MAIN_MOUSE_MODE);
+ red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_MAIN_MOUSE_MODE);
item->current_mode = info->current_mode;
item->is_client_mouse_allowed = info->is_client_mouse_allowed;
return &item->base;
}
-static RedPipeItem *main_ping_item_new(MainChannelClient *mcc, int size)
+static RedPipeItem *red_ping_item_new(MainChannelClient *mcc, int size)
{
- PingPipeItem *item = spice_malloc(sizeof(PingPipeItem));
+ RedPingPipeItem *item = spice_malloc(sizeof(RedPingPipeItem));
- red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_MAIN_PING);
+ red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_MAIN_PING);
item->size = size;
return &item->base;
}
static RedPipeItem *main_agent_tokens_item_new(RedChannelClient *rcc, uint32_t num_tokens)
{
- TokensPipeItem *item = spice_malloc(sizeof(TokensPipeItem));
+ RedTokensPipeItem *item = spice_malloc(sizeof(RedTokensPipeItem));
- red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_MAIN_AGENT_TOKEN);
+ red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_MAIN_AGENT_TOKEN);
item->tokens = num_tokens;
return &item->base;
}
@@ -254,9 +254,9 @@ static RedPipeItem *main_agent_data_item_new(RedChannelClient *rcc, uint8_t* dat
spice_marshaller_item_free_func free_data,
void *opaque)
{
- AgentDataPipeItem *item = spice_malloc(sizeof(AgentDataPipeItem));
+ RedAgentDataPipeItem *item = spice_malloc(sizeof(RedAgentDataPipeItem));
- red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_MAIN_AGENT_DATA);
+ red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_MAIN_AGENT_DATA);
item->data = data;
item->len = len;
item->free_data = free_data;
@@ -269,9 +269,9 @@ static RedPipeItem *main_init_item_new(MainChannelClient *mcc,
int is_client_mouse_allowed, int multi_media_time,
int ram_hint)
{
- InitPipeItem *item = spice_malloc(sizeof(InitPipeItem));
+ RedInitPipeItem *item = spice_malloc(sizeof(RedInitPipeItem));
- red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_MAIN_INIT);
+ red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_MAIN_INIT);
item->connection_id = connection_id;
item->display_channels_hint = display_channels_hint;
item->current_mouse_mode = current_mouse_mode;
@@ -283,9 +283,9 @@ static RedPipeItem *main_init_item_new(MainChannelClient *mcc,
static RedPipeItem *main_name_item_new(MainChannelClient *mcc, const char *name)
{
- NamePipeItem *item = spice_malloc(sizeof(NamePipeItem) + strlen(name) + 1);
+ RedNamePipeItem *item = spice_malloc(sizeof(RedNamePipeItem) + strlen(name) + 1);
- red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_MAIN_NAME);
+ red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_MAIN_NAME);
item->msg.name_len = strlen(name) + 1;
memcpy(&item->msg.name, name, item->msg.name_len);
@@ -294,9 +294,9 @@ static RedPipeItem *main_name_item_new(MainChannelClient *mcc, const char *name)
static RedPipeItem *main_uuid_item_new(MainChannelClient *mcc, const uint8_t uuid[16])
{
- UuidPipeItem *item = spice_malloc(sizeof(UuidPipeItem));
+ RedUuidPipeItem *item = spice_malloc(sizeof(RedUuidPipeItem));
- red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_MAIN_UUID);
+ red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_MAIN_UUID);
memcpy(item->msg.uuid, uuid, sizeof(item->msg.uuid));
return &item->base;
@@ -304,10 +304,10 @@ static RedPipeItem *main_uuid_item_new(MainChannelClient *mcc, const uint8_t uui
static RedPipeItem *main_notify_item_new(RedChannelClient *rcc, void *data, int num)
{
- NotifyPipeItem *item = spice_malloc(sizeof(NotifyPipeItem));
+ RedNotifyPipeItem *item = spice_malloc(sizeof(RedNotifyPipeItem));
const char *msg = data;
- red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_MAIN_NOTIFY);
+ red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_MAIN_NOTIFY);
item->msg = spice_strdup(msg);
return &item->base;
}
@@ -315,10 +315,10 @@ static RedPipeItem *main_notify_item_new(RedChannelClient *rcc, void *data, int
static RedPipeItem *main_multi_media_time_item_new(
RedChannelClient *rcc, void *data, int num)
{
- MultiMediaTimePipeItem *item, *info = data;
+ RedMultiMediaTimePipeItem *item, *info = data;
- item = spice_malloc(sizeof(MultiMediaTimePipeItem));
- red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_MAIN_MULTI_MEDIA_TIME);
+ item = spice_malloc(sizeof(RedMultiMediaTimePipeItem));
+ red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_MAIN_MULTI_MEDIA_TIME);
item->time = info->time;
return &item->base;
}
@@ -330,7 +330,7 @@ static void main_channel_push_channels(MainChannelClient *mcc)
"during migration");
return;
}
- red_channel_client_pipe_add_type(&mcc->base, PIPE_ITEM_TYPE_MAIN_CHANNELS_LIST);
+ red_channel_client_pipe_add_type(&mcc->base, RED_PIPE_ITEM_TYPE_MAIN_CHANNELS_LIST);
}
static void main_channel_marshall_channels(RedChannelClient *rcc,
@@ -354,14 +354,14 @@ int main_channel_client_push_ping(MainChannelClient *mcc, int size)
if (mcc == NULL) {
return FALSE;
}
- item = main_ping_item_new(mcc, size);
+ item = red_ping_item_new(mcc, size);
red_channel_client_pipe_add_push(&mcc->base, item);
return TRUE;
}
static void main_channel_marshall_ping(RedChannelClient *rcc,
SpiceMarshaller *m,
- PingPipeItem *item)
+ RedPingPipeItem *item)
{
MainChannelClient *mcc = SPICE_CONTAINEROF(rcc, MainChannelClient, base);
SpiceMsgPing ping;
@@ -393,7 +393,7 @@ void main_channel_push_mouse_mode(MainChannel *main_chan, int current_mode,
static void main_channel_marshall_mouse_mode(RedChannelClient *rcc,
SpiceMarshaller *m,
- MouseModePipeItem *item)
+ RedMouseModePipeItem *item)
{
SpiceMsgMainMouseMode mouse_mode;
@@ -409,7 +409,7 @@ static void main_channel_marshall_mouse_mode(RedChannelClient *rcc,
void main_channel_push_agent_connected(MainChannel *main_chan)
{
if (red_channel_test_remote_cap(&main_chan->base, SPICE_MAIN_CAP_AGENT_CONNECTED_TOKENS)) {
- red_channel_pipes_add_type(&main_chan->base, PIPE_ITEM_TYPE_MAIN_AGENT_CONNECTED_TOKENS);
+ red_channel_pipes_add_type(&main_chan->base, RED_PIPE_ITEM_TYPE_MAIN_AGENT_CONNECTED_TOKENS);
} else {
red_channel_pipes_add_empty_msg(&main_chan->base, SPICE_MSG_MAIN_AGENT_CONNECTED);
}
@@ -428,7 +428,7 @@ static void main_channel_marshall_agent_connected(SpiceMarshaller *m,
void main_channel_push_agent_disconnected(MainChannel *main_chan)
{
- red_channel_pipes_add_type(&main_chan->base, PIPE_ITEM_TYPE_MAIN_AGENT_DISCONNECTED);
+ red_channel_pipes_add_type(&main_chan->base, RED_PIPE_ITEM_TYPE_MAIN_AGENT_DISCONNECTED);
}
static void main_channel_marshall_agent_disconnected(RedChannelClient *rcc,
@@ -450,7 +450,7 @@ void main_channel_client_push_agent_tokens(MainChannelClient *mcc, uint32_t num_
}
static void main_channel_marshall_tokens(RedChannelClient *rcc,
- SpiceMarshaller *m, TokensPipeItem *item)
+ SpiceMarshaller *m, RedTokensPipeItem *item)
{
SpiceMsgMainAgentTokens tokens;
@@ -470,7 +470,7 @@ void main_channel_client_push_agent_data(MainChannelClient *mcc, uint8_t* data,
static void main_channel_marshall_agent_data(RedChannelClient *rcc,
SpiceMarshaller *m,
- AgentDataPipeItem *item)
+ RedAgentDataPipeItem *item)
{
red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_AGENT_DATA, &item->base);
spice_marshaller_add_ref(m, item->data, item->len);
@@ -478,7 +478,7 @@ static void main_channel_marshall_agent_data(RedChannelClient *rcc,
static void main_channel_push_migrate_data_item(MainChannel *main_chan)
{
- red_channel_pipes_add_type(&main_chan->base, PIPE_ITEM_TYPE_MAIN_MIGRATE_DATA);
+ red_channel_pipes_add_type(&main_chan->base, RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_DATA);
}
static void main_channel_marshall_migrate_data_item(RedChannelClient *rcc,
@@ -526,9 +526,9 @@ void main_channel_push_init(MainChannelClient *mcc,
static void main_channel_marshall_init(RedChannelClient *rcc,
SpiceMarshaller *m,
- InitPipeItem *item)
+ RedInitPipeItem *item)
{
- SpiceMsgMainInit init; // TODO - remove this copy, make InitPipeItem reuse SpiceMsgMainInit
+ SpiceMsgMainInit init; // TODO - remove this copy, make RedInitPipeItem reuse SpiceMsgMainInit
red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_INIT, &item->base);
@@ -577,7 +577,7 @@ void main_channel_client_push_notify(MainChannelClient *mcc, const char *msg)
}
static void main_channel_marshall_notify(RedChannelClient *rcc,
- SpiceMarshaller *m, NotifyPipeItem *item)
+ SpiceMarshaller *m, RedNotifyPipeItem *item)
{
SpiceMsgNotify notify;
@@ -636,7 +636,7 @@ static void main_channel_marshall_migrate_begin_seamless(SpiceMarshaller *m,
void main_channel_push_multi_media_time(MainChannel *main_chan, int time)
{
- MultiMediaTimePipeItem info = {
+ RedMultiMediaTimePipeItem info = {
.time = time,
};
@@ -662,7 +662,7 @@ static void main_channel_fill_mig_target(MainChannel *main_channel, RedsMigSpice
void main_channel_migrate_switch(MainChannel *main_chan, RedsMigSpice *mig_target)
{
main_channel_fill_mig_target(main_chan, mig_target);
- red_channel_pipes_add_type(&main_chan->base, PIPE_ITEM_TYPE_MAIN_MIGRATE_SWITCH_HOST);
+ red_channel_pipes_add_type(&main_chan->base, RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_SWITCH_HOST);
}
static void main_channel_marshall_migrate_switch(SpiceMarshaller *m, RedChannelClient *rcc,
@@ -690,7 +690,7 @@ static void main_channel_marshall_migrate_switch(SpiceMarshaller *m, RedChannelC
static void main_channel_marshall_multi_media_time(RedChannelClient *rcc,
SpiceMarshaller *m,
- MultiMediaTimePipeItem *item)
+ RedMultiMediaTimePipeItem *item)
{
SpiceMsgMainMultiMediaTime time_mes;
@@ -708,7 +708,7 @@ static void main_channel_send_item(RedChannelClient *rcc, RedPipeItem *base)
* we ignore any pipe item that arrives before the INIT msg is sent.
* For seamless we don't send INIT, and the connection continues from the same place
* it stopped on the src side. */
- if (!mcc->init_sent && !mcc->seamless_mig_dst && base->type != PIPE_ITEM_TYPE_MAIN_INIT) {
+ if (!mcc->init_sent && !mcc->seamless_mig_dst && base->type != RED_PIPE_ITEM_TYPE_MAIN_INIT) {
spice_printerr("Init msg for client %p was not sent yet "
"(client is probably during semi-seamless migration). Ignoring msg type %d",
rcc->client, base->type);
@@ -716,65 +716,65 @@ static void main_channel_send_item(RedChannelClient *rcc, RedPipeItem *base)
return;
}
switch (base->type) {
- case PIPE_ITEM_TYPE_MAIN_CHANNELS_LIST:
+ case RED_PIPE_ITEM_TYPE_MAIN_CHANNELS_LIST:
main_channel_marshall_channels(rcc, m, base);
break;
- case PIPE_ITEM_TYPE_MAIN_PING:
+ case RED_PIPE_ITEM_TYPE_MAIN_PING:
main_channel_marshall_ping(rcc, m,
- SPICE_CONTAINEROF(base, PingPipeItem, base));
+ SPICE_CONTAINEROF(base, RedPingPipeItem, base));
break;
- case PIPE_ITEM_TYPE_MAIN_MOUSE_MODE:
+ case RED_PIPE_ITEM_TYPE_MAIN_MOUSE_MODE:
{
- MouseModePipeItem *item =
- SPICE_CONTAINEROF(base, MouseModePipeItem, base);
+ RedMouseModePipeItem *item =
+ SPICE_CONTAINEROF(base, RedMouseModePipeItem, base);
main_channel_marshall_mouse_mode(rcc, m, item);
break;
}
- case PIPE_ITEM_TYPE_MAIN_AGENT_DISCONNECTED:
+ case RED_PIPE_ITEM_TYPE_MAIN_AGENT_DISCONNECTED:
main_channel_marshall_agent_disconnected(rcc, m, base);
break;
- case PIPE_ITEM_TYPE_MAIN_AGENT_TOKEN:
+ case RED_PIPE_ITEM_TYPE_MAIN_AGENT_TOKEN:
main_channel_marshall_tokens(rcc, m,
- SPICE_CONTAINEROF(base, TokensPipeItem, base));
+ SPICE_CONTAINEROF(base, RedTokensPipeItem, base));
break;
- case PIPE_ITEM_TYPE_MAIN_AGENT_DATA:
+ case RED_PIPE_ITEM_TYPE_MAIN_AGENT_DATA:
main_channel_marshall_agent_data(rcc, m,
- SPICE_CONTAINEROF(base, AgentDataPipeItem, base));
+ SPICE_CONTAINEROF(base, RedAgentDataPipeItem, base));
break;
- case PIPE_ITEM_TYPE_MAIN_MIGRATE_DATA:
+ case RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_DATA:
main_channel_marshall_migrate_data_item(rcc, m, base);
break;
- case PIPE_ITEM_TYPE_MAIN_INIT:
+ case RED_PIPE_ITEM_TYPE_MAIN_INIT:
mcc->init_sent = TRUE;
main_channel_marshall_init(rcc, m,
- SPICE_CONTAINEROF(base, InitPipeItem, base));
+ SPICE_CONTAINEROF(base, RedInitPipeItem, base));
break;
- case PIPE_ITEM_TYPE_MAIN_NOTIFY:
+ case RED_PIPE_ITEM_TYPE_MAIN_NOTIFY:
main_channel_marshall_notify(rcc, m,
- SPICE_CONTAINEROF(base, NotifyPipeItem, base));
+ SPICE_CONTAINEROF(base, RedNotifyPipeItem, base));
break;
- case PIPE_ITEM_TYPE_MAIN_MIGRATE_BEGIN:
+ case RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_BEGIN:
main_channel_marshall_migrate_begin(m, rcc, base);
break;
- case PIPE_ITEM_TYPE_MAIN_MIGRATE_BEGIN_SEAMLESS:
+ case RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_BEGIN_SEAMLESS:
main_channel_marshall_migrate_begin_seamless(m, rcc, base);
break;
- case PIPE_ITEM_TYPE_MAIN_MULTI_MEDIA_TIME:
+ case RED_PIPE_ITEM_TYPE_MAIN_MULTI_MEDIA_TIME:
main_channel_marshall_multi_media_time(rcc, m,
- SPICE_CONTAINEROF(base, MultiMediaTimePipeItem, base));
+ SPICE_CONTAINEROF(base, RedMultiMediaTimePipeItem, base));
break;
- case PIPE_ITEM_TYPE_MAIN_MIGRATE_SWITCH_HOST:
+ case RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_SWITCH_HOST:
main_channel_marshall_migrate_switch(m, rcc, base);
break;
- case PIPE_ITEM_TYPE_MAIN_NAME:
+ case RED_PIPE_ITEM_TYPE_MAIN_NAME:
red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_NAME, base);
- spice_marshall_msg_main_name(m, &SPICE_CONTAINEROF(base, NamePipeItem, base)->msg);
+ spice_marshall_msg_main_name(m, &SPICE_CONTAINEROF(base, RedNamePipeItem, base)->msg);
break;
- case PIPE_ITEM_TYPE_MAIN_UUID:
+ case RED_PIPE_ITEM_TYPE_MAIN_UUID:
red_channel_client_init_send_data(rcc, SPICE_MSG_MAIN_UUID, base);
- spice_marshall_msg_main_uuid(m, &SPICE_CONTAINEROF(base, UuidPipeItem, base)->msg);
+ spice_marshall_msg_main_uuid(m, &SPICE_CONTAINEROF(base, RedUuidPipeItem, base)->msg);
break;
- case PIPE_ITEM_TYPE_MAIN_AGENT_CONNECTED_TOKENS:
+ case RED_PIPE_ITEM_TYPE_MAIN_AGENT_CONNECTED_TOKENS:
main_channel_marshall_agent_connected(m, rcc, base);
break;
default:
@@ -787,14 +787,14 @@ static void main_channel_release_pipe_item(RedChannelClient *rcc,
RedPipeItem *base, int item_pushed)
{
switch (base->type) {
- case PIPE_ITEM_TYPE_MAIN_AGENT_DATA: {
- AgentDataPipeItem *data = (AgentDataPipeItem *)base;
+ case RED_PIPE_ITEM_TYPE_MAIN_AGENT_DATA: {
+ RedAgentDataPipeItem *data = (RedAgentDataPipeItem *)base;
data->free_data(data->data, data->opaque);
break;
}
- case PIPE_ITEM_TYPE_MAIN_NOTIFY: {
- NotifyPipeItem *data = (NotifyPipeItem *)base;
+ case RED_PIPE_ITEM_TYPE_MAIN_NOTIFY: {
+ RedNotifyPipeItem *data = (RedNotifyPipeItem *)base;
free(data->msg);
break;
}
@@ -861,9 +861,9 @@ void main_channel_migrate_dst_complete(MainChannelClient *mcc)
if (mcc->mig_wait_prev_try_seamless) {
spice_assert(mcc->base.channel->clients_num == 1);
red_channel_client_pipe_add_type(&mcc->base,
- PIPE_ITEM_TYPE_MAIN_MIGRATE_BEGIN_SEAMLESS);
+ RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_BEGIN_SEAMLESS);
} else {
- red_channel_client_pipe_add_type(&mcc->base, PIPE_ITEM_TYPE_MAIN_MIGRATE_BEGIN);
+ red_channel_client_pipe_add_type(&mcc->base, RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_BEGIN);
}
mcc->mig_wait_connect = TRUE;
mcc->mig_wait_prev_complete = FALSE;
@@ -1211,7 +1211,7 @@ static int main_channel_connect_semi_seamless(MainChannel *main_channel)
mcc->mig_wait_prev_try_seamless = FALSE;
} else {
red_channel_client_pipe_add_type(&mcc->base,
- PIPE_ITEM_TYPE_MAIN_MIGRATE_BEGIN);
+ RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_BEGIN);
mcc->mig_wait_connect = TRUE;
}
mcc->mig_connect_ok = FALSE;
@@ -1238,7 +1238,7 @@ static int main_channel_connect_seamless(MainChannel *main_channel)
mcc->mig_wait_prev_try_seamless = TRUE;
} else {
red_channel_client_pipe_add_type(&mcc->base,
- PIPE_ITEM_TYPE_MAIN_MIGRATE_BEGIN_SEAMLESS);
+ RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_BEGIN_SEAMLESS);
mcc->mig_wait_connect = TRUE;
}
mcc->mig_connect_ok = FALSE;
@@ -1325,7 +1325,7 @@ int main_channel_migrate_src_complete(MainChannel *main_chan, int success)
} else {
if (success) {
spice_printerr("client %p SWITCH_HOST", mcc->base.client);
- red_channel_client_pipe_add_type(&mcc->base, PIPE_ITEM_TYPE_MAIN_MIGRATE_SWITCH_HOST);
+ red_channel_client_pipe_add_type(&mcc->base, RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_SWITCH_HOST);
}
}
mcc->mig_connect_ok = FALSE;
diff --git a/server/red-channel.c b/server/red-channel.c
index 834ddb7..d9aab01 100644
--- a/server/red-channel.c
+++ b/server/red-channel.c
@@ -44,10 +44,10 @@
#include "main-dispatcher.h"
#include "utils.h"
-typedef struct EmptyMsgPipeItem {
+typedef struct RedEmptyMsgPipeItem {
RedPipeItem base;
int msg;
-} EmptyMsgPipeItem;
+} RedEmptyMsgPipeItem;
#define PING_TEST_TIMEOUT_MS (MSEC_PER_SEC * 15)
#define PING_TEST_IDLE_NET_TIMEOUT_MS (MSEC_PER_SEC / 10)
@@ -477,7 +477,7 @@ static void red_channel_client_reset_send_data(RedChannelClient *rcc)
void red_channel_client_push_set_ack(RedChannelClient *rcc)
{
- red_channel_client_pipe_add_type(rcc, PIPE_ITEM_TYPE_SET_ACK);
+ red_channel_client_pipe_add_type(rcc, RED_PIPE_ITEM_TYPE_SET_ACK);
}
static void red_channel_client_send_set_ack(RedChannelClient *rcc)
@@ -512,7 +512,7 @@ static void red_channel_client_send_migrate(RedChannelClient *rcc)
static void red_channel_client_send_empty_msg(RedChannelClient *rcc, RedPipeItem *base)
{
- EmptyMsgPipeItem *msg_pipe_item = SPICE_CONTAINEROF(base, EmptyMsgPipeItem, base);
+ RedEmptyMsgPipeItem *msg_pipe_item = SPICE_CONTAINEROF(base, RedEmptyMsgPipeItem, base);
red_channel_client_init_send_data(rcc, msg_pipe_item->msg, NULL);
red_channel_client_begin_send_message(rcc);
@@ -562,16 +562,16 @@ static void red_channel_client_send_item(RedChannelClient *rcc, RedPipeItem *ite
spice_assert(red_channel_client_no_item_being_sent(rcc));
red_channel_client_reset_send_data(rcc);
switch (item->type) {
- case PIPE_ITEM_TYPE_SET_ACK:
+ case RED_PIPE_ITEM_TYPE_SET_ACK:
red_channel_client_send_set_ack(rcc);
break;
- case PIPE_ITEM_TYPE_MIGRATE:
+ case RED_PIPE_ITEM_TYPE_MIGRATE:
red_channel_client_send_migrate(rcc);
break;
- case PIPE_ITEM_TYPE_EMPTY_MSG:
+ case RED_PIPE_ITEM_TYPE_EMPTY_MSG:
red_channel_client_send_empty_msg(rcc, item);
break;
- case PIPE_ITEM_TYPE_PING:
+ case RED_PIPE_ITEM_TYPE_PING:
red_channel_client_send_ping(rcc);
break;
default:
@@ -584,10 +584,10 @@ static void red_channel_client_send_item(RedChannelClient *rcc, RedPipeItem *ite
static void red_channel_client_release_item(RedChannelClient *rcc, RedPipeItem *item, int item_pushed)
{
switch (item->type) {
- case PIPE_ITEM_TYPE_SET_ACK:
- case PIPE_ITEM_TYPE_EMPTY_MSG:
- case PIPE_ITEM_TYPE_MIGRATE:
- case PIPE_ITEM_TYPE_PING:
+ case RED_PIPE_ITEM_TYPE_SET_ACK:
+ case RED_PIPE_ITEM_TYPE_EMPTY_MSG:
+ case RED_PIPE_ITEM_TYPE_MIGRATE:
+ case RED_PIPE_ITEM_TYPE_PING:
free(item);
break;
default:
@@ -733,8 +733,8 @@ static void red_channel_client_push_ping(RedChannelClient *rcc)
rcc->latency_monitor.state = PING_STATE_WARMUP;
rcc->latency_monitor.warmup_was_sent = FALSE;
rcc->latency_monitor.id = rand();
- red_channel_client_pipe_add_type(rcc, PIPE_ITEM_TYPE_PING);
- red_channel_client_pipe_add_type(rcc, PIPE_ITEM_TYPE_PING);
+ red_channel_client_pipe_add_type(rcc, RED_PIPE_ITEM_TYPE_PING);
+ red_channel_client_pipe_add_type(rcc, RED_PIPE_ITEM_TYPE_PING);
}
static void red_channel_client_ping_timer(void *opaque)
@@ -1013,7 +1013,7 @@ void red_channel_client_default_migrate(RedChannelClient *rcc)
rcc->channel->core->timer_remove(rcc->connectivity_monitor.timer);
rcc->connectivity_monitor.timer = NULL;
}
- red_channel_client_pipe_add_type(rcc, PIPE_ITEM_TYPE_MIGRATE);
+ red_channel_client_pipe_add_type(rcc, RED_PIPE_ITEM_TYPE_MIGRATE);
}
RedChannel *red_channel_create(int size,
@@ -1737,9 +1737,9 @@ void red_channel_pipes_add_type(RedChannel *channel, int pipe_item_type)
void red_channel_client_pipe_add_empty_msg(RedChannelClient *rcc, int msg_type)
{
- EmptyMsgPipeItem *item = spice_new(EmptyMsgPipeItem, 1);
+ RedEmptyMsgPipeItem *item = spice_new(RedEmptyMsgPipeItem, 1);
- red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_EMPTY_MSG);
+ red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_EMPTY_MSG);
item->msg = msg_type;
red_channel_client_pipe_add(rcc, &item->base);
red_channel_client_push(rcc);
diff --git a/server/red-channel.h b/server/red-channel.h
index be5ae99..d169a9a 100644
--- a/server/red-channel.h
+++ b/server/red-channel.h
@@ -140,12 +140,12 @@ typedef struct MainChannelClient MainChannelClient;
* but we keep the 100 first allocated for base channel approach.
* */
enum {
- PIPE_ITEM_TYPE_SET_ACK=1,
- PIPE_ITEM_TYPE_MIGRATE,
- PIPE_ITEM_TYPE_EMPTY_MSG,
- PIPE_ITEM_TYPE_PING,
+ RED_PIPE_ITEM_TYPE_SET_ACK=1,
+ RED_PIPE_ITEM_TYPE_MIGRATE,
+ RED_PIPE_ITEM_TYPE_EMPTY_MSG,
+ RED_PIPE_ITEM_TYPE_PING,
- PIPE_ITEM_TYPE_CHANNEL_BASE=101,
+ RED_PIPE_ITEM_TYPE_CHANNEL_BASE=101,
};
typedef uint8_t *(*channel_alloc_msg_recv_buf_proc)(RedChannelClient *channel,
diff --git a/server/red-worker.h b/server/red-worker.h
index 731afc7..d7525e0 100644
--- a/server/red-worker.h
+++ b/server/red-worker.h
@@ -50,27 +50,27 @@ typedef struct CommonGraphicsChannel {
#define COMMON_GRAPHICS_CHANNEL(Channel) ((CommonGraphicsChannel*)(Channel))
enum {
- PIPE_ITEM_TYPE_VERB = PIPE_ITEM_TYPE_CHANNEL_BASE,
- PIPE_ITEM_TYPE_INVAL_ONE,
+ RED_PIPE_ITEM_TYPE_VERB = RED_PIPE_ITEM_TYPE_CHANNEL_BASE,
+ RED_PIPE_ITEM_TYPE_INVAL_ONE,
- PIPE_ITEM_TYPE_COMMON_LAST
+ RED_PIPE_ITEM_TYPE_COMMON_LAST
};
-typedef struct VerbItem {
+typedef struct RedVerbItem {
RedPipeItem base;
uint16_t verb;
-} VerbItem;
+} RedVerbItem;
-static inline void red_marshall_verb(RedChannelClient *rcc, VerbItem *item)
+static inline void red_marshall_verb(RedChannelClient *rcc, RedVerbItem *item)
{
red_channel_client_init_send_data(rcc, item->verb, NULL);
}
static inline void red_pipe_add_verb(RedChannelClient* rcc, uint16_t verb)
{
- VerbItem *item = spice_new(VerbItem, 1);
+ RedVerbItem *item = spice_new(RedVerbItem, 1);
- red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_VERB);
+ red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_VERB);
item->verb = verb;
red_channel_client_pipe_add(rcc, &item->base);
}
diff --git a/server/reds.c b/server/reds.c
index 4a8caea..d89b04b 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -166,13 +166,13 @@ struct ChannelSecurityOptions {
ChannelSecurityOptions *next;
};
-typedef struct VDIReadBuf {
+typedef struct RedVDIReadBuf {
RedPipeItem parent;
RedCharDeviceVDIPort *dev;
int len;
uint8_t data[SPICE_AGENT_MAX_DATA_SIZE];
-} VDIReadBuf;
+} RedVDIReadBuf;
enum {
VDI_PORT_READ_STATE_READ_HEADER,
@@ -196,7 +196,7 @@ struct RedCharDeviceVDIPortPrivate {
uint32_t message_receive_len;
uint8_t *receive_pos;
uint32_t receive_len;
- VDIReadBuf *current_read_buf;
+ RedVDIReadBuf *current_read_buf;
AgentMsgFilter read_filter;
VDIChunkHeader vdi_chunk_header;
@@ -261,8 +261,8 @@ static void reds_set_mouse_mode(RedsState *reds, uint32_t mode);
static uint32_t reds_qxl_ram_size(RedsState *reds);
static int calc_compression_level(RedsState *reds);
-static VDIReadBuf *vdi_port_get_read_buf(RedCharDeviceVDIPort *dev);
-static void vdi_port_read_buf_free(VDIReadBuf *buf);
+static RedVDIReadBuf *vdi_port_get_read_buf(RedCharDeviceVDIPort *dev);
+static void vdi_port_read_buf_free(RedVDIReadBuf *buf);
static ChannelSecurityOptions *reds_find_channel_security(RedsState *reds, int id)
{
@@ -703,13 +703,14 @@ static void reds_agent_remove(RedsState *reds)
static void vdi_port_read_buf_release(uint8_t *data, void *opaque)
{
- VDIReadBuf *buf = (VDIReadBuf *)opaque;
+ RedVDIReadBuf *buf = (RedVDIReadBuf *)opaque;
red_pipe_item_unref(buf);
}
/* returns TRUE if the buffer can be forwarded */
-static gboolean vdi_port_read_buf_process(RedCharDeviceVDIPort *dev, VDIReadBuf *buf, gboolean *error)
+static gboolean vdi_port_read_buf_process(RedCharDeviceVDIPort *dev,
+ RedVDIReadBuf *buf, gboolean *error)
{
int res;
@@ -738,7 +739,7 @@ static gboolean vdi_port_read_buf_process(RedCharDeviceVDIPort *dev, VDIReadBuf
}
}
-static void vdi_read_buf_init(VDIReadBuf *buf)
+static void vdi_read_buf_init(RedVDIReadBuf *buf)
{
g_return_if_fail(buf != NULL);
/* Bogus pipe item type, we only need the RingItem and refcounting
@@ -748,17 +749,17 @@ static void vdi_read_buf_init(VDIReadBuf *buf)
(GDestroyNotify)vdi_port_read_buf_free);
}
-static VDIReadBuf *vdi_port_get_read_buf(RedCharDeviceVDIPort *dev)
+static RedVDIReadBuf *vdi_port_get_read_buf(RedCharDeviceVDIPort *dev)
{
RingItem *item;
- VDIReadBuf *buf;
+ RedVDIReadBuf *buf;
if (!(item = ring_get_head(&dev->priv->read_bufs))) {
return NULL;
}
ring_remove(item);
- buf = SPICE_CONTAINEROF(item, VDIReadBuf, parent.link);
+ buf = SPICE_CONTAINEROF(item, RedVDIReadBuf, parent.link);
g_warn_if_fail(buf->parent.refcount == 0);
vdi_read_buf_init(buf);
@@ -766,7 +767,7 @@ static VDIReadBuf *vdi_port_get_read_buf(RedCharDeviceVDIPort *dev)
return buf;
}
-static void vdi_port_read_buf_free(VDIReadBuf *buf)
+static void vdi_port_read_buf_free(RedVDIReadBuf *buf)
{
g_warn_if_fail(buf->parent.refcount == 0);
ring_add(&buf->dev->priv->read_bufs, (RingItem *)buf);
@@ -788,7 +789,7 @@ static RedPipeItem *vdi_port_read_one_msg_from_device(SpiceCharDeviceInstance *s
RedsState *reds;
RedCharDeviceVDIPort *dev = RED_CHAR_DEVICE_VDIPORT(sin->st);
SpiceCharDeviceInterface *sif;
- VDIReadBuf *dispatch_buf;
+ RedVDIReadBuf *dispatch_buf;
int n;
g_object_get(dev, "spice-server", &reds, NULL);
@@ -861,7 +862,7 @@ static void vdi_port_send_msg_to_client(RedPipeItem *msg,
RedClient *client,
void *opaque)
{
- VDIReadBuf *agent_data_buf = (VDIReadBuf *)msg;
+ RedVDIReadBuf *agent_data_buf = (RedVDIReadBuf *)msg;
red_pipe_item_ref(agent_data_buf);
main_channel_client_push_agent_data(red_client_get_main(client),
@@ -1201,7 +1202,7 @@ void reds_on_main_channel_migrate(RedsState *reds, MainChannelClient *mcc)
if (agent_dev->priv->read_filter.msg_data_to_read ||
read_data_len > sizeof(VDAgentMessage)) { /* msg header has been read */
- VDIReadBuf *read_buf = agent_dev->priv->current_read_buf;
+ RedVDIReadBuf *read_buf = agent_dev->priv->current_read_buf;
gboolean error = FALSE;
spice_debug("push partial read %u (msg first chunk? %d)", read_data_len,
@@ -4297,7 +4298,7 @@ red_char_device_vdi_port_init(RedCharDeviceVDIPort *self)
self->priv->receive_len = sizeof(self->priv->vdi_chunk_header);
for (i = 0; i < REDS_VDI_PORT_NUM_RECEIVE_BUFFS; i++) {
- VDIReadBuf *buf = spice_new0(VDIReadBuf, 1);
+ RedVDIReadBuf *buf = spice_new0(RedVDIReadBuf, 1);
vdi_read_buf_init(buf);
buf->dev = self;
g_warn_if_fail(!self->priv->agent_attached);
@@ -4314,7 +4315,7 @@ red_char_device_vdi_port_finalize(GObject *object)
RedCharDeviceVDIPort *dev = RED_CHAR_DEVICE_VDIPORT(object);
free(dev->priv->mig_data);
- /* FIXME: need to free the VDIReadBuf allocated previously */
+ /* FIXME: need to free the RedVDIReadBuf allocated previously */
}
static void
diff --git a/server/smartcard.c b/server/smartcard.c
index 75c5dd2..a42bcd8 100644
--- a/server/smartcard.c
+++ b/server/smartcard.c
@@ -77,24 +77,24 @@ struct RedCharDeviceSmartcardPrivate {
};
enum {
- PIPE_ITEM_TYPE_ERROR = PIPE_ITEM_TYPE_CHANNEL_BASE,
- PIPE_ITEM_TYPE_SMARTCARD_DATA,
- PIPE_ITEM_TYPE_SMARTCARD_MIGRATE_DATA,
+ RED_PIPE_ITEM_TYPE_ERROR = RED_PIPE_ITEM_TYPE_CHANNEL_BASE,
+ RED_PIPE_ITEM_TYPE_SMARTCARD_DATA,
+ RED_PIPE_ITEM_TYPE_SMARTCARD_MIGRATE_DATA,
};
-typedef struct ErrorItem {
+typedef struct RedErrorItem {
RedPipeItem base;
VSCMsgHeader vheader;
VSCMsgError error;
-} ErrorItem;
+} RedErrorItem;
-typedef struct MsgItem {
+typedef struct RedMsgItem {
RedPipeItem base;
VSCMsgHeader* vheader;
-} MsgItem;
+} RedMsgItem;
-static MsgItem *smartcard_get_vsc_msg_item(RedChannelClient *rcc, VSCMsgHeader *vheader);
+static RedMsgItem *smartcard_get_vsc_msg_item(RedChannelClient *rcc, VSCMsgHeader *vheader);
static void smartcard_channel_client_pipe_add_push(RedChannelClient *rcc, RedPipeItem *item);
typedef struct SmartCardChannel {
@@ -113,7 +113,7 @@ static void smartcard_char_device_attach_client(
SpiceCharDeviceInstance *char_device, SmartCardChannelClient *scc);
static void smartcard_channel_write_to_reader(RedCharDeviceWriteBuffer *write_buf);
-static MsgItem *smartcard_char_device_on_message_from_device(
+static RedMsgItem *smartcard_char_device_on_message_from_device(
RedCharDeviceSmartcard *dev, VSCMsgHeader *header);
static RedCharDeviceSmartcard *smartcard_device_new(RedsState *reds, SpiceCharDeviceInstance *sin);
static void smartcard_init(RedsState *reds);
@@ -140,7 +140,7 @@ static RedPipeItem *smartcard_read_msg_from_device(SpiceCharDeviceInstance *sin,
int actual_length;
while ((n = sif->read(sin, dev->priv->buf_pos, dev->priv->buf_size - dev->priv->buf_used)) > 0) {
- MsgItem *msg_to_client;
+ RedMsgItem *msg_to_client;
dev->priv->buf_pos += n;
dev->priv->buf_used += n;
@@ -190,8 +190,8 @@ static void smartcard_remove_client(RedClient *client, void *opaque)
red_channel_client_shutdown(&dev->priv->scc->base);
}
-MsgItem *smartcard_char_device_on_message_from_device(RedCharDeviceSmartcard *dev,
- VSCMsgHeader *vheader)
+RedMsgItem *smartcard_char_device_on_message_from_device(RedCharDeviceSmartcard *dev,
+ VSCMsgHeader *vheader)
{
VSCMsgHeader *sent_header;
@@ -441,7 +441,7 @@ static void smartcard_channel_send_data(RedChannelClient *rcc, SpiceMarshaller *
static void smartcard_channel_send_error(
RedChannelClient *rcc, SpiceMarshaller *m, RedPipeItem *item)
{
- ErrorItem* error_item = (ErrorItem*)item;
+ RedErrorItem* error_item = (RedErrorItem*)item;
smartcard_channel_send_data(rcc, m, item, &error_item->vheader);
}
@@ -449,7 +449,7 @@ static void smartcard_channel_send_error(
static void smartcard_channel_send_msg(RedChannelClient *rcc,
SpiceMarshaller *m, RedPipeItem *item)
{
- MsgItem* msg_item = (MsgItem*)item;
+ RedMsgItem* msg_item = (RedMsgItem*)item;
smartcard_channel_send_data(rcc, m, item, msg_item->vheader);
}
@@ -488,13 +488,13 @@ static void smartcard_channel_send_item(RedChannelClient *rcc, RedPipeItem *item
SpiceMarshaller *m = red_channel_client_get_marshaller(rcc);
switch (item->type) {
- case PIPE_ITEM_TYPE_ERROR:
+ case RED_PIPE_ITEM_TYPE_ERROR:
smartcard_channel_send_error(rcc, m, item);
break;
- case PIPE_ITEM_TYPE_SMARTCARD_DATA:
+ case RED_PIPE_ITEM_TYPE_SMARTCARD_DATA:
smartcard_channel_send_msg(rcc, m, item);
break;
- case PIPE_ITEM_TYPE_SMARTCARD_MIGRATE_DATA:
+ case RED_PIPE_ITEM_TYPE_SMARTCARD_MIGRATE_DATA:
smartcard_channel_send_migrate_data(rcc, m, item);
break;
default:
@@ -508,7 +508,7 @@ static void smartcard_channel_send_item(RedChannelClient *rcc, RedPipeItem *item
static void smartcard_channel_release_pipe_item(RedChannelClient *rcc,
RedPipeItem *item, int item_pushed)
{
- if (item->type == PIPE_ITEM_TYPE_SMARTCARD_DATA) {
+ if (item->type == RED_PIPE_ITEM_TYPE_SMARTCARD_DATA) {
red_pipe_item_unref(item);
} else {
free(item);
@@ -538,11 +538,11 @@ static void smartcard_channel_client_pipe_add_push(RedChannelClient *rcc,
static void smartcard_push_error(RedChannelClient *rcc, uint32_t reader_id, VSCErrorCode error)
{
- ErrorItem *error_item = spice_new0(ErrorItem, 1);
+ RedErrorItem *error_item = spice_new0(RedErrorItem, 1);
- red_pipe_item_init(&error_item->base, PIPE_ITEM_TYPE_ERROR);
+ red_pipe_item_init(&error_item->base, RED_PIPE_ITEM_TYPE_ERROR);
- error_item->base.type = PIPE_ITEM_TYPE_ERROR;
+ error_item->base.type = RED_PIPE_ITEM_TYPE_ERROR;
error_item->vheader.reader_id = reader_id;
error_item->vheader.type = VSC_Error;
error_item->vheader.length = sizeof(error_item->error);
@@ -550,17 +550,18 @@ static void smartcard_push_error(RedChannelClient *rcc, uint32_t reader_id, VSCE
smartcard_channel_client_pipe_add_push(rcc, &error_item->base);
}
-static void smartcard_free_vsc_msg_item(MsgItem *item)
+static void smartcard_free_vsc_msg_item(RedMsgItem *item)
{
free(item->vheader);
free(item);
}
-static MsgItem *smartcard_get_vsc_msg_item(RedChannelClient *rcc, VSCMsgHeader *vheader)
+static RedMsgItem *smartcard_get_vsc_msg_item(RedChannelClient *rcc,
+ VSCMsgHeader *vheader)
{
- MsgItem *msg_item = spice_new0(MsgItem, 1);
+ RedMsgItem *msg_item = spice_new0(RedMsgItem, 1);
- red_pipe_item_init_full(&msg_item->base, PIPE_ITEM_TYPE_SMARTCARD_DATA,
+ red_pipe_item_init_full(&msg_item->base, RED_PIPE_ITEM_TYPE_SMARTCARD_DATA,
(GDestroyNotify)smartcard_free_vsc_msg_item);
msg_item->vheader = vheader;
return msg_item;
@@ -635,7 +636,7 @@ static void smartcard_channel_write_to_reader(RedCharDeviceWriteBuffer *write_bu
static int smartcard_channel_client_handle_migrate_flush_mark(RedChannelClient *rcc)
{
- red_channel_client_pipe_add_type(rcc, PIPE_ITEM_TYPE_SMARTCARD_MIGRATE_DATA);
+ red_channel_client_pipe_add_type(rcc, RED_PIPE_ITEM_TYPE_SMARTCARD_MIGRATE_DATA);
return TRUE;
}
diff --git a/server/spicevmc.c b/server/spicevmc.c
index 8450f19..dffdd9a 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -42,20 +42,20 @@
/* 64K should be enough for all but the largest writes + 32 bytes hdr */
#define BUF_SIZE (64 * 1024 + 32)
-typedef struct SpiceVmcPipeItem {
+typedef struct RedVmcPipeItem {
RedPipeItem base;
/* writes which don't fit this will get split, this is not a problem */
uint8_t buf[BUF_SIZE];
uint32_t buf_used;
-} SpiceVmcPipeItem;
+} RedVmcPipeItem;
typedef struct SpiceVmcState {
RedChannel channel; /* Must be the first item */
RedChannelClient *rcc;
RedCharDevice *chardev;
SpiceCharDeviceInstance *chardev_sin;
- SpiceVmcPipeItem *pipe_item;
+ RedVmcPipeItem *pipe_item;
RedCharDeviceWriteBuffer *recv_from_client_buf;
uint8_t port_opened;
} SpiceVmcState;
@@ -87,22 +87,22 @@ static RedCharDevice *red_char_device_spicevmc_new(SpiceCharDeviceInstance *sin,
G_DEFINE_TYPE(RedCharDeviceSpiceVmc, red_char_device_spicevmc, RED_TYPE_CHAR_DEVICE)
-typedef struct PortInitPipeItem {
+typedef struct RedPortInitPipeItem {
RedPipeItem base;
char* name;
uint8_t opened;
-} PortInitPipeItem;
+} RedPortInitPipeItem;
-typedef struct PortEventPipeItem {
+typedef struct RedPortEventPipeItem {
RedPipeItem base;
uint8_t event;
-} PortEventPipeItem;
+} RedPortEventPipeItem;
enum {
- PIPE_ITEM_TYPE_SPICEVMC_DATA = PIPE_ITEM_TYPE_CHANNEL_BASE,
- PIPE_ITEM_TYPE_SPICEVMC_MIGRATE_DATA,
- PIPE_ITEM_TYPE_PORT_INIT,
- PIPE_ITEM_TYPE_PORT_EVENT,
+ RED_PIPE_ITEM_TYPE_SPICEVMC_DATA = RED_PIPE_ITEM_TYPE_CHANNEL_BASE,
+ RED_PIPE_ITEM_TYPE_SPICEVMC_MIGRATE_DATA,
+ RED_PIPE_ITEM_TYPE_PORT_INIT,
+ RED_PIPE_ITEM_TYPE_PORT_EVENT,
};
static RedPipeItem *spicevmc_chardev_read_msg_from_dev(SpiceCharDeviceInstance *sin,
@@ -110,7 +110,7 @@ static RedPipeItem *spicevmc_chardev_read_msg_from_dev(SpiceCharDeviceInstance *
{
SpiceVmcState *state = opaque;
SpiceCharDeviceInterface *sif;
- SpiceVmcPipeItem *msg_item;
+ RedVmcPipeItem *msg_item;
int n;
sif = spice_char_device_get_interface(sin);
@@ -120,8 +120,8 @@ static RedPipeItem *spicevmc_chardev_read_msg_from_dev(SpiceCharDeviceInstance *
}
if (!state->pipe_item) {
- msg_item = spice_new0(SpiceVmcPipeItem, 1);
- red_pipe_item_init(&msg_item->base, PIPE_ITEM_TYPE_SPICEVMC_DATA);
+ msg_item = spice_new0(RedVmcPipeItem, 1);
+ red_pipe_item_init(&msg_item->base, RED_PIPE_ITEM_TYPE_SPICEVMC_DATA);
} else {
spice_assert(state->pipe_item->buf_used == 0);
msg_item = state->pipe_item;
@@ -145,7 +145,7 @@ static void spicevmc_chardev_send_msg_to_client(RedPipeItem *msg,
void *opaque)
{
SpiceVmcState *state = opaque;
- SpiceVmcPipeItem *vmc_msg = (SpiceVmcPipeItem *)msg;
+ RedVmcPipeItem *vmc_msg = (RedVmcPipeItem *)msg;
spice_assert(state->rcc->client == client);
red_pipe_item_ref(vmc_msg);
@@ -156,9 +156,9 @@ static void spicevmc_port_send_init(RedChannelClient *rcc)
{
SpiceVmcState *state = SPICE_CONTAINEROF(rcc->channel, SpiceVmcState, channel);
SpiceCharDeviceInstance *sin = state->chardev_sin;
- PortInitPipeItem *item = spice_malloc(sizeof(PortInitPipeItem));
+ RedPortInitPipeItem *item = spice_malloc(sizeof(RedPortInitPipeItem));
- red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_PORT_INIT);
+ red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_PORT_INIT);
item->name = strdup(sin->portname);
item->opened = state->port_opened;
red_channel_client_pipe_add_push(rcc, &item->base);
@@ -166,9 +166,9 @@ static void spicevmc_port_send_init(RedChannelClient *rcc)
static void spicevmc_port_send_event(RedChannelClient *rcc, uint8_t event)
{
- PortEventPipeItem *item = spice_malloc(sizeof(PortEventPipeItem));
+ RedPortEventPipeItem *item = spice_malloc(sizeof(RedPortEventPipeItem));
- red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_PORT_EVENT);
+ red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_PORT_EVENT);
item->event = event;
red_channel_client_pipe_add_push(rcc, &item->base);
}
@@ -252,7 +252,7 @@ static SpiceVmcState *spicevmc_red_channel_client_get_state(RedChannelClient *rc
static int spicevmc_channel_client_handle_migrate_flush_mark(RedChannelClient *rcc)
{
- red_channel_client_pipe_add_type(rcc, PIPE_ITEM_TYPE_SPICEVMC_MIGRATE_DATA);
+ red_channel_client_pipe_add_type(rcc, RED_PIPE_ITEM_TYPE_SPICEVMC_MIGRATE_DATA);
return TRUE;
}
@@ -369,7 +369,7 @@ static void spicevmc_red_channel_send_data(RedChannelClient *rcc,
SpiceMarshaller *m,
RedPipeItem *item)
{
- SpiceVmcPipeItem *i = SPICE_CONTAINEROF(item, SpiceVmcPipeItem, base);
+ RedVmcPipeItem *i = SPICE_CONTAINEROF(item, RedVmcPipeItem, base);
red_channel_client_init_send_data(rcc, SPICE_MSG_SPICEVMC_DATA, item);
spice_marshaller_add_ref(m, i->buf, i->buf_used);
@@ -393,7 +393,7 @@ static void spicevmc_red_channel_send_port_init(RedChannelClient *rcc,
SpiceMarshaller *m,
RedPipeItem *item)
{
- PortInitPipeItem *i = SPICE_CONTAINEROF(item, PortInitPipeItem, base);
+ RedPortInitPipeItem *i = SPICE_CONTAINEROF(item, RedPortInitPipeItem, base);
SpiceMsgPortInit init;
red_channel_client_init_send_data(rcc, SPICE_MSG_PORT_INIT, item);
@@ -407,7 +407,7 @@ static void spicevmc_red_channel_send_port_event(RedChannelClient *rcc,
SpiceMarshaller *m,
RedPipeItem *item)
{
- PortEventPipeItem *i = SPICE_CONTAINEROF(item, PortEventPipeItem, base);
+ RedPortEventPipeItem *i = SPICE_CONTAINEROF(item, RedPortEventPipeItem, base);
SpiceMsgPortEvent event;
red_channel_client_init_send_data(rcc, SPICE_MSG_PORT_EVENT, item);
@@ -421,16 +421,16 @@ static void spicevmc_red_channel_send_item(RedChannelClient *rcc,
SpiceMarshaller *m = red_channel_client_get_marshaller(rcc);
switch (item->type) {
- case PIPE_ITEM_TYPE_SPICEVMC_DATA:
+ case RED_PIPE_ITEM_TYPE_SPICEVMC_DATA:
spicevmc_red_channel_send_data(rcc, m, item);
break;
- case PIPE_ITEM_TYPE_SPICEVMC_MIGRATE_DATA:
+ case RED_PIPE_ITEM_TYPE_SPICEVMC_MIGRATE_DATA:
spicevmc_red_channel_send_migrate_data(rcc, m, item);
break;
- case PIPE_ITEM_TYPE_PORT_INIT:
+ case RED_PIPE_ITEM_TYPE_PORT_INIT:
spicevmc_red_channel_send_port_init(rcc, m, item);
break;
- case PIPE_ITEM_TYPE_PORT_EVENT:
+ case RED_PIPE_ITEM_TYPE_PORT_EVENT:
spicevmc_red_channel_send_port_event(rcc, m, item);
break;
default:
@@ -445,7 +445,7 @@ static void spicevmc_red_channel_release_pipe_item(RedChannelClient *rcc,
RedPipeItem *item,
int item_pushed)
{
- if (item->type == PIPE_ITEM_TYPE_SPICEVMC_DATA) {
+ if (item->type == RED_PIPE_ITEM_TYPE_SPICEVMC_DATA) {
red_pipe_item_unref(item);
} else {
free(item);
diff --git a/server/stream.c b/server/stream.c
index daf9cc8..e8d60b5 100644
--- a/server/stream.c
+++ b/server/stream.c
@@ -133,7 +133,7 @@ void stream_agent_unref(DisplayChannel *display, StreamAgent *agent)
stream_unref(display, agent->stream);
}
-void stream_clip_item_free(StreamClipItem *item)
+void red_stream_clip_item_free(RedStreamClipItem *item)
{
g_return_if_fail(item != NULL);
DisplayChannel *display = DCC_TO_DC(item->stream_agent->dcc);
@@ -145,11 +145,11 @@ void stream_clip_item_free(StreamClipItem *item)
free(item);
}
-StreamClipItem *stream_clip_item_new(StreamAgent *agent)
+RedStreamClipItem *red_stream_clip_item_new(StreamAgent *agent)
{
- StreamClipItem *item = spice_new(StreamClipItem, 1);
- red_pipe_item_init_full((RedPipeItem *)item, PIPE_ITEM_TYPE_STREAM_CLIP,
- (GDestroyNotify)stream_clip_item_free);
+ RedStreamClipItem *item = spice_new(RedStreamClipItem, 1);
+ red_pipe_item_init_full((RedPipeItem *)item, RED_PIPE_ITEM_TYPE_STREAM_CLIP,
+ (GDestroyNotify)red_stream_clip_item_free);
item->stream_agent = agent;
agent->stream->refs++;
@@ -316,7 +316,7 @@ void detach_stream(DisplayChannel *display, Stream *stream,
static void before_reattach_stream(DisplayChannel *display,
Stream *stream, Drawable *new_frame)
{
- DrawablePipeItem *dpi;
+ RedDrawablePipeItem *dpi;
DisplayChannelClient *dcc;
int index;
StreamAgent *agent;
@@ -731,11 +731,11 @@ void dcc_create_stream(DisplayChannelClient *dcc, Stream *stream)
red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), &agent->create_item);
if (red_channel_client_test_remote_cap(RED_CHANNEL_CLIENT(dcc), SPICE_DISPLAY_CAP_STREAM_REPORT)) {
- StreamActivateReportItem *report_pipe_item = spice_malloc0(sizeof(*report_pipe_item));
+ RedStreamActivateReportItem *report_pipe_item = spice_malloc0(sizeof(*report_pipe_item));
agent->report_id = rand();
red_pipe_item_init(&report_pipe_item->pipe_item,
- PIPE_ITEM_TYPE_STREAM_ACTIVATE_REPORT);
+ RED_PIPE_ITEM_TYPE_STREAM_ACTIVATE_REPORT);
report_pipe_item->stream_id = get_stream_id(DCC_TO_DC(dcc), stream);
red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), &report_pipe_item->pipe_item);
}
@@ -758,7 +758,7 @@ void stream_agent_stop(StreamAgent *agent)
}
}
-static void upgrade_item_free(UpgradeItem *item)
+static void red_upgrade_item_free(RedUpgradeItem *item)
{
g_return_if_fail(item != NULL);
DisplayChannel *display = DCC_TO_DC(item->dcc);
@@ -794,7 +794,7 @@ static void dcc_detach_stream_gracefully(DisplayChannelClient *dcc,
if (stream->current &&
region_contains(&stream->current->tree_item.base.rgn, &agent->vis_region)) {
RedChannelClient *rcc;
- UpgradeItem *upgrade_item;
+ RedUpgradeItem *upgrade_item;
int n_rects;
/* (1) The caller should detach the drawable from the stream. This will
@@ -809,9 +809,9 @@ static void dcc_detach_stream_gracefully(DisplayChannelClient *dcc,
stream_id, stream->current->sized_stream != NULL);
rect_debug(&stream->current->red_drawable->bbox);
rcc = RED_CHANNEL_CLIENT(dcc);
- upgrade_item = spice_new(UpgradeItem, 1);
- red_pipe_item_init_full(&upgrade_item->base, PIPE_ITEM_TYPE_UPGRADE,
- (GDestroyNotify)upgrade_item_free);
+ upgrade_item = spice_new(RedUpgradeItem, 1);
+ red_pipe_item_init_full(&upgrade_item->base, RED_PIPE_ITEM_TYPE_UPGRADE,
+ (GDestroyNotify)red_upgrade_item_free);
upgrade_item->drawable = stream->current;
upgrade_item->drawable->refs++;
upgrade_item->dcc = dcc;
diff --git a/server/stream.h b/server/stream.h
index 5b59212..bff7ca7 100644
--- a/server/stream.h
+++ b/server/stream.h
@@ -46,10 +46,10 @@ typedef struct DisplayChannel DisplayChannel;
typedef struct Stream Stream;
-typedef struct StreamActivateReportItem {
+typedef struct RedStreamActivateReportItem {
RedPipeItem pipe_item;
uint32_t stream_id;
-} StreamActivateReportItem;
+} RedStreamActivateReportItem;
enum {
STREAM_FRAME_NONE,
@@ -99,14 +99,14 @@ typedef struct StreamAgent {
#endif
} StreamAgent;
-typedef struct StreamClipItem {
+typedef struct RedStreamClipItem {
RedPipeItem base;
StreamAgent *stream_agent;
int clip_type;
SpiceClipRects *rects;
-} StreamClipItem;
+} RedStreamClipItem;
-StreamClipItem * stream_clip_item_new (StreamAgent *agent);
+RedStreamClipItem * red_stream_clip_item_new (StreamAgent *agent);
typedef struct ItemTrace {
red_time_t time;
--
2.4.11
More information about the Spice-devel
mailing list