[Spice-devel] [PATCH 13/18] Add red_channel_get_server()
Fabiano Fidêncio
ffidenci at redhat.com
Mon Feb 15 23:07:58 UTC 2016
On Mon, 2016-02-15 at 16:01 +0000, Frediano Ziglio wrote:
> From: Jonathon Jongsma <jjongsma at redhat.com>
>
> Instead of poking into the internals of the RedChannel, provide an
> accessor.
> ---
> server/inputs-channel.c | 4 ++--
> server/main-channel.c | 2 +-
> server/red-channel.c | 5 +++++
> server/red-channel.h | 5 +++--
> 4 files changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/server/inputs-channel.c b/server/inputs-channel.c
> index bb1c5ea..677d071 100644
> --- a/server/inputs-channel.c
> +++ b/server/inputs-channel.c
> @@ -305,7 +305,7 @@ static int
> inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, ui
> InputsChannel *inputs_channel = (InputsChannel *)rcc->channel;
> InputsChannelClient *icc = (InputsChannelClient *)rcc;
> uint32_t i;
> - RedsState *reds = inputs_channel->base.reds;
> + RedsState *reds =
> red_channel_get_server((RedChannel*)inputs_channel);
>
> switch (type) {
> case SPICE_MSGC_INPUTS_KEY_DOWN: {
> @@ -676,7 +676,7 @@ int inputs_channel_set_keyboard(InputsChannel
> *inputs, SpiceKbdInstance *keyboar
> return -1;
> }
> inputs->keyboard = keyboard;
> - inputs->keyboard->st = spice_kbd_state_new(inputs->base.reds);
> + inputs->keyboard->st =
> spice_kbd_state_new(red_channel_get_server((RedChannel*)inputs));
> return 0;
> }
>
> diff --git a/server/main-channel.c b/server/main-channel.c
> index f2b9fd7..6ea47cf 100644
> --- a/server/main-channel.c
> +++ b/server/main-channel.c
> @@ -1088,7 +1088,7 @@ static MainChannelClient
> *main_channel_client_create(MainChannel *main_chan, Red
> mcc->connection_id = connection_id;
> mcc->bitrate_per_sec = ~0;
> #ifdef RED_STATISTICS
> - core = reds_get_core_interface(main_chan->base.reds);
> + core =
> reds_get_core_interface(red_channel_get_server((RedChannel*)main_chan
> ));
> if (!(mcc->ping_timer = core->timer_add(core, ping_timer_cb,
> NULL))) {
> spice_error("ping timer create failed");
> }
> diff --git a/server/red-channel.c b/server/red-channel.c
> index d614955..757bb6e 100644
> --- a/server/red-channel.c
> +++ b/server/red-channel.c
> @@ -2453,3 +2453,8 @@ void
> red_channel_client_disconnect_if_pending_send(RedChannelClient *rcc)
> spice_assert(red_channel_client_no_item_being_sent(rcc));
> }
> }
> +
> +RedsState* red_channel_get_server(RedChannel *channel)
> +{
> + return channel->reds;
> +}
> diff --git a/server/red-channel.h b/server/red-channel.h
> index 26bd3f9..2d61bc5 100644
> --- a/server/red-channel.h
> +++ b/server/red-channel.h
> @@ -47,6 +47,8 @@
> The intention is to move towards one channel interface gradually.
> At the final stage, this interface shouldn't be exposed. Only
> RedChannel will use it. */
>
> +struct RedsState;
> +
> typedef struct SpiceDataHeaderOpaque SpiceDataHeaderOpaque;
>
> typedef uint16_t (*get_msg_type_proc)(SpiceDataHeaderOpaque
> *header);
> @@ -565,8 +567,7 @@ uint32_t red_channel_sum_pipes_size(RedChannel
> *channel);
> typedef void (*channel_client_callback)(RedChannelClient *rcc);
> typedef void (*channel_client_callback_data)(RedChannelClient *rcc,
> void *data);
> void red_channel_apply_clients(RedChannel *channel,
> channel_client_callback v);
> -
> -struct RedsState;
> +struct RedsState* red_channel_get_server(RedChannel *channel);
>
> struct RedClient {
> struct RedsState *reds;
Acked-by: Fabiano Fidêncio <fidencio at redhat.com>
More information about the Spice-devel
mailing list