[Spice-devel] [PATCH spice-server 1/2] Use standard "Red" namespace

Frediano Ziglio fziglio at redhat.com
Thu Oct 19 06:19:49 UTC 2017


> 
> The objects RedsStream and RedsSASL are currently using the namespace
> "Reds" rather than the standard "Red" namespace used throughout the rest
> of the project. Change these to be consistent. This also means changing
> method names and some related enumeration types.
> 
> The files were also renamed to reflect the change:
>   reds-stream.[ch] -> red-stream.[ch]
> ---
> 
> Too much code churn?
> 

Not too much worried. I'm more worried about the additional debug code,
streaming and DisplayChannel :-)

> 
>  server/Makefile.am                     |   4 +-
>  server/common-graphics-channel.c       |   4 +-
>  server/cursor-channel-client.c         |   2 +-
>  server/cursor-channel-client.h         |   4 +-
>  server/cursor-channel.c                |   2 +-
>  server/cursor-channel.h                |   2 +-
>  server/dcc-send.c                      |   4 +-
>  server/dcc.c                           |   8 +-
>  server/dcc.h                           |   2 +-
>  server/display-channel.c               |  42 ++++-
>  server/display-channel.h               |   2 +-
>  server/inputs-channel-client.c         |   2 +-
>  server/inputs-channel-client.h         |   2 +-
>  server/inputs-channel.c                |   6 +-
>  server/main-channel-client.c           |   2 +-
>  server/main-channel-client.h           |   2 +-
>  server/main-channel.c                  |   2 +-
>  server/main-channel.h                  |   2 +-
>  server/red-channel-client.c            |  28 ++--
>  server/red-channel-client.h            |   4 +-
>  server/red-channel.c                   |   6 +-
>  server/red-channel.h                   |   6 +-
>  server/red-qxl.c                       |   4 +-
>  server/{reds-stream.c => red-stream.c} | 284
>  ++++++++++++++++-----------------
>  server/red-stream.h                    |  93 +++++++++++
>  server/red-worker.h                    |   4 +-
>  server/reds-private.h                  |   2 +-
>  server/reds-stream.h                   |  93 -----------
>  server/reds.c                          | 162 +++++++++----------
>  server/smartcard-channel-client.c      |   2 +-
>  server/smartcard-channel-client.h      |   2 +-
>  server/smartcard.c                     |   2 +-
>  server/sound.c                         |  10 +-
>  server/spicevmc.c                      |  12 +-
>  server/stream-channel.c                |   4 +-
>  server/stream.c                        |   9 +-
>  server/stream.h                        |   6 +-
>  server/tests/test-channel.c            |   6 +-
>  server/tests/test-stream.c             |  24 +--
>  39 files changed, 449 insertions(+), 408 deletions(-)
>  rename server/{reds-stream.c => red-stream.c} (74%)
>  create mode 100644 server/red-stream.h
>  delete mode 100644 server/reds-stream.h
> 
> diff --git a/server/Makefile.am b/server/Makefile.am
> index e2e3ce861..20f0f1925 100644
> --- a/server/Makefile.am
> +++ b/server/Makefile.am
> @@ -152,8 +152,8 @@ libserver_la_SOURCES =				\
>  	reds.c					\
>  	reds.h					\
>  	reds-private.h				\
> -	reds-stream.c				\
> -	reds-stream.h				\
> +	red-stream.c				\
> +	red-stream.h				\
>  	red-worker.c				\
>  	red-worker.h				\
>  	sound.c					\
> diff --git a/server/common-graphics-channel.c
> b/server/common-graphics-channel.c
> index 0cbc2762c..ce6b5e57c 100644
> --- a/server/common-graphics-channel.c
> +++ b/server/common-graphics-channel.c
> @@ -78,7 +78,7 @@ bool common_channel_client_config_socket(RedChannelClient
> *rcc)
>  {
>      RedClient *client = red_channel_client_get_client(rcc);
>      MainChannelClient *mcc = red_client_get_main(client);
> -    RedsStream *stream = red_channel_client_get_stream(rcc);
> +    RedStream *stream = red_channel_client_get_stream(rcc);
>      gboolean is_low_bandwidth;
>  
>      // TODO - this should be dynamic, not one time at channel creation
> @@ -89,7 +89,7 @@ bool common_channel_client_config_socket(RedChannelClient
> *rcc)
>       * the application level.
>       * see: http://www.stuartcheshire.org/papers/NagleDelayedAck/
>       */
> -    reds_stream_set_no_delay(stream, !is_low_bandwidth);
> +    red_stream_set_no_delay(stream, !is_low_bandwidth);
>  
>      // TODO: move wide/narrow ack setting to red_channel.
>      red_channel_client_ack_set_client_window(rcc,
> diff --git a/server/cursor-channel-client.c b/server/cursor-channel-client.c
> index 42ab5d763..6d39e24ed 100644
> --- a/server/cursor-channel-client.c
> +++ b/server/cursor-channel-client.c
> @@ -97,7 +97,7 @@ void cursor_channel_client_migrate(RedChannelClient *rcc)
>      red_channel_client_default_migrate(rcc);
>  }
>  
> -CursorChannelClient* cursor_channel_client_new(CursorChannel *cursor,
> RedClient *client, RedsStream *stream,
> +CursorChannelClient* cursor_channel_client_new(CursorChannel *cursor,
> RedClient *client, RedStream *stream,
>                                                 int mig_target,
>                                                 RedChannelCapabilities *caps)
>  {
> diff --git a/server/cursor-channel-client.h b/server/cursor-channel-client.h
> index dc69369f5..56b3b312e 100644
> --- a/server/cursor-channel-client.h
> +++ b/server/cursor-channel-client.h
> @@ -24,7 +24,7 @@
>  #include "cache-item.h"
>  #include "red-common.h"
>  #include "red-channel-client.h"
> -#include "reds-stream.h"
> +#include "red-stream.h"
>  #include "cursor-channel.h"
>  
>  G_BEGIN_DECLS
> @@ -61,7 +61,7 @@ GType cursor_channel_client_get_type(void) G_GNUC_CONST;
>  
>  CursorChannelClient* cursor_channel_client_new(CursorChannel *cursor,
>                                                 RedClient *client,
> -                                               RedsStream *stream,
> +                                               RedStream *stream,
>                                                 int mig_target,
>                                                 RedChannelCapabilities
>                                                 *caps);
>  
> diff --git a/server/cursor-channel.c b/server/cursor-channel.c
> index 9ae76090f..522261e3f 100644
> --- a/server/cursor-channel.c
> +++ b/server/cursor-channel.c
> @@ -338,7 +338,7 @@ void cursor_channel_set_mouse_mode(CursorChannel *cursor,
> uint32_t mode)
>      cursor->mouse_mode = mode;
>  }
>  
> -void cursor_channel_connect(CursorChannel *cursor, RedClient *client,
> RedsStream *stream,
> +void cursor_channel_connect(CursorChannel *cursor, RedClient *client,
> RedStream *stream,
>                              int migrate,
>                              RedChannelCapabilities *caps)
>  {
> diff --git a/server/cursor-channel.h b/server/cursor-channel.h
> index 50cf71f16..603c2c0ac 100644
> --- a/server/cursor-channel.h
> +++ b/server/cursor-channel.h
> @@ -70,7 +70,7 @@ void
> cursor_channel_set_mouse_mode(CursorChannel *cursor, uint32
>   * See comment on cursor_channel_new.
>   */
>  void                 cursor_channel_connect     (CursorChannel *cursor,
>  RedClient *client,
> -                                                 RedsStream *stream,
> +                                                 RedStream *stream,
>                                                   int migrate,
>                                                   RedChannelCapabilities
>                                                   *caps);
>  
> diff --git a/server/dcc-send.c b/server/dcc-send.c
> index 8692cff2c..d3c4559b0 100644
> --- a/server/dcc-send.c
> +++ b/server/dcc-send.c
> @@ -438,7 +438,7 @@ static FillBitsType fill_bits(DisplayChannelClient *dcc,
> SpiceMarshaller *m,
>          /* Images must be added to the cache only after they are compressed
>             in order to prevent starvation in the client between pixmap_cache
>             and
>             global dictionary (in cases of multiple monitors) */
> -        if (reds_stream_get_family(red_channel_client_get_stream(rcc)) ==
> AF_UNIX ||
> +        if (red_stream_get_family(red_channel_client_get_stream(rcc)) ==
> AF_UNIX ||
>              !dcc_compress_image(dcc, &image, &simage->u.bitmap,
>                                  drawable, can_lossy, &comp_send_data)) {
>              SpicePalette *palette;
> @@ -2155,6 +2155,7 @@ static void marshall_stream_start(RedChannelClient
> *rcc,
>      DisplayChannelClient *dcc = DISPLAY_CHANNEL_CLIENT(rcc);
>      Stream *stream = agent->stream;
>  
> +    spice_debug("stream start");
>      spice_assert(stream);
>      if (!agent->video_encoder) {
>          /* Without a video encoder nothing will be streamed */
> @@ -2214,6 +2215,7 @@ static void marshall_stream_end(RedChannelClient *rcc,
>      DisplayChannelClient *dcc = DISPLAY_CHANNEL_CLIENT(rcc);
>      SpiceMsgDisplayStreamDestroy destroy;
>  
> +    spice_debug("stream end");
>      red_channel_client_init_send_data(rcc,
>      SPICE_MSG_DISPLAY_STREAM_DESTROY);
>      destroy.id = display_channel_get_stream_id(DCC_TO_DC(dcc),
>      agent->stream);
>      stream_agent_stop(agent);

like this

... omissis ...

Frediano


More information about the Spice-devel mailing list