Re: [PATCH 10/19] server: cleanups

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 25, 2015 at 4:27 PM, Frediano Ziglio <fziglio@xxxxxxxxxx> wrote:
> From: Marc-André Lureau <marcandre.lureau@xxxxxxxxx>
>
> ---
>  server/Makefile.am          |  1 -
>  server/dispatcher.h         |  1 +
>  server/display-channel.h    |  1 -
>  server/pixmap-cache.h       |  1 -
>  server/red_dispatcher.c     |  1 -
>  server/red_worker.c         | 14 --------------
>  server/red_worker.h         | 13 ++-----------
>  server/spice_server_utils.h | 41 -----------------------------------------
>  server/utils.h              | 31 ++++++++++++++++++++++++++++++-
>  9 files changed, 33 insertions(+), 71 deletions(-)
>  delete mode 100644 server/spice_server_utils.h
>
> diff --git a/server/Makefile.am b/server/Makefile.am
> index 03ac757..4e4fc6f 100644
> --- a/server/Makefile.am
> +++ b/server/Makefile.am
> @@ -126,7 +126,6 @@ libspice_server_la_SOURCES =                        \
>         zlib_encoder.h                          \
>         spice_bitmap_utils.h            \
>         spice_bitmap_utils.c            \
> -       spice_server_utils.h            \
>         spice_image_cache.h                     \
>         spice_image_cache.c                     \
>         pixmap-cache.h                          \
> diff --git a/server/dispatcher.h b/server/dispatcher.h
> index b774f61..353744a 100644
> --- a/server/dispatcher.h
> +++ b/server/dispatcher.h
> @@ -19,6 +19,7 @@
>  #define DISPATCHER_H
>
>  #include <spice.h>
> +#include "utils.h"
>
>  typedef struct Dispatcher Dispatcher;
>
> diff --git a/server/display-channel.h b/server/display-channel.h
> index 4a79700..5802d9d 100644
> --- a/server/display-channel.h
> +++ b/server/display-channel.h
> @@ -39,7 +39,6 @@
>  #include "main_channel.h"
>  #include "migration_protocol.h"
>  #include "main_dispatcher.h"
> -#include "spice_server_utils.h"
>  #include "spice_bitmap_utils.h"
>  #include "spice_image_cache.h"
>  #include "utils.h"
> diff --git a/server/pixmap-cache.h b/server/pixmap-cache.h
> index a4f6fea..039a4a3 100644
> --- a/server/pixmap-cache.h
> +++ b/server/pixmap-cache.h
> @@ -19,7 +19,6 @@
>  # define _PIXMAP_CACHE_H
>
>  #include "red_channel.h"
> -#include "spice_server_utils.h"
>
>  #define MAX_CACHE_CLIENTS 4
>
> diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c
> index d84869a..a7825f5 100644
> --- a/server/red_dispatcher.c
> +++ b/server/red_dispatcher.c
> @@ -36,7 +36,6 @@
>  #include "reds.h"
>  #include "dispatcher.h"
>  #include "red_parse_qxl.h"
> -#include "spice_server_utils.h"
>
>  #include "red_dispatcher.h"
>
> diff --git a/server/red_worker.c b/server/red_worker.c
> index ac52a8f..ac9bfea 100644
> --- a/server/red_worker.c
> +++ b/server/red_worker.c
> @@ -21,16 +21,6 @@
>
>  #define SPICE_LOG_DOMAIN "SpiceWorker"
>
> -/* Common variable abbreviations:
> - *
> - * rcc - RedChannelClient
> - * ccc - CursorChannelClient (not to be confused with common_cc)
> - * common_cc - CommonChannelClient
> - * dcc - DisplayChannelClient
> - * cursor_red_channel - downcast of CursorChannel to RedChannel
> - * display_red_channel - downcast of DisplayChannel to RedChannel
> - */
> -
>  #include <stdio.h>
>  #include <stdarg.h>
>  #include <fcntl.h>
> @@ -63,10 +53,6 @@
>  #include "cursor-channel.h"
>  #include "tree.h"
>
> -//#define COMPRESS_STAT
> -//#define DUMP_BITMAP
> -//#define COMPRESS_DEBUG
> -
>  #define CMD_RING_POLL_TIMEOUT 10 //milli
>  #define CMD_RING_POLL_RETRIES 200
>
> diff --git a/server/red_worker.h b/server/red_worker.h
> index bbbd523..a76c805 100644
> --- a/server/red_worker.h
> +++ b/server/red_worker.h
> @@ -20,6 +20,7 @@
>
>  #include <unistd.h>
>  #include <errno.h>
> +#include "utils.h"
>  #include "red_common.h"
>  #include "red_dispatcher.h"
>  #include "red_parse_qxl.h"
> @@ -30,7 +31,7 @@ typedef struct CommonChannelClient {
>      RedChannelClient base;
>
>      uint32_t id;
> -    struct RedWorker *worker;
> +    RedWorker *worker;
>      int is_low_bandwidth;
>  } CommonChannelClient;
>
> @@ -79,16 +80,6 @@ static inline void red_pipe_add_verb(RedChannelClient* rcc, uint16_t verb)
>      red_channel_client_pipe_add(rcc, &item->base);
>  }
>
> -/* a generic safe for loop macro  */
> -#define SAFE_FOREACH(link, next, cond, ring, data, get_data)               \
> -    for ((((link) = ((cond) ? ring_get_head(ring) : NULL)), \
> -          ((next) = ((link) ? ring_next((ring), (link)) : NULL)),          \
> -          ((data) = ((link)? (get_data) : NULL)));                         \
> -         (link);                                                           \
> -         (((link) = (next)),                                               \
> -          ((next) = ((link) ? ring_next((ring), (link)) : NULL)),          \
> -          ((data) = ((link)? (get_data) : NULL))))
> -
>  #define LINK_TO_RCC(ptr) SPICE_CONTAINEROF(ptr, RedChannelClient, channel_link)
>  #define RCC_FOREACH_SAFE(link, next, rcc, channel) \
>      SAFE_FOREACH(link, next, channel,  &(channel)->clients, rcc, LINK_TO_RCC(link))
> diff --git a/server/spice_server_utils.h b/server/spice_server_utils.h
> deleted file mode 100644
> index 1f5b7f1..0000000
> --- a/server/spice_server_utils.h
> +++ /dev/null
> @@ -1,41 +0,0 @@
> -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
> -/*
> -   Copyright (C) 2009-2015 Red Hat, Inc.
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 of the License, or (at your option) any later version.
> -
> -   This library is distributed in the hope that it will be useful,
> -   but WITHOUT ANY WARRANTY; without even the implied warranty of
> -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library; if not, see <http://www.gnu.org/licenses/>.
> -*/
> -#ifndef H_SPICE_SERVER_UTIL
> -#define H_SPICE_SERVER_UTIL
> -
> -#include <unistd.h>
> -#include <glib.h>
> -
> -static inline void set_bit(int index, uint32_t *addr)
> -{
> -    uint32_t mask = 1 << index;
> -    __sync_or_and_fetch(addr, mask);
> -}
> -
> -static inline void clear_bit(int index, uint32_t *addr)
> -{
> -    uint32_t mask = ~(1 << index);
> -    __sync_and_and_fetch(addr, mask);
> -}
> -
> -static inline int test_bit(int index, uint32_t val)
> -{
> -    return val & (1u << index);
> -}
> -
> -#endif
> diff --git a/server/utils.h b/server/utils.h
> index 54c6100..aba85f9 100644
> --- a/server/utils.h
> +++ b/server/utils.h
> @@ -18,8 +18,37 @@
>  #ifndef UTILS_H_
>  # define UTILS_H_
>
> +#include <glib.h>
>  #include <time.h>
> -#include <stdint.h>
> +
> +#include "common/ring.h"
> +#include "common/log.h"
> +
> +static inline void set_bit(int index, uint32_t *addr)
> +{
> +    uint32_t mask = 1 << index;
> +    __sync_or_and_fetch(addr, mask);
> +}
> +
> +static inline void clear_bit(int index, uint32_t *addr)
> +{
> +    uint32_t mask = ~(1 << index);
> +    __sync_and_and_fetch(addr, mask);
> +}
> +
> +static inline int test_bit(int index, uint32_t val)
> +{
> +    return val & (1u << index);
> +}
> +/* a generic safe for loop macro  */
> +#define SAFE_FOREACH(link, next, cond, ring, data, get_data)            \
> +    for ((((link) = ((cond) ? ring_get_head(ring) : NULL)),             \
> +          ((next) = ((link) ? ring_next((ring), (link)) : NULL)),       \
> +          ((data) = ((link)? (get_data) : NULL)));                      \
> +         (link);                                                        \
> +         (((link) = (next)),                                            \
> +          ((next) = ((link) ? ring_next((ring), (link)) : NULL)),       \
> +          ((data) = ((link)? (get_data) : NULL))))
>
>  typedef int64_t red_time_t;
>
> --
> 2.4.3
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/spice-devel

Acked-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]