[Spice-devel] [PATCH 19/20] Rename PipeItem to RedPipeItem
Jonathon Jongsma
jjongsma at redhat.com
Thu Apr 14 21:50:21 UTC 2016
Following internal type naming conventions
---
server/cache-item.h | 2 +-
server/cache-item.tmpl.c | 2 +-
server/char-device.c | 18 ++++-----
server/char-device.h | 6 +--
server/cursor-channel.c | 22 +++++------
server/dcc-send.c | 22 +++++------
server/dcc.c | 58 ++++++++++++++---------------
server/dcc.h | 22 +++++------
server/display-channel.c | 10 ++---
server/display-channel.h | 8 ++--
server/inputs-channel.c | 20 +++++-----
server/main-channel.c | 97 ++++++++++++++++++++++++------------------------
server/red-channel.c | 55 +++++++++++++--------------
server/red-channel.h | 30 +++++++--------
server/red-pipe-item.c | 14 +++----
server/red-pipe-item.h | 14 +++----
server/red-worker.h | 4 +-
server/reds.c | 26 ++++++-------
server/smartcard.c | 42 +++++++++++----------
server/spicevmc.c | 41 ++++++++++----------
server/stream.c | 16 ++++----
server/stream.h | 8 ++--
22 files changed, 271 insertions(+), 266 deletions(-)
diff --git a/server/cache-item.h b/server/cache-item.h
index 7dfb1af..90c82d3 100644
--- a/server/cache-item.h
+++ b/server/cache-item.h
@@ -25,7 +25,7 @@ typedef struct CacheItem CacheItem;
struct CacheItem {
union {
- PipeItem pipe_data;
+ RedPipeItem pipe_data;
struct {
RingItem lru_link;
CacheItem *next;
diff --git a/server/cache-item.tmpl.c b/server/cache-item.tmpl.c
index 23b0bc1..d63e576 100644
--- a/server/cache-item.tmpl.c
+++ b/server/cache-item.tmpl.c
@@ -81,7 +81,7 @@ static void FUNC_NAME(remove)(CHANNELCLIENT *channel_client, CacheItem *item)
channel_client->VAR_NAME(items)--;
channel_client->VAR_NAME(available) += item->size;
- pipe_item_init(&item->u.pipe_data, PIPE_ITEM_TYPE_INVAL_ONE);
+ red_pipe_item_init(&item->u.pipe_data, PIPE_ITEM_TYPE_INVAL_ONE);
red_channel_client_pipe_add_tail_and_push(&channel_client->common.base, &item->u.pipe_data); // for now
}
diff --git a/server/char-device.c b/server/char-device.c
index fb40128..fbd9302 100644
--- a/server/char-device.c
+++ b/server/char-device.c
@@ -104,7 +104,7 @@ static guint signals[RED_CHAR_DEVICE_LAST_SIGNAL];
static void red_char_device_write_buffer_unref(RedCharDeviceWriteBuffer *write_buf);
static void red_char_device_write_retry(void *opaque);
-static PipeItem *
+static RedPipeItem *
red_char_device_read_one_msg_from_device(RedCharDevice *dev)
{
RedCharDeviceClass *klass = RED_CHAR_DEVICE_GET_CLASS(dev);
@@ -114,7 +114,7 @@ red_char_device_read_one_msg_from_device(RedCharDevice *dev)
static void
red_char_device_send_msg_to_client(RedCharDevice *dev,
- PipeItem *msg,
+ RedPipeItem *msg,
RedClient *client)
{
RedCharDeviceClass *klass = RED_CHAR_DEVICE_GET_CLASS(dev);
@@ -182,7 +182,7 @@ static void red_char_device_client_send_queue_free(RedCharDevice *dev,
RedCharDeviceClient *dev_client)
{
spice_debug("send_queue_empty %d", g_queue_is_empty(dev_client->send_queue));
- g_queue_free_full(dev_client->send_queue, pipe_item_unref);
+ g_queue_free_full(dev_client->send_queue, red_pipe_item_unref);
g_queue_clear(dev_client->send_queue);
dev_client->num_send_tokens += g_queue_get_length(dev_client->send_queue);
}
@@ -285,7 +285,7 @@ static uint64_t red_char_device_max_send_tokens(RedCharDevice *dev)
}
static void red_char_device_add_msg_to_client_queue(RedCharDeviceClient *dev_client,
- PipeItem *msg)
+ RedPipeItem *msg)
{
RedCharDevice *dev = dev_client->dev;
@@ -294,7 +294,7 @@ static void red_char_device_add_msg_to_client_queue(RedCharDeviceClient *dev_cli
return;
}
- pipe_item_ref(msg);
+ red_pipe_item_ref(msg);
g_queue_push_head(dev_client->send_queue, msg);
if (!dev_client->wait_for_tokens_started) {
reds_core_timer_start(dev->priv->reds, dev_client->wait_for_tokens_timer,
@@ -304,7 +304,7 @@ static void red_char_device_add_msg_to_client_queue(RedCharDeviceClient *dev_cli
}
static void red_char_device_send_msg_to_clients(RedCharDevice *dev,
- PipeItem *msg)
+ RedPipeItem *msg)
{
RingItem *item, *next;
@@ -350,7 +350,7 @@ static int red_char_device_read_from_device(RedCharDevice *dev)
* All messages will be discarded if no client is attached to the device
*/
while ((max_send_tokens || ring_is_empty(&dev->priv->clients)) && dev->priv->running) {
- PipeItem *msg;
+ RedPipeItem *msg;
msg = red_char_device_read_one_msg_from_device(dev);
if (!msg) {
@@ -363,7 +363,7 @@ static int red_char_device_read_from_device(RedCharDevice *dev)
}
did_read = TRUE;
red_char_device_send_msg_to_clients(dev, msg);
- pipe_item_unref(msg);
+ red_pipe_item_unref(msg);
max_send_tokens--;
}
dev->priv->during_read_from_device = 0;
@@ -386,7 +386,7 @@ static void red_char_device_client_send_queue_push(RedCharDeviceClient *dev_clie
dev_client->num_send_tokens--;
red_char_device_send_msg_to_client(dev_client->dev, msg->data,
dev_client->client);
- pipe_item_unref(msg);
+ red_pipe_item_unref(msg);
}
}
diff --git a/server/char-device.h b/server/char-device.h
index c18ce66..75ec344 100644
--- a/server/char-device.h
+++ b/server/char-device.h
@@ -56,10 +56,10 @@ struct RedCharDeviceClass
/* reads from the device till reaching a msg that should be sent to the client,
* or till the reading fails */
- PipeItem* (*read_one_msg_from_device)(SpiceCharDeviceInstance *sin,
- void *opaque);
+ RedPipeItem* (*read_one_msg_from_device)(SpiceCharDeviceInstance *sin,
+ void *opaque);
/* after this call, the message is unreferenced */
- void (*send_msg_to_client)(PipeItem *msg,
+ void (*send_msg_to_client)(RedPipeItem *msg,
RedClient *client,
void *opaque);
diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index 7d5ac6a..e2bb706 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -46,7 +46,7 @@ typedef struct CursorItem {
G_STATIC_ASSERT(sizeof(CursorItem) <= QXL_CURSUR_DEVICE_DATA_SIZE);
typedef struct CursorPipeItem {
- PipeItem base;
+ RedPipeItem base;
CursorItem *cursor_item;
int refs;
} CursorPipeItem;
@@ -132,11 +132,11 @@ static void cursor_set_item(CursorChannel *cursor, CursorItem *item)
cursor->item = item ? cursor_item_ref(item) : NULL;
}
-static PipeItem *new_cursor_pipe_item(RedChannelClient *rcc, void *data, int num)
+static RedPipeItem *new_cursor_pipe_item(RedChannelClient *rcc, void *data, int num)
{
CursorPipeItem *item = spice_malloc0(sizeof(CursorPipeItem));
- pipe_item_init(&item->base, PIPE_ITEM_TYPE_CURSOR);
+ red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_CURSOR);
item->refs = 1;
item->cursor_item = data;
item->cursor_item->refs++;
@@ -212,7 +212,7 @@ static void put_cursor_pipe_item(CursorChannelClient *ccc, CursorPipeItem *pipe_
return;
}
- spice_assert(!pipe_item_is_linked(&pipe_item->base));
+ spice_assert(!red_pipe_item_is_linked(&pipe_item->base));
cursor_item_unref(pipe_item->cursor_item);
free(pipe_item);
@@ -229,7 +229,7 @@ static void cursor_channel_client_on_disconnect(RedChannelClient *rcc)
// TODO: share code between before/after_push since most of the items need the same
// release
static void cursor_channel_client_release_item_before_push(CursorChannelClient *ccc,
- PipeItem *item)
+ RedPipeItem *item)
{
switch (item->type) {
case PIPE_ITEM_TYPE_CURSOR: {
@@ -249,7 +249,7 @@ static void cursor_channel_client_release_item_before_push(CursorChannelClient *
}
static void cursor_channel_client_release_item_after_push(CursorChannelClient *ccc,
- PipeItem *item)
+ RedPipeItem *item)
{
switch (item->type) {
case PIPE_ITEM_TYPE_CURSOR: {
@@ -263,7 +263,7 @@ static void cursor_channel_client_release_item_after_push(CursorChannelClient *c
}
static void red_marshall_cursor_init(RedChannelClient *rcc, SpiceMarshaller *base_marshaller,
- PipeItem *pipe_item)
+ RedPipeItem *pipe_item)
{
CursorChannel *cursor_channel;
CursorChannelClient *ccc = RCC_TO_CCC(rcc);
@@ -290,7 +290,7 @@ static void cursor_marshall(RedChannelClient *rcc,
CursorChannel *cursor_channel = SPICE_CONTAINEROF(rcc->channel, CursorChannel, common.base);
CursorChannelClient *ccc = RCC_TO_CCC(rcc);
CursorItem *item = cursor_pipe_item->cursor_item;
- PipeItem *pipe_item = &cursor_pipe_item->base;
+ RedPipeItem *pipe_item = &cursor_pipe_item->base;
RedCursorCmd *cmd;
spice_return_if_fail(cursor_channel);
@@ -348,7 +348,7 @@ static inline void red_marshall_inval(RedChannelClient *rcc,
spice_marshall_msg_cursor_inval_one(base_marshaller, &inval_one);
}
-static void cursor_channel_send_item(RedChannelClient *rcc, PipeItem *pipe_item)
+static void cursor_channel_send_item(RedChannelClient *rcc, RedPipeItem *pipe_item)
{
SpiceMarshaller *m = red_channel_client_get_marshaller(rcc);
CursorChannelClient *ccc = RCC_TO_CCC(rcc);
@@ -389,7 +389,7 @@ static CursorPipeItem *cursor_pipe_item_ref(CursorPipeItem *item)
}
-static void cursor_channel_hold_pipe_item(RedChannelClient *rcc, PipeItem *item)
+static void cursor_channel_hold_pipe_item(RedChannelClient *rcc, RedPipeItem *item)
{
CursorPipeItem *cursor_pipe_item;
@@ -399,7 +399,7 @@ static void cursor_channel_hold_pipe_item(RedChannelClient *rcc, PipeItem *item)
cursor_pipe_item_ref(cursor_pipe_item);
}
-static void cursor_channel_release_item(RedChannelClient *rcc, PipeItem *item, int item_pushed)
+static void cursor_channel_release_item(RedChannelClient *rcc, RedPipeItem *item, int item_pushed)
{
CursorChannelClient *ccc = RCC_TO_CCC(rcc);
diff --git a/server/dcc-send.c b/server/dcc-send.c
index b8d1157..799d5df 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -186,9 +186,9 @@ static int is_brush_lossy(RedChannelClient *rcc, SpiceBrush *brush,
}
}
-static PipeItem *dcc_get_tail(DisplayChannelClient *dcc)
+static RedPipeItem *dcc_get_tail(DisplayChannelClient *dcc)
{
- return (PipeItem*)ring_get_tail(&RED_CHANNEL_CLIENT(dcc)->pipe);
+ return (RedPipeItem*)ring_get_tail(&RED_CHANNEL_CLIENT(dcc)->pipe);
}
static void red_display_add_image_to_pixmap_cache(RedChannelClient *rcc,
@@ -596,15 +596,15 @@ static int pipe_rendered_drawables_intersect_with_areas(DisplayChannelClient *dc
SpiceRect *surface_areas[],
int num_surfaces)
{
- PipeItem *pipe_item;
+ RedPipeItem *pipe_item;
Ring *pipe;
spice_assert(num_surfaces);
pipe = &RED_CHANNEL_CLIENT(dcc)->pipe;
- for (pipe_item = (PipeItem *)ring_get_head(pipe);
+ for (pipe_item = (RedPipeItem *)ring_get_head(pipe);
pipe_item;
- pipe_item = (PipeItem *)ring_next(pipe, &pipe_item->link))
+ pipe_item = (RedPipeItem *)ring_next(pipe, &pipe_item->link))
{
Drawable *drawable;
@@ -685,7 +685,7 @@ static void red_pipe_replace_rendered_drawables_with_images(DisplayChannelClient
int resent_surface_ids[MAX_PIPE_SIZE];
SpiceRect resent_areas[MAX_PIPE_SIZE]; // not pointers since drawables may be released
int num_resent;
- PipeItem *pipe_item;
+ RedPipeItem *pipe_item;
Ring *pipe;
resent_surface_ids[0] = first_surface_id;
@@ -695,9 +695,9 @@ static void red_pipe_replace_rendered_drawables_with_images(DisplayChannelClient
pipe = &RED_CHANNEL_CLIENT(dcc)->pipe;
// going from the oldest to the newest
- for (pipe_item = (PipeItem *)ring_get_tail(pipe);
+ for (pipe_item = (RedPipeItem *)ring_get_tail(pipe);
pipe_item;
- pipe_item = (PipeItem *)ring_prev(pipe, &pipe_item->link)) {
+ pipe_item = (RedPipeItem *)ring_prev(pipe, &pipe_item->link)) {
Drawable *drawable;
DrawablePipeItem *dpi;
ImageItem *image;
@@ -2301,7 +2301,7 @@ static void marshall_stream_activate_report(RedChannelClient *rcc,
static void marshall_gl_scanout(RedChannelClient *rcc,
SpiceMarshaller *m,
- PipeItem *item)
+ RedPipeItem *item)
{
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
DisplayChannel *display_channel = DCC_TO_DC(dcc);
@@ -2317,7 +2317,7 @@ static void marshall_gl_scanout(RedChannelClient *rcc,
static void marshall_gl_draw(RedChannelClient *rcc,
SpiceMarshaller *m,
- PipeItem *item)
+ RedPipeItem *item)
{
GlDrawItem *p = SPICE_CONTAINEROF(item, GlDrawItem, base);
@@ -2360,7 +2360,7 @@ static void reset_send_data(DisplayChannelClient *dcc)
memset(dcc->send_data.free_list.sync, 0, sizeof(dcc->send_data.free_list.sync));
}
-void dcc_send_item(DisplayChannelClient *dcc, PipeItem *pipe_item)
+void dcc_send_item(DisplayChannelClient *dcc, RedPipeItem *pipe_item)
{
RedChannelClient *rcc = RED_CHANNEL_CLIENT(dcc);
SpiceMarshaller *m = red_channel_client_get_marshaller(rcc);
diff --git a/server/dcc.c b/server/dcc.c
index 1cd9f1a..5b45096 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -38,7 +38,7 @@ static SurfaceCreateItem *surface_create_item_new(RedChannel* channel,
create->surface_create.flags = flags;
create->surface_create.format = format;
- pipe_item_init(&create->pipe_item, PIPE_ITEM_TYPE_CREATE_SURFACE);
+ red_pipe_item_init(&create->pipe_item, PIPE_ITEM_TYPE_CREATE_SURFACE);
return create;
}
@@ -64,7 +64,7 @@ int dcc_clear_surface_drawables_from_pipe(DisplayChannelClient *dcc, int surface
int wait_if_used)
{
Ring *ring;
- PipeItem *item;
+ RedPipeItem *item;
int x;
RedChannelClient *rcc;
@@ -74,8 +74,8 @@ int dcc_clear_surface_drawables_from_pipe(DisplayChannelClient *dcc, int surface
rcc = RED_CHANNEL_CLIENT(dcc);
ring = &rcc->pipe;
- item = (PipeItem *) ring;
- while ((item = (PipeItem *)ring_next(ring, (RingItem *)item))) {
+ item = (RedPipeItem *) ring;
+ while ((item = (RedPipeItem *)ring_next(ring, (RingItem *)item))) {
Drawable *drawable;
DrawablePipeItem *dpi = NULL;
int depend_found = FALSE;
@@ -90,11 +90,11 @@ int dcc_clear_surface_drawables_from_pipe(DisplayChannelClient *dcc, int surface
}
if (drawable->surface_id == surface_id) {
- PipeItem *tmp_item = item;
- item = (PipeItem *)ring_prev(ring, (RingItem *)item);
+ RedPipeItem *tmp_item = item;
+ item = (RedPipeItem *)ring_prev(ring, (RingItem *)item);
red_channel_client_pipe_remove_and_release(rcc, tmp_item);
if (!item) {
- item = (PipeItem *)ring;
+ item = (RedPipeItem *)ring;
}
continue;
}
@@ -163,7 +163,7 @@ void dcc_create_surface(DisplayChannelClient *dcc, int surface_id)
// 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, PipeItem *pos, int can_lossy)
+ SpiceRect *area, RedPipeItem *pos, int can_lossy)
{
DisplayChannel *display = DCC_TO_DC(dcc);
RedSurface *surface = &display->surfaces[surface_id];
@@ -184,7 +184,7 @@ ImageItem *dcc_add_surface_area_image(DisplayChannelClient *dcc, int surface_id,
item = (ImageItem *)spice_malloc_n_m(height, stride, sizeof(ImageItem));
- pipe_item_init(&item->base, PIPE_ITEM_TYPE_IMAGE);
+ red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_IMAGE);
item->surface_id = surface_id;
item->image_format =
@@ -274,7 +274,7 @@ static void add_drawable_surface_images(DisplayChannelClient *dcc, Drawable *dra
dcc_push_surface_image(dcc, drawable->surface_id);
}
-void drawable_pipe_item_free(PipeItem *item)
+void drawable_pipe_item_free(RedPipeItem *item)
{
DrawablePipeItem *dpi = SPICE_CONTAINEROF(item, DrawablePipeItem, dpi_pipe_item);
DisplayChannel *display = DCC_TO_DC(dpi->dcc);
@@ -296,8 +296,8 @@ static DrawablePipeItem *drawable_pipe_item_new(DisplayChannelClient *dcc, Drawa
dpi->dcc = dcc;
ring_item_init(&dpi->base);
ring_add(&drawable->pipes, &dpi->base);
- 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, PIPE_ITEM_TYPE_DRAW,
+ (GDestroyNotify)drawable_pipe_item_free);
drawable->refs++;
return dpi;
}
@@ -318,7 +318,7 @@ void dcc_append_drawable(DisplayChannelClient *dcc, Drawable *drawable)
red_channel_client_pipe_add_tail_and_push(RED_CHANNEL_CLIENT(dcc), &dpi->dpi_pipe_item);
}
-void dcc_add_drawable_after(DisplayChannelClient *dcc, Drawable *drawable, PipeItem *pos)
+void dcc_add_drawable_after(DisplayChannelClient *dcc, Drawable *drawable, RedPipeItem *pos)
{
DrawablePipeItem *dpi = drawable_pipe_item_new(dcc, drawable);
@@ -336,8 +336,8 @@ static void dcc_init_stream_agents(DisplayChannelClient *dcc)
agent->stream = &display->streams_buf[i];
region_init(&agent->vis_region);
region_init(&agent->clip);
- pipe_item_init(&agent->create_item, PIPE_ITEM_TYPE_STREAM_CREATE);
- pipe_item_init(&agent->destroy_item, PIPE_ITEM_TYPE_STREAM_DESTROY);
+ red_pipe_item_init(&agent->create_item, PIPE_ITEM_TYPE_STREAM_CREATE);
+ red_pipe_item_init(&agent->destroy_item, 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);
@@ -507,7 +507,7 @@ void dcc_stream_agent_clip(DisplayChannelClient* dcc, StreamAgent *agent)
item->rects->num_rects = n_rects;
region_ret_rects(&agent->clip, item->rects->rects, n_rects);
- red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), (PipeItem *)item);
+ red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), (RedPipeItem *)item);
}
static void monitors_config_item_free(MonitorsConfigItem *item)
@@ -524,8 +524,8 @@ static MonitorsConfigItem *monitors_config_item_new(RedChannel* channel,
mci = (MonitorsConfigItem *)spice_malloc(sizeof(*mci));
mci->monitors_config = monitors_config;
- 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, PIPE_ITEM_TYPE_MONITORS_CONFIG,
+ (GDestroyNotify)monitors_config_item_free);
return mci;
}
@@ -558,12 +558,12 @@ static SurfaceDestroyItem *surface_destroy_item_new(RedChannel *channel,
destroy = spice_malloc(sizeof(SurfaceDestroyItem));
destroy->surface_destroy.surface_id = surface_id;
- pipe_item_init(&destroy->pipe_item, PIPE_ITEM_TYPE_DESTROY_SURFACE);
+ red_pipe_item_init(&destroy->pipe_item, PIPE_ITEM_TYPE_DESTROY_SURFACE);
return destroy;
}
-PipeItem *dcc_gl_scanout_item_new(RedChannelClient *rcc, void *data, int num)
+RedPipeItem *dcc_gl_scanout_item_new(RedChannelClient *rcc, void *data, int num)
{
GlScanoutUnixItem *item = spice_new(GlScanoutUnixItem, 1);
spice_return_val_if_fail(item != NULL, NULL);
@@ -576,12 +576,12 @@ PipeItem *dcc_gl_scanout_item_new(RedChannelClient *rcc, void *data, int num)
return NULL;
}
- pipe_item_init(&item->base, PIPE_ITEM_TYPE_GL_SCANOUT);
+ red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_GL_SCANOUT);
return &item->base;
}
-PipeItem *dcc_gl_draw_item_new(RedChannelClient *rcc, void *data, int num)
+RedPipeItem *dcc_gl_draw_item_new(RedChannelClient *rcc, void *data, int num)
{
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
const SpiceMsgDisplayGlDraw *draw = data;
@@ -596,7 +596,7 @@ PipeItem *dcc_gl_draw_item_new(RedChannelClient *rcc, void *data, int num)
dcc->gl_draw_ongoing = TRUE;
item->draw = *draw;
- pipe_item_init(&item->base, PIPE_ITEM_TYPE_GL_DRAW);
+ red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_GL_DRAW);
return &item->base;
}
@@ -1591,7 +1591,7 @@ int dcc_handle_migrate_data(DisplayChannelClient *dcc, uint32_t size, void *mess
return TRUE;
}
-static void release_item_after_push(DisplayChannelClient *dcc, PipeItem *item)
+static void release_item_after_push(DisplayChannelClient *dcc, RedPipeItem *item)
{
switch (item->type) {
case PIPE_ITEM_TYPE_DRAW:
@@ -1599,7 +1599,7 @@ static void release_item_after_push(DisplayChannelClient *dcc, PipeItem *item)
case PIPE_ITEM_TYPE_STREAM_CLIP:
case PIPE_ITEM_TYPE_UPGRADE:
case PIPE_ITEM_TYPE_MONITORS_CONFIG:
- pipe_item_unref(item);
+ red_pipe_item_unref(item);
break;
case PIPE_ITEM_TYPE_GL_SCANOUT:
case PIPE_ITEM_TYPE_GL_DRAW:
@@ -1613,7 +1613,7 @@ static void release_item_after_push(DisplayChannelClient *dcc, PipeItem *item)
// TODO: share code between before/after_push since most of the items need the same
// release
-static void release_item_before_push(DisplayChannelClient *dcc, PipeItem *item)
+static void release_item_before_push(DisplayChannelClient *dcc, RedPipeItem *item)
{
DisplayChannel *display = DCC_TO_DC(dcc);
@@ -1622,7 +1622,7 @@ static void release_item_before_push(DisplayChannelClient *dcc, PipeItem *item)
case PIPE_ITEM_TYPE_DRAW: {
DrawablePipeItem *dpi = SPICE_CONTAINEROF(item, DrawablePipeItem, dpi_pipe_item);
ring_remove(&dpi->base);
- pipe_item_unref(item);
+ red_pipe_item_unref(item);
break;
}
case PIPE_ITEM_TYPE_STREAM_CREATE: {
@@ -1639,7 +1639,7 @@ static void release_item_before_push(DisplayChannelClient *dcc, PipeItem *item)
case PIPE_ITEM_TYPE_UPGRADE:
case PIPE_ITEM_TYPE_IMAGE:
case PIPE_ITEM_TYPE_MONITORS_CONFIG:
- pipe_item_unref(item);
+ red_pipe_item_unref(item);
break;
case PIPE_ITEM_TYPE_CREATE_SURFACE: {
SurfaceCreateItem *surface_create = SPICE_CONTAINEROF(item, SurfaceCreateItem,
@@ -1669,7 +1669,7 @@ static void release_item_before_push(DisplayChannelClient *dcc, PipeItem *item)
}
}
-void dcc_release_item(DisplayChannelClient *dcc, PipeItem *item, int item_pushed)
+void dcc_release_item(DisplayChannelClient *dcc, RedPipeItem *item, int item_pushed)
{
if (item_pushed)
release_item_after_push(dcc, item);
diff --git a/server/dcc.h b/server/dcc.h
index e8354e2..52cd22a 100644
--- a/server/dcc.h
+++ b/server/dcc.h
@@ -123,20 +123,20 @@ struct DisplayChannelClient {
typedef struct SurfaceCreateItem {
SpiceMsgSurfaceCreate surface_create;
- PipeItem pipe_item;
+ RedPipeItem pipe_item;
} SurfaceCreateItem;
typedef struct GlScanoutUnixItem {
- PipeItem base;
+ RedPipeItem base;
} GlScanoutUnixItem;
typedef struct GlDrawItem {
- PipeItem base;
+ RedPipeItem base;
SpiceMsgDisplayGlDraw draw;
} GlDrawItem;
typedef struct ImageItem {
- PipeItem base;
+ RedPipeItem base;
SpicePoint pos;
int width;
int height;
@@ -151,7 +151,7 @@ typedef struct ImageItem {
typedef struct DrawablePipeItem {
RingItem base; /* link for a list of pipe items held by Drawable */
- PipeItem dpi_pipe_item; /* link for the client's pipe itself */
+ RedPipeItem dpi_pipe_item; /* link for the client's pipe itself */
Drawable *drawable;
DisplayChannelClient *dcc;
uint8_t refs;
@@ -189,7 +189,7 @@ void dcc_push_surface_image (DisplayCha
ImageItem * dcc_add_surface_area_image (DisplayChannelClient *dcc,
int surface_id,
SpiceRect *area,
- PipeItem *pos,
+ RedPipeItem *pos,
int can_lossy);
void dcc_palette_cache_reset (DisplayChannelClient *dcc);
void dcc_palette_cache_palette (DisplayChannelClient *dcc,
@@ -203,20 +203,20 @@ void dcc_append_drawable (DisplayCha
Drawable *drawable);
void dcc_add_drawable_after (DisplayChannelClient *dcc,
Drawable *drawable,
- PipeItem *pos);
+ RedPipeItem *pos);
void dcc_release_item (DisplayChannelClient *dcc,
- PipeItem *item,
+ RedPipeItem *item,
int item_pushed);
void dcc_send_item (DisplayChannelClient *dcc,
- PipeItem *item);
+ RedPipeItem *item);
int dcc_clear_surface_drawables_from_pipe (DisplayChannelClient *dcc,
int surface_id,
int wait_if_used);
int dcc_drawable_is_in_pipe (DisplayChannelClient *dcc,
Drawable *drawable);
-PipeItem * dcc_gl_scanout_item_new (RedChannelClient *rcc,
+RedPipeItem * dcc_gl_scanout_item_new (RedChannelClient *rcc,
void *data, int num);
-PipeItem * dcc_gl_draw_item_new (RedChannelClient *rcc,
+RedPipeItem * dcc_gl_draw_item_new (RedChannelClient *rcc,
void *data, int num);
typedef struct compress_send_data_t {
diff --git a/server/display-channel.c b/server/display-channel.c
index 98b4a43..d24b6a6 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -408,7 +408,7 @@ static void drawable_remove_from_pipes(Drawable *drawable)
RING_FOREACH_SAFE(item, next, &drawable->pipes) {
dpi = SPICE_CONTAINEROF(item, DrawablePipeItem, base);
- if (pipe_item_is_linked(&dpi->dpi_pipe_item)) {
+ 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);
}
@@ -1960,12 +1960,12 @@ static void on_disconnect(RedChannelClient *rcc)
display->glz_drawable_count);
}
-static void send_item(RedChannelClient *rcc, PipeItem *item)
+static void send_item(RedChannelClient *rcc, RedPipeItem *item)
{
dcc_send_item(RCC_TO_DCC(rcc), item);
}
-static void hold_item(RedChannelClient *rcc, PipeItem *item)
+static void hold_item(RedChannelClient *rcc, RedPipeItem *item)
{
spice_return_if_fail(item);
@@ -1974,14 +1974,14 @@ static void hold_item(RedChannelClient *rcc, PipeItem *item)
case PIPE_ITEM_TYPE_IMAGE:
case PIPE_ITEM_TYPE_STREAM_CLIP:
case PIPE_ITEM_TYPE_UPGRADE:
- pipe_item_ref(item);
+ red_pipe_item_ref(item);
break;
default:
spice_warn_if_reached();
}
}
-static void release_item(RedChannelClient *rcc, PipeItem *item, int item_pushed)
+static void release_item(RedChannelClient *rcc, RedPipeItem *item, int item_pushed)
{
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
diff --git a/server/display-channel.h b/server/display-channel.h
index 8944f06..13f1499 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -58,7 +58,7 @@ struct Drawable {
RingItem list_link;
DrawItem tree_item;
Ring pipes;
- PipeItem *pipe_item_rest;
+ RedPipeItem *pipe_item_rest;
uint32_t size_pipe_item_rest;
RedDrawable *red_drawable;
@@ -117,7 +117,7 @@ typedef struct MonitorsConfig {
} MonitorsConfig;
typedef struct MonitorsConfigItem {
- PipeItem pipe_item;
+ RedPipeItem pipe_item;
MonitorsConfig *monitors_config;
} MonitorsConfigItem;
@@ -239,11 +239,11 @@ static inline int get_stream_id(DisplayChannel *display, Stream *stream)
typedef struct SurfaceDestroyItem {
SpiceMsgSurfaceDestroy surface_destroy;
- PipeItem pipe_item;
+ RedPipeItem pipe_item;
} SurfaceDestroyItem;
typedef struct UpgradeItem {
- PipeItem base;
+ RedPipeItem base;
DisplayChannelClient *dcc;
Drawable *drawable;
SpiceClipRects *rects;
diff --git a/server/inputs-channel.c b/server/inputs-channel.c
index 45e0a8f..81a8d4a 100644
--- a/server/inputs-channel.c
+++ b/server/inputs-channel.c
@@ -123,16 +123,16 @@ enum {
};
typedef struct InputsPipeItem {
- PipeItem base;
+ RedPipeItem base;
} InputsPipeItem;
typedef struct KeyModifiersPipeItem {
- PipeItem base;
+ RedPipeItem base;
uint8_t modifiers;
} KeyModifiersPipeItem;
typedef struct InputsInitPipeItem {
- PipeItem base;
+ RedPipeItem base;
uint8_t modifiers;
} InputsInitPipeItem;
@@ -229,19 +229,19 @@ static uint8_t kbd_get_leds(SpiceKbdInstance *sin)
return sif->get_leds(sin);
}
-static PipeItem *inputs_key_modifiers_item_new(
+static RedPipeItem *inputs_key_modifiers_item_new(
RedChannelClient *rcc, void *data, int num)
{
KeyModifiersPipeItem *item = spice_malloc(sizeof(KeyModifiersPipeItem));
- pipe_item_init(&item->base, PIPE_ITEM_KEY_MODIFIERS);
+ red_pipe_item_init(&item->base, PIPE_ITEM_KEY_MODIFIERS);
item->modifiers = *(uint8_t *)data;
return &item->base;
}
static void inputs_channel_send_migrate_data(RedChannelClient *rcc,
SpiceMarshaller *m,
- PipeItem *item)
+ RedPipeItem *item)
{
InputsChannelClient *icc = SPICE_CONTAINEROF(rcc, InputsChannelClient, base);
InputsChannel *inputs = SPICE_CONTAINEROF(rcc->channel, InputsChannel, base);
@@ -255,12 +255,12 @@ static void inputs_channel_send_migrate_data(RedChannelClient *rcc,
}
static void inputs_channel_release_pipe_item(RedChannelClient *rcc,
- PipeItem *base, int item_pushed)
+ RedPipeItem *base, int item_pushed)
{
free(base);
}
-static void inputs_channel_send_item(RedChannelClient *rcc, PipeItem *base)
+static void inputs_channel_send_item(RedChannelClient *rcc, RedPipeItem *base)
{
SpiceMarshaller *m = red_channel_client_get_marshaller(rcc);
@@ -503,7 +503,7 @@ static void inputs_pipe_add_init(RedChannelClient *rcc)
InputsInitPipeItem *item = spice_malloc(sizeof(InputsInitPipeItem));
InputsChannel *inputs = SPICE_CONTAINEROF(rcc->channel, InputsChannel, base);
- pipe_item_init(&item->base, PIPE_ITEM_INPUTS_INIT);
+ red_pipe_item_init(&item->base, PIPE_ITEM_INPUTS_INIT);
item->modifiers = kbd_get_leds(inputs_channel_get_keyboard(inputs));
red_channel_client_pipe_add_push(rcc, &item->base);
}
@@ -524,7 +524,7 @@ static int inputs_channel_config_socket(RedChannelClient *rcc)
return TRUE;
}
-static void inputs_channel_hold_pipe_item(RedChannelClient *rcc, PipeItem *item)
+static void inputs_channel_hold_pipe_item(RedChannelClient *rcc, RedPipeItem *item)
{
}
diff --git a/server/main-channel.c b/server/main-channel.c
index a9d0ce1..b904e33 100644
--- a/server/main-channel.c
+++ b/server/main-channel.c
@@ -79,28 +79,28 @@ enum {
};
typedef struct RefsPipeItem {
- PipeItem base;
+ RedPipeItem base;
int *refs;
} RefsPipeItem;
typedef struct PingPipeItem {
- PipeItem base;
+ RedPipeItem base;
int size;
} PingPipeItem;
typedef struct MouseModePipeItem {
- PipeItem base;
+ RedPipeItem base;
int current_mode;
int is_client_mouse_allowed;
} MouseModePipeItem;
typedef struct TokensPipeItem {
- PipeItem base;
+ RedPipeItem base;
int tokens;
} TokensPipeItem;
typedef struct AgentDataPipeItem {
- PipeItem base;
+ RedPipeItem base;
uint8_t* data;
size_t len;
spice_marshaller_item_free_func free_data;
@@ -108,7 +108,7 @@ typedef struct AgentDataPipeItem {
} AgentDataPipeItem;
typedef struct InitPipeItem {
- PipeItem base;
+ RedPipeItem base;
int connection_id;
int display_channels_hint;
int current_mouse_mode;
@@ -118,22 +118,22 @@ typedef struct InitPipeItem {
} InitPipeItem;
typedef struct NamePipeItem {
- PipeItem base;
+ RedPipeItem base;
SpiceMsgMainName msg;
} NamePipeItem;
typedef struct UuidPipeItem {
- PipeItem base;
+ RedPipeItem base;
SpiceMsgMainUuid msg;
} UuidPipeItem;
typedef struct NotifyPipeItem {
- PipeItem base;
+ RedPipeItem base;
char *msg;
} NotifyPipeItem;
typedef struct MultiMediaTimePipeItem {
- PipeItem base;
+ RedPipeItem base;
int time;
} MultiMediaTimePipeItem;
@@ -166,7 +166,7 @@ enum NetTestStage {
};
static void main_channel_release_pipe_item(RedChannelClient *rcc,
- PipeItem *base, int item_pushed);
+ RedPipeItem *base, int item_pushed);
int main_channel_is_connected(MainChannel *main_chan)
{
@@ -221,42 +221,42 @@ typedef struct MainMouseModeItemInfo {
int is_client_mouse_allowed;
} MainMouseModeItemInfo;
-static PipeItem *main_mouse_mode_item_new(RedChannelClient *rcc, void *data, int num)
+static RedPipeItem *main_mouse_mode_item_new(RedChannelClient *rcc, void *data, int num)
{
MouseModePipeItem *item = spice_malloc(sizeof(MouseModePipeItem));
MainMouseModeItemInfo *info = data;
- pipe_item_init(&item->base, PIPE_ITEM_TYPE_MAIN_MOUSE_MODE);
+ red_pipe_item_init(&item->base, 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 PipeItem *main_ping_item_new(MainChannelClient *mcc, int size)
+static RedPipeItem *main_ping_item_new(MainChannelClient *mcc, int size)
{
PingPipeItem *item = spice_malloc(sizeof(PingPipeItem));
- pipe_item_init(&item->base, PIPE_ITEM_TYPE_MAIN_PING);
+ red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_MAIN_PING);
item->size = size;
return &item->base;
}
-static PipeItem *main_agent_tokens_item_new(RedChannelClient *rcc, uint32_t num_tokens)
+static RedPipeItem *main_agent_tokens_item_new(RedChannelClient *rcc, uint32_t num_tokens)
{
TokensPipeItem *item = spice_malloc(sizeof(TokensPipeItem));
- pipe_item_init(&item->base, PIPE_ITEM_TYPE_MAIN_AGENT_TOKEN);
+ red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_MAIN_AGENT_TOKEN);
item->tokens = num_tokens;
return &item->base;
}
-static PipeItem *main_agent_data_item_new(RedChannelClient *rcc, uint8_t* data, size_t len,
- spice_marshaller_item_free_func free_data,
- void *opaque)
+static RedPipeItem *main_agent_data_item_new(RedChannelClient *rcc, uint8_t* data, size_t len,
+ spice_marshaller_item_free_func free_data,
+ void *opaque)
{
AgentDataPipeItem *item = spice_malloc(sizeof(AgentDataPipeItem));
- pipe_item_init(&item->base, PIPE_ITEM_TYPE_MAIN_AGENT_DATA);
+ red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_MAIN_AGENT_DATA);
item->data = data;
item->len = len;
item->free_data = free_data;
@@ -264,14 +264,14 @@ static PipeItem *main_agent_data_item_new(RedChannelClient *rcc, uint8_t* data,
return &item->base;
}
-static PipeItem *main_init_item_new(MainChannelClient *mcc,
+static RedPipeItem *main_init_item_new(MainChannelClient *mcc,
int connection_id, int display_channels_hint, int current_mouse_mode,
int is_client_mouse_allowed, int multi_media_time,
int ram_hint)
{
InitPipeItem *item = spice_malloc(sizeof(InitPipeItem));
- pipe_item_init(&item->base, PIPE_ITEM_TYPE_MAIN_INIT);
+ red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_MAIN_INIT);
item->connection_id = connection_id;
item->display_channels_hint = display_channels_hint;
item->current_mouse_mode = current_mouse_mode;
@@ -281,44 +281,44 @@ static PipeItem *main_init_item_new(MainChannelClient *mcc,
return &item->base;
}
-static PipeItem *main_name_item_new(MainChannelClient *mcc, const char *name)
+static RedPipeItem *main_name_item_new(MainChannelClient *mcc, const char *name)
{
NamePipeItem *item = spice_malloc(sizeof(NamePipeItem) + strlen(name) + 1);
- pipe_item_init(&item->base, PIPE_ITEM_TYPE_MAIN_NAME);
+ red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_MAIN_NAME);
item->msg.name_len = strlen(name) + 1;
memcpy(&item->msg.name, name, item->msg.name_len);
return &item->base;
}
-static PipeItem *main_uuid_item_new(MainChannelClient *mcc, const uint8_t uuid[16])
+static RedPipeItem *main_uuid_item_new(MainChannelClient *mcc, const uint8_t uuid[16])
{
UuidPipeItem *item = spice_malloc(sizeof(UuidPipeItem));
- pipe_item_init(&item->base, PIPE_ITEM_TYPE_MAIN_UUID);
+ red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_MAIN_UUID);
memcpy(item->msg.uuid, uuid, sizeof(item->msg.uuid));
return &item->base;
}
-static PipeItem *main_notify_item_new(RedChannelClient *rcc, void *data, int num)
+static RedPipeItem *main_notify_item_new(RedChannelClient *rcc, void *data, int num)
{
NotifyPipeItem *item = spice_malloc(sizeof(NotifyPipeItem));
const char *msg = data;
- pipe_item_init(&item->base, PIPE_ITEM_TYPE_MAIN_NOTIFY);
+ red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_MAIN_NOTIFY);
item->msg = spice_strdup(msg);
return &item->base;
}
-static PipeItem *main_multi_media_time_item_new(
+static RedPipeItem *main_multi_media_time_item_new(
RedChannelClient *rcc, void *data, int num)
{
MultiMediaTimePipeItem *item, *info = data;
item = spice_malloc(sizeof(MultiMediaTimePipeItem));
- pipe_item_init(&item->base, PIPE_ITEM_TYPE_MAIN_MULTI_MEDIA_TIME);
+ red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_MAIN_MULTI_MEDIA_TIME);
item->time = info->time;
return &item->base;
}
@@ -335,7 +335,7 @@ static void main_channel_push_channels(MainChannelClient *mcc)
static void main_channel_marshall_channels(RedChannelClient *rcc,
SpiceMarshaller *m,
- PipeItem *item)
+ RedPipeItem *item)
{
SpiceMsgChannels* channels_info;
@@ -349,7 +349,7 @@ static void main_channel_marshall_channels(RedChannelClient *rcc,
int main_channel_client_push_ping(MainChannelClient *mcc, int size)
{
- PipeItem *item;
+ RedPipeItem *item;
if (mcc == NULL) {
return FALSE;
@@ -417,7 +417,7 @@ void main_channel_push_agent_connected(MainChannel *main_chan)
static void main_channel_marshall_agent_connected(SpiceMarshaller *m,
RedChannelClient *rcc,
- PipeItem *item)
+ RedPipeItem *item)
{
SpiceMsgMainAgentConnectedTokens connected;
@@ -433,7 +433,7 @@ void main_channel_push_agent_disconnected(MainChannel *main_chan)
static void main_channel_marshall_agent_disconnected(RedChannelClient *rcc,
SpiceMarshaller *m,
- PipeItem *item)
+ RedPipeItem *item)
{
SpiceMsgMainAgentDisconnect disconnect;
@@ -444,7 +444,7 @@ static void main_channel_marshall_agent_disconnected(RedChannelClient *rcc,
void main_channel_client_push_agent_tokens(MainChannelClient *mcc, uint32_t num_tokens)
{
- PipeItem *item = main_agent_tokens_item_new(&mcc->base, num_tokens);
+ RedPipeItem *item = main_agent_tokens_item_new(&mcc->base, num_tokens);
red_channel_client_pipe_add_push(&mcc->base, item);
}
@@ -462,7 +462,7 @@ static void main_channel_marshall_tokens(RedChannelClient *rcc,
void main_channel_client_push_agent_data(MainChannelClient *mcc, uint8_t* data, size_t len,
spice_marshaller_item_free_func free_data, void *opaque)
{
- PipeItem *item;
+ RedPipeItem *item;
item = main_agent_data_item_new(&mcc->base, data, len, free_data, opaque);
red_channel_client_pipe_add_push(&mcc->base, item);
@@ -482,7 +482,8 @@ static void main_channel_push_migrate_data_item(MainChannel *main_chan)
}
static void main_channel_marshall_migrate_data_item(RedChannelClient *rcc,
- SpiceMarshaller *m, PipeItem *item)
+ SpiceMarshaller *m,
+ RedPipeItem *item)
{
red_channel_client_init_send_data(rcc, SPICE_MSG_MIGRATE_DATA, item);
reds_marshall_migrate_data(rcc->channel->reds, m); // TODO: from reds split. ugly separation.
@@ -515,7 +516,7 @@ void main_channel_push_init(MainChannelClient *mcc,
int is_client_mouse_allowed, int multi_media_time,
int ram_hint)
{
- PipeItem *item;
+ RedPipeItem *item;
item = main_init_item_new(mcc,
mcc->connection_id, display_channels_hint, current_mouse_mode,
@@ -547,7 +548,7 @@ static void main_channel_marshall_init(RedChannelClient *rcc,
void main_channel_push_name(MainChannelClient *mcc, const char *name)
{
- PipeItem *item;
+ RedPipeItem *item;
if (!red_channel_client_test_remote_cap(&mcc->base,
SPICE_MAIN_CAP_NAME_AND_UUID))
@@ -559,7 +560,7 @@ void main_channel_push_name(MainChannelClient *mcc, const char *name)
void main_channel_push_uuid(MainChannelClient *mcc, const uint8_t uuid[16])
{
- PipeItem *item;
+ RedPipeItem *item;
if (!red_channel_client_test_remote_cap(&mcc->base,
SPICE_MAIN_CAP_NAME_AND_UUID))
@@ -571,7 +572,7 @@ void main_channel_push_uuid(MainChannelClient *mcc, const uint8_t uuid[16])
void main_channel_client_push_notify(MainChannelClient *mcc, const char *msg)
{
- PipeItem *item = main_notify_item_new(&mcc->base, (void *)msg, 1);
+ RedPipeItem *item = main_notify_item_new(&mcc->base, (void *)msg, 1);
red_channel_client_pipe_add_push(&mcc->base, item);
}
@@ -608,7 +609,7 @@ static void main_channel_fill_migrate_dst_info(MainChannel *main_channel,
}
static void main_channel_marshall_migrate_begin(SpiceMarshaller *m, RedChannelClient *rcc,
- PipeItem *item)
+ RedPipeItem *item)
{
SpiceMsgMainMigrationBegin migrate;
MainChannel *main_ch;
@@ -621,7 +622,7 @@ static void main_channel_marshall_migrate_begin(SpiceMarshaller *m, RedChannelCl
static void main_channel_marshall_migrate_begin_seamless(SpiceMarshaller *m,
RedChannelClient *rcc,
- PipeItem *item)
+ RedPipeItem *item)
{
SpiceMsgMainMigrateBeginSeamless migrate_seamless;
MainChannel *main_ch;
@@ -665,7 +666,7 @@ void main_channel_migrate_switch(MainChannel *main_chan, RedsMigSpice *mig_targe
}
static void main_channel_marshall_migrate_switch(SpiceMarshaller *m, RedChannelClient *rcc,
- PipeItem *item)
+ RedPipeItem *item)
{
SpiceMsgMainMigrationSwitchHost migrate;
MainChannel *main_ch;
@@ -698,7 +699,7 @@ static void main_channel_marshall_multi_media_time(RedChannelClient *rcc,
spice_marshall_msg_main_multi_media_time(m, &time_mes);
}
-static void main_channel_send_item(RedChannelClient *rcc, PipeItem *base)
+static void main_channel_send_item(RedChannelClient *rcc, RedPipeItem *base)
{
MainChannelClient *mcc = SPICE_CONTAINEROF(rcc, MainChannelClient, base);
SpiceMarshaller *m = red_channel_client_get_marshaller(rcc);
@@ -783,7 +784,7 @@ static void main_channel_send_item(RedChannelClient *rcc, PipeItem *base)
}
static void main_channel_release_pipe_item(RedChannelClient *rcc,
- PipeItem *base, int item_pushed)
+ RedPipeItem *base, int item_pushed)
{
switch (base->type) {
case PIPE_ITEM_TYPE_MAIN_AGENT_DATA: {
@@ -1022,7 +1023,7 @@ static int main_channel_config_socket(RedChannelClient *rcc)
return TRUE;
}
-static void main_channel_hold_pipe_item(RedChannelClient *rcc, PipeItem *item)
+static void main_channel_hold_pipe_item(RedChannelClient *rcc, RedPipeItem *item)
{
}
diff --git a/server/red-channel.c b/server/red-channel.c
index 3e036c9..834ddb7 100644
--- a/server/red-channel.c
+++ b/server/red-channel.c
@@ -45,7 +45,7 @@
#include "utils.h"
typedef struct EmptyMsgPipeItem {
- PipeItem base;
+ RedPipeItem base;
int msg;
} EmptyMsgPipeItem;
@@ -510,7 +510,7 @@ static void red_channel_client_send_migrate(RedChannelClient *rcc)
}
-static void red_channel_client_send_empty_msg(RedChannelClient *rcc, PipeItem *base)
+static void red_channel_client_send_empty_msg(RedChannelClient *rcc, RedPipeItem *base)
{
EmptyMsgPipeItem *msg_pipe_item = SPICE_CONTAINEROF(base, EmptyMsgPipeItem, base);
@@ -557,7 +557,7 @@ static void red_channel_client_send_ping(RedChannelClient *rcc)
red_channel_client_begin_send_message(rcc);
}
-static void red_channel_client_send_item(RedChannelClient *rcc, PipeItem *item)
+static void red_channel_client_send_item(RedChannelClient *rcc, RedPipeItem *item)
{
spice_assert(red_channel_client_no_item_being_sent(rcc));
red_channel_client_reset_send_data(rcc);
@@ -581,7 +581,7 @@ static void red_channel_client_send_item(RedChannelClient *rcc, PipeItem *item)
free(item);
}
-static void red_channel_client_release_item(RedChannelClient *rcc, PipeItem *item, int item_pushed)
+static void red_channel_client_release_item(RedChannelClient *rcc, RedPipeItem *item, int item_pushed)
{
switch (item->type) {
case PIPE_ITEM_TYPE_SET_ACK:
@@ -643,7 +643,7 @@ static void red_channel_peer_on_out_msg_done(void *opaque)
}
-static void red_channel_client_pipe_remove(RedChannelClient *rcc, PipeItem *item)
+static void red_channel_client_pipe_remove(RedChannelClient *rcc, RedPipeItem *item)
{
rcc->pipe_size--;
ring_remove(&item->link);
@@ -1324,13 +1324,13 @@ static inline int red_channel_client_waiting_for_ack(RedChannelClient *rcc)
(rcc->ack_data.messages_window > rcc->ack_data.client_window * 2));
}
-static inline PipeItem *red_channel_client_pipe_item_get(RedChannelClient *rcc)
+static inline RedPipeItem *red_channel_client_pipe_item_get(RedChannelClient *rcc)
{
- PipeItem *item;
+ RedPipeItem *item;
if (!rcc || rcc->send_data.blocked
|| red_channel_client_waiting_for_ack(rcc)
- || !(item = (PipeItem *)ring_get_tail(&rcc->pipe))) {
+ || !(item = (RedPipeItem *)ring_get_tail(&rcc->pipe))) {
return NULL;
}
red_channel_client_pipe_remove(rcc, item);
@@ -1339,7 +1339,7 @@ static inline PipeItem *red_channel_client_pipe_item_get(RedChannelClient *rcc)
void red_channel_client_push(RedChannelClient *rcc)
{
- PipeItem *pipe_item;
+ RedPipeItem *pipe_item;
if (!rcc->during_send) {
rcc->during_send = TRUE;
@@ -1589,7 +1589,7 @@ static void red_channel_client_event(int fd, int event, void *data)
red_channel_client_unref(rcc);
}
-void red_channel_client_init_send_data(RedChannelClient *rcc, uint16_t msg_type, PipeItem *item)
+void red_channel_client_init_send_data(RedChannelClient *rcc, uint16_t msg_type, RedPipeItem *item)
{
spice_assert(red_channel_client_no_item_being_sent(rcc));
spice_assert(msg_type != 0);
@@ -1658,7 +1658,7 @@ void red_channel_client_set_message_serial(RedChannelClient *rcc, uint64_t seria
rcc->send_data.serial = serial;
}
-static inline gboolean client_pipe_add(RedChannelClient *rcc, PipeItem *item, RingItem *pos)
+static inline gboolean client_pipe_add(RedChannelClient *rcc, RedPipeItem *item, RingItem *pos)
{
spice_assert(rcc && item);
if (SPICE_UNLIKELY(!red_channel_client_is_connected(rcc))) {
@@ -1676,38 +1676,39 @@ static inline gboolean client_pipe_add(RedChannelClient *rcc, PipeItem *item, Ri
return TRUE;
}
-void red_channel_client_pipe_add(RedChannelClient *rcc, PipeItem *item)
+void red_channel_client_pipe_add(RedChannelClient *rcc, RedPipeItem *item)
{
client_pipe_add(rcc, item, &rcc->pipe);
}
-void red_channel_client_pipe_add_push(RedChannelClient *rcc, PipeItem *item)
+void red_channel_client_pipe_add_push(RedChannelClient *rcc, RedPipeItem *item)
{
red_channel_client_pipe_add(rcc, item);
red_channel_client_push(rcc);
}
void red_channel_client_pipe_add_after(RedChannelClient *rcc,
- PipeItem *item, PipeItem *pos)
+ RedPipeItem *item,
+ RedPipeItem *pos)
{
spice_assert(pos);
client_pipe_add(rcc, item, &pos->link);
}
int red_channel_client_pipe_item_is_linked(RedChannelClient *rcc,
- PipeItem *item)
+ RedPipeItem *item)
{
return ring_item_is_linked(&item->link);
}
void red_channel_client_pipe_add_tail(RedChannelClient *rcc,
- PipeItem *item)
+ RedPipeItem *item)
{
client_pipe_add(rcc, item, rcc->pipe.prev);
}
-void red_channel_client_pipe_add_tail_and_push(RedChannelClient *rcc, PipeItem *item)
+void red_channel_client_pipe_add_tail_and_push(RedChannelClient *rcc, RedPipeItem *item)
{
if (client_pipe_add(rcc, item, rcc->pipe.prev)) {
red_channel_client_push(rcc);
@@ -1716,9 +1717,9 @@ void red_channel_client_pipe_add_tail_and_push(RedChannelClient *rcc, PipeItem *
void red_channel_client_pipe_add_type(RedChannelClient *rcc, int pipe_item_type)
{
- PipeItem *item = spice_new(PipeItem, 1);
+ RedPipeItem *item = spice_new(RedPipeItem, 1);
- pipe_item_init(item, pipe_item_type);
+ red_pipe_item_init(item, pipe_item_type);
red_channel_client_pipe_add(rcc, item);
red_channel_client_push(rcc);
}
@@ -1738,7 +1739,7 @@ void red_channel_client_pipe_add_empty_msg(RedChannelClient *rcc, int msg_type)
{
EmptyMsgPipeItem *item = spice_new(EmptyMsgPipeItem, 1);
- pipe_item_init(&item->base, PIPE_ITEM_TYPE_EMPTY_MSG);
+ red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_EMPTY_MSG);
item->msg = msg_type;
red_channel_client_pipe_add(rcc, &item->base);
red_channel_client_push(rcc);
@@ -1781,12 +1782,12 @@ void red_channel_client_clear_sent_item(RedChannelClient *rcc)
void red_channel_client_pipe_clear(RedChannelClient *rcc)
{
- PipeItem *item;
+ RedPipeItem *item;
if (rcc) {
red_channel_client_clear_sent_item(rcc);
}
- while ((item = (PipeItem *)ring_get_head(&rcc->pipe))) {
+ while ((item = (RedPipeItem *)ring_get_head(&rcc->pipe))) {
ring_remove(&item->link);
red_channel_client_release_item(rcc, item, FALSE);
}
@@ -2029,7 +2030,7 @@ int red_channel_client_no_item_being_sent(RedChannelClient *rcc)
}
void red_channel_client_pipe_remove_and_release(RedChannelClient *rcc,
- PipeItem *item)
+ RedPipeItem *item)
{
red_channel_client_pipe_remove(rcc, item);
red_channel_client_release_item(rcc, item, FALSE);
@@ -2231,8 +2232,8 @@ int red_client_during_migrate_at_target(RedClient *client)
* TODO - inline? macro? right now this is the simplest from code amount
*/
-typedef void (*rcc_item_t)(RedChannelClient *rcc, PipeItem *item);
-typedef int (*rcc_item_cond_t)(RedChannelClient *rcc, PipeItem *item);
+typedef void (*rcc_item_t)(RedChannelClient *rcc, RedPipeItem *item);
+typedef int (*rcc_item_cond_t)(RedChannelClient *rcc, RedPipeItem *item);
/**
* red_channel_pipes_create_batch:
@@ -2249,7 +2250,7 @@ static int red_channel_pipes_create_batch(RedChannel *channel,
{
RingItem *link, *next;
RedChannelClient *rcc;
- PipeItem *item;
+ RedPipeItem *item;
int num = 0, n = 0;
spice_assert(creator != NULL);
@@ -2362,7 +2363,7 @@ int red_channel_client_wait_outgoing_item(RedChannelClient *rcc,
/* TODO: more evil sync stuff. anything with the word wait in it's name. */
int red_channel_client_wait_pipe_item_sent(RedChannelClient *rcc,
- PipeItem *item,
+ RedPipeItem *item,
int64_t timeout)
{
uint64_t end_time;
diff --git a/server/red-channel.h b/server/red-channel.h
index 3c762ff..be5ae99 100644
--- a/server/red-channel.h
+++ b/server/red-channel.h
@@ -158,10 +158,10 @@ typedef void (*channel_release_msg_recv_buf_proc)(RedChannelClient *channel,
uint16_t type, uint32_t size, uint8_t *msg);
typedef void (*channel_disconnect_proc)(RedChannelClient *rcc);
typedef int (*channel_configure_socket_proc)(RedChannelClient *rcc);
-typedef void (*channel_send_pipe_item_proc)(RedChannelClient *rcc, PipeItem *item);
-typedef void (*channel_hold_pipe_item_proc)(RedChannelClient *rcc, PipeItem *item);
+typedef void (*channel_send_pipe_item_proc)(RedChannelClient *rcc, RedPipeItem *item);
+typedef void (*channel_hold_pipe_item_proc)(RedChannelClient *rcc, RedPipeItem *item);
typedef void (*channel_release_pipe_item_proc)(RedChannelClient *rcc,
- PipeItem *item, int item_pushed);
+ RedPipeItem *item, int item_pushed);
typedef void (*channel_on_incoming_error_proc)(RedChannelClient *rcc);
typedef void (*channel_on_outgoing_error_proc)(RedChannelClient *rcc);
@@ -258,7 +258,7 @@ struct RedChannelClient {
SpiceMarshaller *marshaller;
SpiceDataHeaderOpaque header;
uint32_t size;
- PipeItem *item;
+ RedPipeItem *item;
int blocked;
uint64_t serial;
uint64_t last_sent_serial;
@@ -266,7 +266,7 @@ struct RedChannelClient {
struct {
SpiceMarshaller *marshaller;
uint8_t *header_data;
- PipeItem *item;
+ RedPipeItem *item;
} main;
struct {
@@ -434,7 +434,7 @@ int red_channel_client_handle_message(RedChannelClient *rcc, uint32_t size,
uint16_t type, void *message);
/* when preparing send_data: should call init and then use marshaller */
-void red_channel_client_init_send_data(RedChannelClient *rcc, uint16_t msg_type, PipeItem *item);
+void red_channel_client_init_send_data(RedChannelClient *rcc, uint16_t msg_type, RedPipeItem *item);
uint64_t red_channel_client_get_message_serial(RedChannelClient *channel);
void red_channel_client_set_message_serial(RedChannelClient *channel, uint64_t);
@@ -465,20 +465,20 @@ int red_channel_client_get_roundtrip_ms(RedChannelClient *rcc);
void red_channel_client_start_connectivity_monitoring(RedChannelClient *rcc, uint32_t timeout_ms);
// TODO: add back the channel_pipe_add functionality - by adding reference counting
-// to the PipeItem.
+// to the RedPipeItem.
// helper to push a new item to all channels
-typedef PipeItem *(*new_pipe_item_t)(RedChannelClient *rcc, void *data, int num);
+typedef RedPipeItem *(*new_pipe_item_t)(RedChannelClient *rcc, void *data, int num);
int red_channel_pipes_new_add_push(RedChannel *channel, new_pipe_item_t creator, void *data);
void red_channel_pipes_new_add(RedChannel *channel, new_pipe_item_t creator, void *data);
void red_channel_pipes_new_add_tail(RedChannel *channel, new_pipe_item_t creator, void *data);
-void red_channel_client_pipe_add_push(RedChannelClient *rcc, PipeItem *item);
-void red_channel_client_pipe_add(RedChannelClient *rcc, PipeItem *item);
-void red_channel_client_pipe_add_after(RedChannelClient *rcc, PipeItem *item, PipeItem *pos);
-int red_channel_client_pipe_item_is_linked(RedChannelClient *rcc, PipeItem *item);
-void red_channel_client_pipe_remove_and_release(RedChannelClient *rcc, PipeItem *item);
-void red_channel_client_pipe_add_tail_and_push(RedChannelClient *rcc, PipeItem *item);
+void red_channel_client_pipe_add_push(RedChannelClient *rcc, RedPipeItem *item);
+void red_channel_client_pipe_add(RedChannelClient *rcc, RedPipeItem *item);
+void red_channel_client_pipe_add_after(RedChannelClient *rcc, RedPipeItem *item, RedPipeItem *pos);
+int red_channel_client_pipe_item_is_linked(RedChannelClient *rcc, RedPipeItem *item);
+void red_channel_client_pipe_remove_and_release(RedChannelClient *rcc, RedPipeItem *item);
+void red_channel_client_pipe_add_tail_and_push(RedChannelClient *rcc, RedPipeItem *item);
/* for types that use this routine -> the pipe item should be freed */
void red_channel_client_pipe_add_type(RedChannelClient *rcc, int pipe_item_type);
void red_channel_pipes_add_type(RedChannel *channel, int pipe_item_type);
@@ -619,7 +619,7 @@ void red_client_migrate(RedClient *client);
*/
int red_channel_client_wait_pipe_item_sent(RedChannelClient *rcc,
- PipeItem *item,
+ RedPipeItem *item,
int64_t timeout);
int red_channel_client_wait_outgoing_item(RedChannelClient *rcc,
int64_t timeout);
diff --git a/server/red-pipe-item.c b/server/red-pipe-item.c
index d94d76c..77fb0c2 100644
--- a/server/red-pipe-item.c
+++ b/server/red-pipe-item.c
@@ -20,9 +20,9 @@
#include "red-channel.h"
#include "red-pipe-item.h"
-PipeItem *pipe_item_ref(gpointer object)
+RedPipeItem *red_pipe_item_ref(gpointer object)
{
- PipeItem *item = object;
+ RedPipeItem *item = object;
g_return_val_if_fail(item->refcount > 0, NULL);
@@ -31,9 +31,9 @@ PipeItem *pipe_item_ref(gpointer object)
return item;
}
-void pipe_item_unref(gpointer object)
+void red_pipe_item_unref(gpointer object)
{
- PipeItem *item = object;
+ RedPipeItem *item = object;
g_return_if_fail(item->refcount > 0);
@@ -42,9 +42,9 @@ void pipe_item_unref(gpointer object)
}
}
-void pipe_item_init_full(PipeItem *item,
- gint type,
- GDestroyNotify free_func)
+void red_pipe_item_init_full(RedPipeItem *item,
+ gint type,
+ GDestroyNotify free_func)
{
ring_item_init(&item->link);
item->type = type;
diff --git a/server/red-pipe-item.h b/server/red-pipe-item.h
index 5d9cc0b..ed4d371 100644
--- a/server/red-pipe-item.h
+++ b/server/red-pipe-item.h
@@ -28,19 +28,19 @@ typedef struct {
int refcount;
GDestroyNotify free_func;
-} PipeItem;
+} RedPipeItem;
-void pipe_item_init_full(PipeItem *item, int type, GDestroyNotify free_func);
-PipeItem *pipe_item_ref(gpointer item);
-void pipe_item_unref(gpointer item);
+void red_pipe_item_init_full(RedPipeItem *item, int type, GDestroyNotify free_func);
+RedPipeItem *red_pipe_item_ref(gpointer item);
+void red_pipe_item_unref(gpointer item);
-static inline int pipe_item_is_linked(PipeItem *item)
+static inline int red_pipe_item_is_linked(RedPipeItem *item)
{
return ring_item_is_linked(&item->link);
}
-static inline void pipe_item_init(PipeItem *item, int type)
+static inline void red_pipe_item_init(RedPipeItem *item, int type)
{
- pipe_item_init_full(item, type, NULL);
+ red_pipe_item_init_full(item, type, NULL);
}
#endif
diff --git a/server/red-worker.h b/server/red-worker.h
index 15cceb8..731afc7 100644
--- a/server/red-worker.h
+++ b/server/red-worker.h
@@ -57,7 +57,7 @@ enum {
};
typedef struct VerbItem {
- PipeItem base;
+ RedPipeItem base;
uint16_t verb;
} VerbItem;
@@ -70,7 +70,7 @@ static inline void red_pipe_add_verb(RedChannelClient* rcc, uint16_t verb)
{
VerbItem *item = spice_new(VerbItem, 1);
- pipe_item_init(&item->base, PIPE_ITEM_TYPE_VERB);
+ red_pipe_item_init(&item->base, 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 3a23650..4a8caea 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -167,7 +167,7 @@ struct ChannelSecurityOptions {
};
typedef struct VDIReadBuf {
- PipeItem parent;
+ RedPipeItem parent;
RedCharDeviceVDIPort *dev;
int len;
@@ -482,7 +482,7 @@ static void reds_reset_vdp(RedsState *reds)
dev->priv->receive_len = sizeof(dev->priv->vdi_chunk_header);
dev->priv->message_receive_len = 0;
if (dev->priv->current_read_buf) {
- pipe_item_unref(dev->priv->current_read_buf);
+ red_pipe_item_unref(dev->priv->current_read_buf);
dev->priv->current_read_buf = NULL;
}
/* Reset read filter to start with clean state when the agent reconnects */
@@ -705,7 +705,7 @@ static void vdi_port_read_buf_release(uint8_t *data, void *opaque)
{
VDIReadBuf *buf = (VDIReadBuf *)opaque;
- pipe_item_unref(buf);
+ red_pipe_item_unref(buf);
}
/* returns TRUE if the buffer can be forwarded */
@@ -744,8 +744,8 @@ static void vdi_read_buf_init(VDIReadBuf *buf)
/* Bogus pipe item type, we only need the RingItem and refcounting
* from the base class and are not going to use the type
*/
- pipe_item_init_full(&buf->parent, -1,
- (GDestroyNotify)vdi_port_read_buf_free);
+ red_pipe_item_init_full(&buf->parent, -1,
+ (GDestroyNotify)vdi_port_read_buf_free);
}
static VDIReadBuf *vdi_port_get_read_buf(RedCharDeviceVDIPort *dev)
@@ -782,8 +782,8 @@ static void vdi_port_read_buf_free(VDIReadBuf *buf)
/* reads from the device till completes reading a message that is addressed to the client,
* or otherwise, when reading from the device fails */
-static PipeItem *vdi_port_read_one_msg_from_device(SpiceCharDeviceInstance *sin,
- void *opaque)
+static RedPipeItem *vdi_port_read_one_msg_from_device(SpiceCharDeviceInstance *sin,
+ void *opaque)
{
RedsState *reds;
RedCharDeviceVDIPort *dev = RED_CHAR_DEVICE_VDIPORT(sin->st);
@@ -843,12 +843,12 @@ static PipeItem *vdi_port_read_one_msg_from_device(SpiceCharDeviceInstance *sin,
dev->priv->read_state = VDI_PORT_READ_STATE_GET_BUFF;
}
if (vdi_port_read_buf_process(reds->agent_dev, dispatch_buf, &error)) {
- return (PipeItem *)dispatch_buf;
+ return (RedPipeItem *)dispatch_buf;
} else {
if (error) {
reds_agent_remove(reds);
}
- pipe_item_unref(dispatch_buf);
+ red_pipe_item_unref(dispatch_buf);
}
}
} /* END switch */
@@ -857,13 +857,13 @@ static PipeItem *vdi_port_read_one_msg_from_device(SpiceCharDeviceInstance *sin,
}
/* after calling this, we unref the message, and the ref is in the instance side */
-static void vdi_port_send_msg_to_client(PipeItem *msg,
+static void vdi_port_send_msg_to_client(RedPipeItem *msg,
RedClient *client,
void *opaque)
{
VDIReadBuf *agent_data_buf = (VDIReadBuf *)msg;
- pipe_item_ref(agent_data_buf);
+ red_pipe_item_ref(agent_data_buf);
main_channel_client_push_agent_data(red_client_get_main(client),
agent_data_buf->data,
agent_data_buf->len,
@@ -1218,7 +1218,7 @@ void reds_on_main_channel_migrate(RedsState *reds, MainChannelClient *mcc)
if (error) {
reds_agent_remove(reds);
}
- pipe_item_unref(read_buf);
+ red_pipe_item_unref(read_buf);
}
spice_assert(agent_dev->priv->receive_len);
@@ -4304,7 +4304,7 @@ red_char_device_vdi_port_init(RedCharDeviceVDIPort *self)
/* This ensures the newly created buffer is placed in the
* RedCharDeviceVDIPort::read_bufs queue ready to be reused
*/
- pipe_item_unref(buf);
+ red_pipe_item_unref(buf);
}
}
diff --git a/server/smartcard.c b/server/smartcard.c
index b9b8967..75c5dd2 100644
--- a/server/smartcard.c
+++ b/server/smartcard.c
@@ -83,19 +83,19 @@ enum {
};
typedef struct ErrorItem {
- PipeItem base;
+ RedPipeItem base;
VSCMsgHeader vheader;
VSCMsgError error;
} ErrorItem;
typedef struct MsgItem {
- PipeItem base;
+ RedPipeItem base;
VSCMsgHeader* vheader;
} MsgItem;
static MsgItem *smartcard_get_vsc_msg_item(RedChannelClient *rcc, VSCMsgHeader *vheader);
-static void smartcard_channel_client_pipe_add_push(RedChannelClient *rcc, PipeItem *item);
+static void smartcard_channel_client_pipe_add_push(RedChannelClient *rcc, RedPipeItem *item);
typedef struct SmartCardChannel {
RedChannel base;
@@ -129,8 +129,8 @@ static void smartcard_read_buf_prepare(RedCharDeviceSmartcard *dev, VSCMsgHeader
}
}
-static PipeItem *smartcard_read_msg_from_device(SpiceCharDeviceInstance *sin,
- void *opaque)
+static RedPipeItem *smartcard_read_msg_from_device(SpiceCharDeviceInstance *sin,
+ void *opaque)
{
RedCharDeviceSmartcard *dev = opaque;
SpiceCharDeviceInterface *sif = spice_char_device_get_interface(sin);
@@ -160,19 +160,19 @@ static PipeItem *smartcard_read_msg_from_device(SpiceCharDeviceInstance *sin,
dev->priv->buf_pos = dev->priv->buf;
dev->priv->buf_used = remaining;
if (msg_to_client) {
- return (PipeItem *)msg_to_client;
+ return (RedPipeItem *)msg_to_client;
}
}
return NULL;
}
-static void smartcard_send_msg_to_client(PipeItem *msg,
+static void smartcard_send_msg_to_client(RedPipeItem *msg,
RedClient *client,
void *opaque)
{
RedCharDeviceSmartcard *dev = opaque;
spice_assert(dev->priv->scc && dev->priv->scc->base.client == client);
- smartcard_channel_client_pipe_add_push(&dev->priv->scc->base, (PipeItem *)msg);
+ smartcard_channel_client_pipe_add_push(&dev->priv->scc->base, (RedPipeItem *)msg);
}
@@ -427,7 +427,7 @@ static void smartcard_channel_release_msg_rcv_buf(RedChannelClient *rcc,
}
static void smartcard_channel_send_data(RedChannelClient *rcc, SpiceMarshaller *m,
- PipeItem *item, VSCMsgHeader *vheader)
+ RedPipeItem *item, VSCMsgHeader *vheader)
{
spice_assert(rcc);
spice_assert(vheader);
@@ -439,7 +439,7 @@ static void smartcard_channel_send_data(RedChannelClient *rcc, SpiceMarshaller *
}
static void smartcard_channel_send_error(
- RedChannelClient *rcc, SpiceMarshaller *m, PipeItem *item)
+ RedChannelClient *rcc, SpiceMarshaller *m, RedPipeItem *item)
{
ErrorItem* error_item = (ErrorItem*)item;
@@ -447,7 +447,7 @@ static void smartcard_channel_send_error(
}
static void smartcard_channel_send_msg(RedChannelClient *rcc,
- SpiceMarshaller *m, PipeItem *item)
+ SpiceMarshaller *m, RedPipeItem *item)
{
MsgItem* msg_item = (MsgItem*)item;
@@ -455,7 +455,7 @@ static void smartcard_channel_send_msg(RedChannelClient *rcc,
}
static void smartcard_channel_send_migrate_data(RedChannelClient *rcc,
- SpiceMarshaller *m, PipeItem *item)
+ SpiceMarshaller *m, RedPipeItem *item)
{
SmartCardChannelClient *scc;
RedCharDeviceSmartcard *dev;
@@ -483,7 +483,7 @@ static void smartcard_channel_send_migrate_data(RedChannelClient *rcc,
}
}
-static void smartcard_channel_send_item(RedChannelClient *rcc, PipeItem *item)
+static void smartcard_channel_send_item(RedChannelClient *rcc, RedPipeItem *item)
{
SpiceMarshaller *m = red_channel_client_get_marshaller(rcc);
@@ -506,10 +506,10 @@ static void smartcard_channel_send_item(RedChannelClient *rcc, PipeItem *item)
}
static void smartcard_channel_release_pipe_item(RedChannelClient *rcc,
- PipeItem *item, int item_pushed)
+ RedPipeItem *item, int item_pushed)
{
if (item->type == PIPE_ITEM_TYPE_SMARTCARD_DATA) {
- pipe_item_unref(item);
+ red_pipe_item_unref(item);
} else {
free(item);
}
@@ -530,7 +530,8 @@ static void smartcard_channel_on_disconnect(RedChannelClient *rcc)
/* this is called from both device input and client input. since the device is
* a usb device, the context is still the main thread (kvm_main_loop, timers)
* so no mutex is required. */
-static void smartcard_channel_client_pipe_add_push(RedChannelClient *rcc, PipeItem *item)
+static void smartcard_channel_client_pipe_add_push(RedChannelClient *rcc,
+ RedPipeItem *item)
{
red_channel_client_pipe_add_push(rcc, item);
}
@@ -539,7 +540,7 @@ static void smartcard_push_error(RedChannelClient *rcc, uint32_t reader_id, VSCE
{
ErrorItem *error_item = spice_new0(ErrorItem, 1);
- pipe_item_init(&error_item->base, PIPE_ITEM_TYPE_ERROR);
+ red_pipe_item_init(&error_item->base, PIPE_ITEM_TYPE_ERROR);
error_item->base.type = PIPE_ITEM_TYPE_ERROR;
error_item->vheader.reader_id = reader_id;
@@ -559,8 +560,8 @@ static MsgItem *smartcard_get_vsc_msg_item(RedChannelClient *rcc, VSCMsgHeader *
{
MsgItem *msg_item = spice_new0(MsgItem, 1);
- pipe_item_init_full(&msg_item->base, PIPE_ITEM_TYPE_SMARTCARD_DATA,
- (GDestroyNotify)smartcard_free_vsc_msg_item);
+ red_pipe_item_init_full(&msg_item->base, PIPE_ITEM_TYPE_SMARTCARD_DATA,
+ (GDestroyNotify)smartcard_free_vsc_msg_item);
msg_item->vheader = vheader;
return msg_item;
}
@@ -747,7 +748,8 @@ static int smartcard_channel_handle_message(RedChannelClient *rcc,
return TRUE;
}
-static void smartcard_channel_hold_pipe_item(RedChannelClient *rcc, PipeItem *item)
+static void smartcard_channel_hold_pipe_item(RedChannelClient *rcc,
+ RedPipeItem *item)
{
}
diff --git a/server/spicevmc.c b/server/spicevmc.c
index 638f3ef..3588b8d 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -43,7 +43,7 @@
#define BUF_SIZE (64 * 1024 + 32)
typedef struct SpiceVmcPipeItem {
- PipeItem base;
+ RedPipeItem base;
/* writes which don't fit this will get split, this is not a problem */
uint8_t buf[BUF_SIZE];
@@ -88,13 +88,13 @@ static RedCharDevice *red_char_device_spicevmc_new(SpiceCharDeviceInstance *sin,
G_DEFINE_TYPE(RedCharDeviceSpiceVmc, red_char_device_spicevmc, RED_TYPE_CHAR_DEVICE)
typedef struct PortInitPipeItem {
- PipeItem base;
+ RedPipeItem base;
char* name;
uint8_t opened;
} PortInitPipeItem;
typedef struct PortEventPipeItem {
- PipeItem base;
+ RedPipeItem base;
uint8_t event;
} PortEventPipeItem;
@@ -105,8 +105,8 @@ enum {
PIPE_ITEM_TYPE_PORT_EVENT,
};
-static PipeItem *spicevmc_chardev_read_msg_from_dev(SpiceCharDeviceInstance *sin,
- void *opaque)
+static RedPipeItem *spicevmc_chardev_read_msg_from_dev(SpiceCharDeviceInstance *sin,
+ void *opaque)
{
SpiceVmcState *state = opaque;
SpiceCharDeviceInterface *sif;
@@ -121,7 +121,7 @@ static PipeItem *spicevmc_chardev_read_msg_from_dev(SpiceCharDeviceInstance *sin
if (!state->pipe_item) {
msg_item = spice_new0(SpiceVmcPipeItem, 1);
- pipe_item_init_full(&msg_item->base, PIPE_ITEM_TYPE_SPICEVMC_DATA, free);
+ red_pipe_item_init_full(&msg_item->base, PIPE_ITEM_TYPE_SPICEVMC_DATA, free);
} else {
spice_assert(state->pipe_item->buf_used == 0);
msg_item = state->pipe_item;
@@ -133,14 +133,14 @@ static PipeItem *spicevmc_chardev_read_msg_from_dev(SpiceCharDeviceInstance *sin
if (n > 0) {
spice_debug("read from dev %d", n);
msg_item->buf_used = n;
- return (PipeItem *)msg_item;
+ return (RedPipeItem *)msg_item;
} else {
state->pipe_item = msg_item;
return NULL;
}
}
-static void spicevmc_chardev_send_msg_to_client(PipeItem *msg,
+static void spicevmc_chardev_send_msg_to_client(RedPipeItem *msg,
RedClient *client,
void *opaque)
{
@@ -148,8 +148,8 @@ static void spicevmc_chardev_send_msg_to_client(PipeItem *msg,
SpiceVmcPipeItem *vmc_msg = (SpiceVmcPipeItem *)msg;
spice_assert(state->rcc->client == client);
- pipe_item_ref(vmc_msg);
- red_channel_client_pipe_add_push(state->rcc, (PipeItem *)vmc_msg);
+ red_pipe_item_ref(vmc_msg);
+ red_channel_client_pipe_add_push(state->rcc, (RedPipeItem *)vmc_msg);
}
static void spicevmc_port_send_init(RedChannelClient *rcc)
@@ -158,7 +158,7 @@ static void spicevmc_port_send_init(RedChannelClient *rcc)
SpiceCharDeviceInstance *sin = state->chardev_sin;
PortInitPipeItem *item = spice_malloc(sizeof(PortInitPipeItem));
- pipe_item_init(&item->base, PIPE_ITEM_TYPE_PORT_INIT);
+ red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_PORT_INIT);
item->name = strdup(sin->portname);
item->opened = state->port_opened;
red_channel_client_pipe_add_push(rcc, &item->base);
@@ -168,7 +168,7 @@ static void spicevmc_port_send_event(RedChannelClient *rcc, uint8_t event)
{
PortEventPipeItem *item = spice_malloc(sizeof(PortEventPipeItem));
- pipe_item_init(&item->base, PIPE_ITEM_TYPE_PORT_EVENT);
+ red_pipe_item_init(&item->base, PIPE_ITEM_TYPE_PORT_EVENT);
item->event = event;
red_channel_client_pipe_add_push(rcc, &item->base);
}
@@ -360,14 +360,14 @@ static void spicevmc_red_channel_release_msg_rcv_buf(RedChannelClient *rcc,
}
static void spicevmc_red_channel_hold_pipe_item(RedChannelClient *rcc,
- PipeItem *item)
+ RedPipeItem *item)
{
/* NOOP */
}
static void spicevmc_red_channel_send_data(RedChannelClient *rcc,
SpiceMarshaller *m,
- PipeItem *item)
+ RedPipeItem *item)
{
SpiceVmcPipeItem *i = SPICE_CONTAINEROF(item, SpiceVmcPipeItem, base);
@@ -377,7 +377,7 @@ static void spicevmc_red_channel_send_data(RedChannelClient *rcc,
static void spicevmc_red_channel_send_migrate_data(RedChannelClient *rcc,
SpiceMarshaller *m,
- PipeItem *item)
+ RedPipeItem *item)
{
SpiceVmcState *state;
@@ -391,7 +391,7 @@ static void spicevmc_red_channel_send_migrate_data(RedChannelClient *rcc,
static void spicevmc_red_channel_send_port_init(RedChannelClient *rcc,
SpiceMarshaller *m,
- PipeItem *item)
+ RedPipeItem *item)
{
PortInitPipeItem *i = SPICE_CONTAINEROF(item, PortInitPipeItem, base);
SpiceMsgPortInit init;
@@ -405,7 +405,7 @@ static void spicevmc_red_channel_send_port_init(RedChannelClient *rcc,
static void spicevmc_red_channel_send_port_event(RedChannelClient *rcc,
SpiceMarshaller *m,
- PipeItem *item)
+ RedPipeItem *item)
{
PortEventPipeItem *i = SPICE_CONTAINEROF(item, PortEventPipeItem, base);
SpiceMsgPortEvent event;
@@ -416,7 +416,7 @@ static void spicevmc_red_channel_send_port_event(RedChannelClient *rcc,
}
static void spicevmc_red_channel_send_item(RedChannelClient *rcc,
- PipeItem *item)
+ RedPipeItem *item)
{
SpiceMarshaller *m = red_channel_client_get_marshaller(rcc);
@@ -442,10 +442,11 @@ static void spicevmc_red_channel_send_item(RedChannelClient *rcc,
}
static void spicevmc_red_channel_release_pipe_item(RedChannelClient *rcc,
- PipeItem *item, int item_pushed)
+ RedPipeItem *item,
+ int item_pushed)
{
if (item->type == PIPE_ITEM_TYPE_SPICEVMC_DATA) {
- pipe_item_unref(item);
+ red_pipe_item_unref(item);
} else {
free(item);
}
diff --git a/server/stream.c b/server/stream.c
index a0c2352..cc9f47b 100644
--- a/server/stream.c
+++ b/server/stream.c
@@ -78,7 +78,7 @@ void stream_stop(DisplayChannel *display, Stream *stream)
stream_agent = &dcc->stream_agents[get_stream_id(display, stream)];
region_clear(&stream_agent->vis_region);
region_clear(&stream_agent->clip);
- spice_assert(!pipe_item_is_linked(&stream_agent->destroy_item));
+ spice_assert(!red_pipe_item_is_linked(&stream_agent->destroy_item));
if (stream_agent->mjpeg_encoder && dcc->use_mjpeg_encoder_rate_control) {
uint64_t stream_bit_rate = mjpeg_encoder_get_bit_rate(stream_agent->mjpeg_encoder);
@@ -148,8 +148,8 @@ void stream_clip_item_free(StreamClipItem *item)
StreamClipItem *stream_clip_item_new(StreamAgent *agent)
{
StreamClipItem *item = spice_new(StreamClipItem, 1);
- pipe_item_init_full((PipeItem *)item, PIPE_ITEM_TYPE_STREAM_CLIP,
- (GDestroyNotify)stream_clip_item_free);
+ red_pipe_item_init_full((RedPipeItem *)item, PIPE_ITEM_TYPE_STREAM_CLIP,
+ (GDestroyNotify)stream_clip_item_free);
item->stream_agent = agent;
agent->stream->refs++;
@@ -343,7 +343,7 @@ static void before_reattach_stream(DisplayChannel *display,
continue;
}
- if (pipe_item_is_linked(&dpi->dpi_pipe_item)) {
+ if (red_pipe_item_is_linked(&dpi->dpi_pipe_item)) {
#ifdef STREAM_STATS
agent->stats.num_drops_pipe++;
#endif
@@ -734,8 +734,8 @@ void dcc_create_stream(DisplayChannelClient *dcc, Stream *stream)
StreamActivateReportItem *report_pipe_item = spice_malloc0(sizeof(*report_pipe_item));
agent->report_id = rand();
- pipe_item_init(&report_pipe_item->pipe_item,
- PIPE_ITEM_TYPE_STREAM_ACTIVATE_REPORT);
+ red_pipe_item_init(&report_pipe_item->pipe_item,
+ 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);
}
@@ -809,8 +809,8 @@ static void dcc_detach_stream_gracefully(DisplayChannelClient *dcc,
rect_debug(&stream->current->red_drawable->bbox);
rcc = RED_CHANNEL_CLIENT(dcc);
upgrade_item = spice_new(UpgradeItem, 1);
- pipe_item_init_full(&upgrade_item->base, PIPE_ITEM_TYPE_UPGRADE,
- (GDestroyNotify)upgrade_item_free);
+ red_pipe_item_init_full(&upgrade_item->base, PIPE_ITEM_TYPE_UPGRADE,
+ (GDestroyNotify)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 c83e3b5..5b59212 100644
--- a/server/stream.h
+++ b/server/stream.h
@@ -47,7 +47,7 @@ typedef struct DisplayChannel DisplayChannel;
typedef struct Stream Stream;
typedef struct StreamActivateReportItem {
- PipeItem pipe_item;
+ RedPipeItem pipe_item;
uint32_t stream_id;
} StreamActivateReportItem;
@@ -81,8 +81,8 @@ typedef struct StreamAgent {
vis_region will contain c2 and also the part of c1/c2 that still
displays fragments of the video */
- PipeItem create_item;
- PipeItem destroy_item;
+ RedPipeItem create_item;
+ RedPipeItem destroy_item;
Stream *stream;
uint64_t last_send_time;
MJpegEncoder *mjpeg_encoder;
@@ -100,7 +100,7 @@ typedef struct StreamAgent {
} StreamAgent;
typedef struct StreamClipItem {
- PipeItem base;
+ RedPipeItem base;
StreamAgent *stream_agent;
int clip_type;
SpiceClipRects *rects;
--
2.4.11
More information about the Spice-devel
mailing list