mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-07 05:57:20 +00:00
server: cleanups
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
This commit is contained in:
parent
5c93b2b4d2
commit
d793473e5e
@ -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 \
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
#define DISPATCHER_H
|
||||
|
||||
#include <spice.h>
|
||||
#include "utils.h"
|
||||
|
||||
typedef struct Dispatcher Dispatcher;
|
||||
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -19,7 +19,6 @@
|
||||
# define _PIXMAP_CACHE_H
|
||||
|
||||
#include "red_channel.h"
|
||||
#include "spice_server_utils.h"
|
||||
|
||||
#define MAX_CACHE_CLIENTS 4
|
||||
|
||||
|
||||
@ -36,7 +36,6 @@
|
||||
#include "reds.h"
|
||||
#include "dispatcher.h"
|
||||
#include "red_parse_qxl.h"
|
||||
#include "spice_server_utils.h"
|
||||
|
||||
#include "red_dispatcher.h"
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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))
|
||||
|
||||
@ -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
|
||||
@ -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;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user