[Spice-devel] [PATCH 07/18] Change new_pipe_item_t function signature
Jonathon Jongsma
jjongsma at redhat.com
Tue May 3 19:45:50 UTC 2016
On Thu, 2016-04-28 at 13:15 -0400, Frediano Ziglio wrote:
> >
> > Now that pipe_item_init() does not require a RedChannelClient* argument
> > anymore, the new_pipe_item_t callback function does not ever use the
> > channel client object passed to it. So just remove this and simplify
> > things.
> > ---
> > server/cursor-channel.c | 2 +-
> > server/dcc.c | 15 ++++++++++++---
> > server/dcc.h | 6 ++----
> > server/inputs-channel.c | 3 +--
> > server/main-channel.c | 45 +++++++++++++++++++++++----------------------
> > server/red-channel.c | 2 +-
> > server/red-channel.h | 2 +-
> > 7 files changed, 41 insertions(+), 34 deletions(-)
> >
> > diff --git a/server/cursor-channel.c b/server/cursor-channel.c
> > index 697d61d..c4304cc 100644
> > --- a/server/cursor-channel.c
> > +++ b/server/cursor-channel.c
> > @@ -132,7 +132,7 @@ static void cursor_set_item(CursorChannel *cursor,
> > CursorItem *item)
> > cursor->item = item ? cursor_item_ref(item) : NULL;
> > }
> >
> > -static RedPipeItem *new_cursor_pipe_item(RedChannelClient *rcc, void *data,
> > int num)
> > +static RedPipeItem *new_cursor_pipe_item(void *data, int num)
> > {
> > RedCursorPipeItem *item = spice_malloc0(sizeof(RedCursorPipeItem));
> >
> > diff --git a/server/dcc.c b/server/dcc.c
> > index 038d74d..7ad8043 100644
> > --- a/server/dcc.c
> > +++ b/server/dcc.c
> > @@ -464,7 +464,7 @@ void dcc_start(DisplayChannelClient *dcc)
> >
> > if (reds_stream_is_plain_unix(rcc->stream) &&
> > red_channel_client_test_remote_cap(rcc,
> > SPICE_DISPLAY_CAP_GL_SCANOUT)) {
> > - red_channel_client_pipe_add(rcc, dcc_gl_scanout_item_new(rcc, NULL,
> > 0));
> > + red_channel_client_pipe_add(rcc, dcc_gl_scanout_item_new(NULL, 0));
> > dcc_push_monitors_config(dcc);
> > }
> > }
> > @@ -570,11 +570,13 @@ static RedSurfaceDestroyItem
> > *red_surface_destroy_item_new(RedChannel *channel,
> > return destroy;
> > }
> >
> > -RedPipeItem *dcc_gl_scanout_item_new(RedChannelClient *rcc, void *data, int
> > num)
> > +RedPipeItem *dcc_gl_scanout_item_new(void *data, int num)
> > {
> > RedGlScanoutUnixItem *item = spice_new(RedGlScanoutUnixItem, 1);
> > spice_return_val_if_fail(item != NULL, NULL);
> >
> > +// TODO TODO TODO
> > +#if 0
> > /* FIXME: on !unix peer, start streaming with a video codec */
> > if (!reds_stream_is_plain_unix(rcc->stream) ||
> > !red_channel_client_test_remote_cap(rcc,
> > SPICE_DISPLAY_CAP_GL_SCANOUT)) {
>
> I think I added these TODOs just to make compiler happy.
>
> Obviously we want the patch not in or these TODOs removed
I plan to drop this patch
>
> > @@ -582,19 +584,25 @@ RedPipeItem *dcc_gl_scanout_item_new(RedChannelClient
> > *rcc, void *data, int num)
> > red_channel_client_disconnect(rcc);
> > return NULL;
> > }
> > +#endif
> >
> > red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_GL_SCANOUT);
> >
> > return &item->base;
> > }
> >
> > -RedPipeItem *dcc_gl_draw_item_new(RedChannelClient *rcc, void *data, int
> > num)
> > +RedPipeItem *dcc_gl_draw_item_new(void *data, int num)
> > {
> > +// TODO TODO TODO
> > +#if 0
> > DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
> > +#endif
> > const SpiceMsgDisplayGlDraw *draw = data;
> > RedGlDrawItem *item = spice_new(RedGlDrawItem, 1);
> > spice_return_val_if_fail(item != NULL, NULL);
> >
> > +// TODO TODO TODO
> > +#if 0
> > if (!red_channel_client_test_remote_cap(rcc,
> > SPICE_DISPLAY_CAP_GL_SCANOUT)) {
> > spice_printerr("FIXME: client does not support GL scanout");
> > red_channel_client_disconnect(rcc);
> > @@ -602,6 +610,7 @@ RedPipeItem *dcc_gl_draw_item_new(RedChannelClient *rcc,
> > void *data, int num)
> > }
> >
> > dcc->gl_draw_ongoing = TRUE;
> > +#endif
> > item->draw = *draw;
> > red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_GL_DRAW);
> >
> > diff --git a/server/dcc.h b/server/dcc.h
> > index 509a6c6..6ca5ee7 100644
> > --- a/server/dcc.h
> > +++ b/server/dcc.h
> > @@ -214,10 +214,8 @@ int
> > dcc_clear_surface_drawables_from_pipe (DisplayCha
> > int
> >
> > wait_if_used);
> > int dcc_drawable_is_in_pipe
> > (DisplayChannelClient *dcc,
> >
> > Drawable
> >
> > *drawable);
> > -RedPipeItem * dcc_gl_scanout_item_new
> > (RedChannelClient *rcc,
> > - void
> > *data, int num);
> > -RedPipeItem * dcc_gl_draw_item_new
> > (RedChannelClient *rcc,
> > - void
> > *data, int num);
> > +RedPipeItem * dcc_gl_scanout_item_new (void
> > *data, int num);
> > +RedPipeItem * dcc_gl_draw_item_new (void
> > *data, int num);
> >
> > typedef struct compress_send_data_t {
> > void* comp_buf;
> > diff --git a/server/inputs-channel.c b/server/inputs-channel.c
> > index da26cf6..efa7cbf 100644
> > --- a/server/inputs-channel.c
> > +++ b/server/inputs-channel.c
> > @@ -229,8 +229,7 @@ static uint8_t kbd_get_leds(SpiceKbdInstance *sin)
> > return sif->get_leds(sin);
> > }
> >
> > -static RedPipeItem *red_inputs_key_modifiers_item_new(
> > - RedChannelClient *rcc, void *data, int num)
> > +static RedPipeItem *red_inputs_key_modifiers_item_new(void *data, int num)
> > {
> > RedKeyModifiersPipeItem *item =
> > spice_malloc(sizeof(RedKeyModifiersPipeItem));
> >
> > diff --git a/server/main-channel.c b/server/main-channel.c
> > index 7d55de7..0daacdc 100644
> > --- a/server/main-channel.c
> > +++ b/server/main-channel.c
> > @@ -221,7 +221,7 @@ typedef struct MainMouseModeItemInfo {
> > int is_client_mouse_allowed;
> > } MainMouseModeItemInfo;
> >
> > -static RedPipeItem *main_mouse_mode_item_new(RedChannelClient *rcc, void
> > *data, int num)
> > +static RedPipeItem *main_mouse_mode_item_new(void *data, int num)
> > {
> > RedMouseModePipeItem *item =
> > spice_malloc(sizeof(RedMouseModePipeItem));
> > MainMouseModeItemInfo *info = data;
> > @@ -232,7 +232,7 @@ static RedPipeItem
> > *main_mouse_mode_item_new(RedChannelClient *rcc, void *data,
> > return &item->base;
> > }
> >
> > -static RedPipeItem *red_ping_item_new(MainChannelClient *mcc, int size)
> > +static RedPipeItem *red_ping_item_new(int size)
> > {
> > RedPingPipeItem *item = spice_malloc(sizeof(RedPingPipeItem));
> >
> > @@ -241,7 +241,7 @@ static RedPipeItem *red_ping_item_new(MainChannelClient
> > *mcc, int size)
> > return &item->base;
> > }
> >
> > -static RedPipeItem *main_agent_tokens_item_new(RedChannelClient *rcc,
> > uint32_t num_tokens)
> > +static RedPipeItem *main_agent_tokens_item_new(uint32_t num_tokens)
> > {
> > RedTokensPipeItem *item = spice_malloc(sizeof(RedTokensPipeItem));
> >
> > @@ -250,7 +250,7 @@ static RedPipeItem
> > *main_agent_tokens_item_new(RedChannelClient *rcc, uint32_t n
> > return &item->base;
> > }
> >
> > -static RedPipeItem *main_agent_data_item_new(RedChannelClient *rcc,
> > uint8_t*
> > data, size_t len,
> > +static RedPipeItem *main_agent_data_item_new(uint8_t* data, size_t len,
> >
> > spice_marshaller_item_free_func
> > free_data,
> > void *opaque)
> > {
> > @@ -264,10 +264,12 @@ static RedPipeItem
> > *main_agent_data_item_new(RedChannelClient *rcc, uint8_t* dat
> > return &item->base;
> > }
> >
> > -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)
> > +static RedPipeItem *main_init_item_new(int connection_id,
> > + int display_channels_hint,
> > + int current_mouse_mode,
> > + int is_client_mouse_allowed,
> > + int multi_media_time,
> > + int ram_hint)
> > {
> > RedInitPipeItem *item = spice_malloc(sizeof(RedInitPipeItem));
> >
> > @@ -281,7 +283,7 @@ static RedPipeItem *main_init_item_new(MainChannelClient
> > *mcc,
> > return &item->base;
> > }
> >
> > -static RedPipeItem *main_name_item_new(MainChannelClient *mcc, const char
> > *name)
> > +static RedPipeItem *main_name_item_new(const char *name)
> > {
> > RedNamePipeItem *item = spice_malloc(sizeof(RedNamePipeItem) +
> > strlen(name) + 1);
> >
> > @@ -292,7 +294,7 @@ static RedPipeItem *main_name_item_new(MainChannelClient
> > *mcc, const char *name)
> > return &item->base;
> > }
> >
> > -static RedPipeItem *main_uuid_item_new(MainChannelClient *mcc, const
> > uint8_t
> > uuid[16])
> > +static RedPipeItem *main_uuid_item_new(const uint8_t uuid[16])
> > {
> > RedUuidPipeItem *item = spice_malloc(sizeof(RedUuidPipeItem));
> >
> > @@ -302,7 +304,7 @@ static RedPipeItem *main_uuid_item_new(MainChannelClient
> > *mcc, const uint8_t uui
> > return &item->base;
> > }
> >
> > -static RedPipeItem *main_notify_item_new(RedChannelClient *rcc, void *data,
> > int num)
> > +static RedPipeItem *main_notify_item_new(void *data, int num)
> > {
> > RedNotifyPipeItem *item = spice_malloc(sizeof(RedNotifyPipeItem));
> > const char *msg = data;
> > @@ -312,8 +314,7 @@ static RedPipeItem
> > *main_notify_item_new(RedChannelClient
> > *rcc, void *data, int
> > return &item->base;
> > }
> >
> > -static RedPipeItem *main_multi_media_time_item_new(
> > - RedChannelClient *rcc, void *data, int num)
> > +static RedPipeItem *main_multi_media_time_item_new(void *data, int num)
> > {
> > RedMultiMediaTimePipeItem *item, *info = data;
> >
> > @@ -352,7 +353,7 @@ int main_channel_client_push_ping(MainChannelClient
> > *mcc,
> > int size)
> > if (mcc == NULL) {
> > return FALSE;
> > }
> > - item = red_ping_item_new(mcc, size);
> > + item = red_ping_item_new(size);
> > red_channel_client_pipe_add_push(&mcc->base, item);
> > return TRUE;
> > }
> > @@ -442,7 +443,7 @@ static void
> > main_channel_marshall_agent_disconnected(RedChannelClient *rcc,
> >
> > void main_channel_client_push_agent_tokens(MainChannelClient *mcc, uint32_t
> > num_tokens)
> > {
> > - RedPipeItem *item = main_agent_tokens_item_new(&mcc->base, num_tokens);
> > + RedPipeItem *item = main_agent_tokens_item_new(num_tokens);
> >
> > red_channel_client_pipe_add_push(&mcc->base, item);
> > }
> > @@ -462,7 +463,7 @@ void
> > main_channel_client_push_agent_data(MainChannelClient *mcc, uint8_t* data,
> > {
> > RedPipeItem *item;
> >
> > - item = main_agent_data_item_new(&mcc->base, data, len, free_data,
> > opaque);
> > + item = main_agent_data_item_new(data, len, free_data, opaque);
> > red_channel_client_pipe_add_push(&mcc->base, item);
> > }
> >
> > @@ -516,9 +517,9 @@ void main_channel_push_init(MainChannelClient *mcc,
> > {
> > RedPipeItem *item;
> >
> > - item = main_init_item_new(mcc,
> > - mcc->connection_id, display_channels_hint, current_mouse_mode,
> > - is_client_mouse_allowed, multi_media_time, ram_hint);
> > + item = main_init_item_new(mcc->connection_id, display_channels_hint,
> > + current_mouse_mode, is_client_mouse_allowed,
> > + multi_media_time, ram_hint);
> > red_channel_client_pipe_add_push(&mcc->base, item);
> > }
> >
> > @@ -552,7 +553,7 @@ void main_channel_push_name(MainChannelClient *mcc,
> > const
> > char *name)
> > SPICE_MAIN_CAP_NAME_AND_UUID))
> > return;
> >
> > - item = main_name_item_new(mcc, name);
> > + item = main_name_item_new(name);
> > red_channel_client_pipe_add_push(&mcc->base, item);
> > }
> >
> > @@ -564,13 +565,13 @@ void main_channel_push_uuid(MainChannelClient *mcc,
> > const uint8_t uuid[16])
> > SPICE_MAIN_CAP_NAME_AND_UUID))
> > return;
> >
> > - item = main_uuid_item_new(mcc, uuid);
> > + item = main_uuid_item_new(uuid);
> > red_channel_client_pipe_add_push(&mcc->base, item);
> > }
> >
> > void main_channel_client_push_notify(MainChannelClient *mcc, const char
> > *msg)
> > {
> > - RedPipeItem *item = main_notify_item_new(&mcc->base, (void *)msg, 1);
> > + RedPipeItem *item = main_notify_item_new((void *)msg, 1);
> > red_channel_client_pipe_add_push(&mcc->base, item);
> > }
> >
> > diff --git a/server/red-channel.c b/server/red-channel.c
> > index 68500dc..bf1ef2b 100644
> > --- a/server/red-channel.c
> > +++ b/server/red-channel.c
> > @@ -2275,7 +2275,7 @@ static int red_channel_pipes_create_batch(RedChannel
> > *channel,
> >
> > RING_FOREACH_SAFE(link, next, &channel->clients) {
> > rcc = SPICE_CONTAINEROF(link, RedChannelClient, channel_link);
> > - item = (*creator)(rcc, data, num++);
> > + item = (*creator)(data, num++);
> > if (item) {
> > (*pipe_add)(rcc, item);
> > n++;
> > diff --git a/server/red-channel.h b/server/red-channel.h
> > index d169a9a..f7a5148 100644
> > --- a/server/red-channel.h
> > +++ b/server/red-channel.h
> > @@ -468,7 +468,7 @@ void
> > red_channel_client_start_connectivity_monitoring(RedChannelClient *rcc, uin
> > // to the RedPipeItem.
> >
> > // helper to push a new item to all channels
> > -typedef RedPipeItem *(*new_pipe_item_t)(RedChannelClient *rcc, void *data,
> > int num);
> > +typedef RedPipeItem *(*new_pipe_item_t)(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);
>
> I think this e-mail as a TODO on some TODOs.
>
> Frediano
More information about the Spice-devel
mailing list