[Spice-devel] [PATCH 12/18] Remove use of global 'reds' within RedWorker
Frediano Ziglio
fziglio at redhat.com
Tue Feb 16 10:43:53 UTC 2016
>
> On Mon, 2016-02-15 at 16:01 +0000, Frediano Ziglio wrote:
> > From: Jonathon Jongsma <jjongsma at redhat.com>
> >
> > Get the server variable from the RedDispatcher instead of using the
> > global variable
> > ---
> > server/display-channel.c | 1 +
> > server/red-worker.c | 15 +++++++++++----
> > server/red-worker.h | 1 +
> > 3 files changed, 13 insertions(+), 4 deletions(-)
> >
> > diff --git a/server/display-channel.c b/server/display-channel.c
> > index 82dbe03..aa84356 100644
> > --- a/server/display-channel.c
> > +++ b/server/display-channel.c
> > @@ -2030,6 +2030,7 @@ DisplayChannel* display_channel_new(RedWorker
> > *worker, int migrate, int stream_v
> > static SpiceImageSurfacesOps image_surfaces_ops = {
> > image_surfaces_get,
> > };
> > + RedsState *reds = red_worker_get_server(worker);
> >
> > spice_info("create display channel");
> > display = (DisplayChannel *)red_worker_new_channel(
> > diff --git a/server/red-worker.c b/server/red-worker.c
> > index 76e8625..7f07b74 100644
> > --- a/server/red-worker.c
> > +++ b/server/red-worker.c
> > @@ -487,15 +487,16 @@ CommonWorkerChannel
> > *red_worker_new_channel(RedWorker *worker, int size,
> > channel_cbs->alloc_recv_buf = common_alloc_recv_buf;
> > channel_cbs->release_recv_buf = common_release_recv_buf;
> >
> > - channel = red_channel_create_parser(size, reds, &worker->core,
> > - channel_type, worker->qxl-
> > >id,
> > - TRUE /* handle_acks */,
> > + channel = red_channel_create_parser(size,
> > red_worker_get_server(worker),
> > + &worker->core, channel_type,
> > + worker->qxl->id, TRUE /*
> > handle_acks */,
> > spice_get_client_channel_par
> > ser(channel_type, NULL),
> > handle_parsed,
> > channel_cbs,
> > migration_flags);
> > spice_return_val_if_fail(channel, NULL);
> > - red_channel_set_stat_node(channel, stat_add_node(reds, worker-
> > >stat, name, TRUE));
> > + red_channel_set_stat_node(channel,
> > stat_add_node(red_worker_get_server(worker),
> > + worker->stat,
> > name, TRUE));
> >
> > common = (CommonWorkerChannel *)channel;
> > common->qxl = worker->qxl;
> > @@ -1476,6 +1477,7 @@ RedWorker* red_worker_new(QXLInstance *qxl,
> > RedDispatcher *red_dispatcher)
> > RedWorker *worker;
> > Dispatcher *dispatcher;
> > const char *record_filename;
> > + RedsState *reds = red_dispatcher_get_server(red_dispatcher);
> >
> > qxl->st->qif->get_init_info(qxl, &init_info);
> >
> > @@ -1600,3 +1602,8 @@ RedChannel*
> > red_worker_get_display_channel(RedWorker *worker)
> >
> > return RED_CHANNEL(worker->display_channel);
> > }
> > +
> > +RedsState* red_worker_get_server(RedWorker *worker)
> > +{
> > + return red_dispatcher_get_server(worker->red_dispatcher);
> > +}
> > diff --git a/server/red-worker.h b/server/red-worker.h
> > index 8ef8287..f5f51bd 100644
> > --- a/server/red-worker.h
> > +++ b/server/red-worker.h
> > @@ -96,6 +96,7 @@ bool red_worker_run(RedWorker *worker);
> > QXLInstance* red_worker_get_qxl(RedWorker *worker);
> > RedChannel* red_worker_get_cursor_channel(RedWorker *worker);
> > RedChannel* red_worker_get_display_channel(RedWorker *worker);
> > +SpiceServer* red_worker_get_server(RedWorker *worker);
> >
No, strongly disagree on this function made public.
I agree on the function but should be static in the RedWorker code.
Frediano
> > void red_drawable_unref(RedDrawable *red_drawable);
> >
>
> Acked-by: Fabiano Fidêncio <fidencio at redhat.com>
>
More information about the Spice-devel
mailing list