[Spice-devel] [PATCH spice-server 1/2] event-loop: Move adapter interface from reds.c
Frediano Ziglio
fziglio at redhat.com
Thu Oct 10 09:15:47 UTC 2019
ping
>
> ping
>
> >
> > ping
> >
> > >
> > > ping
> > >
> > > >
> > > > ping
> > > >
> > > > >
> > > > > ping the series
> > > > >
> > > > > >
> > > > > > Put more event loop code in event-loop.c.
> > > > > > This is a preparation patch for the next one.
> > > > > >
> > > > > > Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> > > > > > ---
> > > > > > server/event-loop.c | 58
> > > > > > +++++++++++++++++++++++++++++++++++++++++++++
> > > > > > server/red-common.h | 1 +
> > > > > > server/reds.c | 54 -----------------------------------------
> > > > > > 3 files changed, 59 insertions(+), 54 deletions(-)
> > > > > >
> > > > > > diff --git a/server/event-loop.c b/server/event-loop.c
> > > > > > index 812c3a53b..1ccfd671f 100644
> > > > > > --- a/server/event-loop.c
> > > > > > +++ b/server/event-loop.c
> > > > > > @@ -264,3 +264,61 @@ const SpiceCoreInterfaceInternal
> > > > > > event_loop_core
> > > > > > =
> > > > > > {
> > > > > > .watch_update_mask = watch_update_mask,
> > > > > > .watch_remove = watch_remove,
> > > > > > };
> > > > > > +
> > > > > > +/*
> > > > > > + * Adapter for SpiceCodeInterface
> > > > > > + */
> > > > > > +
> > > > > > +static SpiceTimer *adapter_timer_add(const
> > > > > > SpiceCoreInterfaceInternal
> > > > > > *iface, SpiceTimerFunc func, void *opaque)
> > > > > > +{
> > > > > > + return iface->public_interface->timer_add(func, opaque);
> > > > > > +}
> > > > > > +
> > > > > > +static void adapter_timer_start(const SpiceCoreInterfaceInternal
> > > > > > *iface,
> > > > > > SpiceTimer *timer, uint32_t ms)
> > > > > > +{
> > > > > > + iface->public_interface->timer_start(timer, ms);
> > > > > > +}
> > > > > > +
> > > > > > +static void adapter_timer_cancel(const SpiceCoreInterfaceInternal
> > > > > > *iface,
> > > > > > SpiceTimer *timer)
> > > > > > +{
> > > > > > + iface->public_interface->timer_cancel(timer);
> > > > > > +}
> > > > > > +
> > > > > > +static void adapter_timer_remove(const SpiceCoreInterfaceInternal
> > > > > > *iface,
> > > > > > SpiceTimer *timer)
> > > > > > +{
> > > > > > + iface->public_interface->timer_remove(timer);
> > > > > > +}
> > > > > > +
> > > > > > +static SpiceWatch *adapter_watch_add(const
> > > > > > SpiceCoreInterfaceInternal
> > > > > > *iface,
> > > > > > + int fd, int event_mask,
> > > > > > SpiceWatchFunc
> > > > > > func, void *opaque)
> > > > > > +{
> > > > > > + // note: Qemu API is fine having a SOCKET on Windows
> > > > > > + return iface->public_interface->watch_add(fd, event_mask,
> > > > > > func,
> > > > > > opaque);
> > > > > > +}
> > > > > > +
> > > > > > +static void adapter_watch_update_mask(const
> > > > > > SpiceCoreInterfaceInternal
> > > > > > *iface, SpiceWatch *watch, int event_mask)
> > > > > > +{
> > > > > > + iface->public_interface->watch_update_mask(watch, event_mask);
> > > > > > +}
> > > > > > +
> > > > > > +static void adapter_watch_remove(const SpiceCoreInterfaceInternal
> > > > > > *iface,
> > > > > > SpiceWatch *watch)
> > > > > > +{
> > > > > > + iface->public_interface->watch_remove(watch);
> > > > > > +}
> > > > > > +
> > > > > > +static void adapter_channel_event(const SpiceCoreInterfaceInternal
> > > > > > *iface,
> > > > > > int event, SpiceChannelEventInfo *info)
> > > > > > +{
> > > > > > + if (iface->public_interface->base.minor_version >= 3 &&
> > > > > > iface->public_interface->channel_event != NULL)
> > > > > > + iface->public_interface->channel_event(event, info);
> > > > > > +}
> > > > > > +
> > > > > > +const SpiceCoreInterfaceInternal core_interface_adapter = {
> > > > > > + .timer_add = adapter_timer_add,
> > > > > > + .timer_start = adapter_timer_start,
> > > > > > + .timer_cancel = adapter_timer_cancel,
> > > > > > + .timer_remove = adapter_timer_remove,
> > > > > > + .watch_add = adapter_watch_add,
> > > > > > + .watch_update_mask = adapter_watch_update_mask,
> > > > > > + .watch_remove = adapter_watch_remove,
> > > > > > + .channel_event = adapter_channel_event,
> > > > > > +};
> > > > > > diff --git a/server/red-common.h b/server/red-common.h
> > > > > > index 223f28690..22ea8fc37 100644
> > > > > > --- a/server/red-common.h
> > > > > > +++ b/server/red-common.h
> > > > > > @@ -71,6 +71,7 @@ struct SpiceCoreInterfaceInternal {
> > > > > > };
> > > > > >
> > > > > > extern const SpiceCoreInterfaceInternal event_loop_core;
> > > > > > +extern const SpiceCoreInterfaceInternal core_interface_adapter;
> > > > > >
> > > > > > typedef struct RedsState RedsState;
> > > > > >
> > > > > > diff --git a/server/reds.c b/server/reds.c
> > > > > > index a3795ab90..f432f55a4 100644
> > > > > > --- a/server/reds.c
> > > > > > +++ b/server/reds.c
> > > > > > @@ -83,60 +83,6 @@ static void
> > > > > > reds_client_monitors_config(RedsState
> > > > > > *reds,
> > > > > > VDAgentMonitorsConfig *
> > > > > > static gboolean reds_use_client_monitors_config(RedsState *reds);
> > > > > > static void reds_set_video_codecs(RedsState *reds, GArray
> > > > > > *video_codecs);
> > > > > >
> > > > > > -static SpiceTimer *adapter_timer_add(const
> > > > > > SpiceCoreInterfaceInternal
> > > > > > *iface, SpiceTimerFunc func, void *opaque)
> > > > > > -{
> > > > > > - return iface->public_interface->timer_add(func, opaque);
> > > > > > -}
> > > > > > -
> > > > > > -static void adapter_timer_start(const SpiceCoreInterfaceInternal
> > > > > > *iface,
> > > > > > SpiceTimer *timer, uint32_t ms)
> > > > > > -{
> > > > > > - iface->public_interface->timer_start(timer, ms);
> > > > > > -}
> > > > > > -
> > > > > > -static void adapter_timer_cancel(const SpiceCoreInterfaceInternal
> > > > > > *iface,
> > > > > > SpiceTimer *timer)
> > > > > > -{
> > > > > > - iface->public_interface->timer_cancel(timer);
> > > > > > -}
> > > > > > -
> > > > > > -static void adapter_timer_remove(const SpiceCoreInterfaceInternal
> > > > > > *iface,
> > > > > > SpiceTimer *timer)
> > > > > > -{
> > > > > > - iface->public_interface->timer_remove(timer);
> > > > > > -}
> > > > > > -
> > > > > > -static SpiceWatch *adapter_watch_add(const
> > > > > > SpiceCoreInterfaceInternal
> > > > > > *iface,
> > > > > > - int fd, int event_mask,
> > > > > > SpiceWatchFunc
> > > > > > func, void *opaque)
> > > > > > -{
> > > > > > - // note: Qemu API is fine having a SOCKET on Windows
> > > > > > - return iface->public_interface->watch_add(fd, event_mask,
> > > > > > func,
> > > > > > opaque);
> > > > > > -}
> > > > > > -
> > > > > > -static void adapter_watch_update_mask(const
> > > > > > SpiceCoreInterfaceInternal
> > > > > > *iface, SpiceWatch *watch, int event_mask)
> > > > > > -{
> > > > > > - iface->public_interface->watch_update_mask(watch, event_mask);
> > > > > > -}
> > > > > > -
> > > > > > -static void adapter_watch_remove(const SpiceCoreInterfaceInternal
> > > > > > *iface,
> > > > > > SpiceWatch *watch)
> > > > > > -{
> > > > > > - iface->public_interface->watch_remove(watch);
> > > > > > -}
> > > > > > -
> > > > > > -static void adapter_channel_event(const SpiceCoreInterfaceInternal
> > > > > > *iface,
> > > > > > int event, SpiceChannelEventInfo *info)
> > > > > > -{
> > > > > > - if (iface->public_interface->base.minor_version >= 3 &&
> > > > > > iface->public_interface->channel_event != NULL)
> > > > > > - iface->public_interface->channel_event(event, info);
> > > > > > -}
> > > > > > -
> > > > > > -static const SpiceCoreInterfaceInternal core_interface_adapter = {
> > > > > > - .timer_add = adapter_timer_add,
> > > > > > - .timer_start = adapter_timer_start,
> > > > > > - .timer_cancel = adapter_timer_cancel,
> > > > > > - .timer_remove = adapter_timer_remove,
> > > > > > - .watch_add = adapter_watch_add,
> > > > > > - .watch_update_mask = adapter_watch_update_mask,
> > > > > > - .watch_remove = adapter_watch_remove,
> > > > > > - .channel_event = adapter_channel_event,
> > > > > > -};
> > > > > > -
> > > > > > /* Debugging only variable: allow multiple client connections to
> > > > > > the
> > > > > > spice
> > > > > > * server */
> > > > > > #define SPICE_DEBUG_ALLOW_MC_ENV "SPICE_DEBUG_ALLOW_MC"
More information about the Spice-devel
mailing list