[Spice-devel] [PATCH 08/15] server: misc header cleanups
Frediano Ziglio
fziglio at redhat.com
Thu Dec 3 08:26:59 PST 2015
Signed-off-by: Marc-André Lureau <marcandre.lureau at gmail.com>
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
server/Makefile.am | 3 ++-
server/dcc-encoders.h | 1 -
server/dispatcher.h | 3 +--
server/glz-encoder-dict.c | 1 +
server/glz-encoder-dict.h | 4 ++-
server/glz-encoder-priv.h | 14 +++++++++++
server/glz-encoder.h | 22 +++++++++++++++--
server/glz_encoder_config.h | 59 ---------------------------------------------
server/memslot.c | 1 -
server/red-common.h | 17 ++++++++++---
server/red-dispatcher.h | 2 --
server/red-worker.h | 3 ---
server/reds.c | 1 -
server/reds.h | 2 ++
server/sw-canvas.c | 4 +--
server/sw-canvas.h | 1 +
server/utils.h | 6 ++---
17 files changed, 61 insertions(+), 83 deletions(-)
delete mode 100644 server/glz_encoder_config.h
diff --git a/server/Makefile.am b/server/Makefile.am
index 2bb4fec..d4fc972 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -71,7 +71,6 @@ libspice_server_la_SOURCES = \
demarshallers.h \
glz-encoder.c \
glz-encoder.h \
- glz_encoder_config.h \
glz-encoder-dict.c \
glz-encoder-dict.h \
glz-encoder-priv.h \
@@ -118,6 +117,8 @@ libspice_server_la_SOURCES = \
sw-canvas.h \
sound.c \
sound.h \
+ spice-experimental.h \
+ spice.h \
stat.h \
spicevmc.c \
spice_timer_queue.c \
diff --git a/server/dcc-encoders.h b/server/dcc-encoders.h
index 8f61b52..4e9b66a 100644
--- a/server/dcc-encoders.h
+++ b/server/dcc-encoders.h
@@ -24,7 +24,6 @@
#include "red-channel.h"
#include "red-parse-qxl.h"
#include "image-cache.h"
-#include "glz-encoder-dict.h"
#include "glz-encoder.h"
#include "jpeg-encoder.h"
#ifdef USE_LZ4
diff --git a/server/dispatcher.h b/server/dispatcher.h
index 353744a..78ef663 100644
--- a/server/dispatcher.h
+++ b/server/dispatcher.h
@@ -18,8 +18,7 @@
#ifndef DISPATCHER_H
#define DISPATCHER_H
-#include <spice.h>
-#include "utils.h"
+#include "red-common.h"
typedef struct Dispatcher Dispatcher;
diff --git a/server/glz-encoder-dict.c b/server/glz-encoder-dict.c
index 1fd6753..af74736 100644
--- a/server/glz-encoder-dict.c
+++ b/server/glz-encoder-dict.c
@@ -22,6 +22,7 @@
#include <string.h>
#include <stdio.h>
+#include "glz-encoder.h"
#include "glz-encoder-dict.h"
#include "glz-encoder-priv.h"
diff --git a/server/glz-encoder-dict.h b/server/glz-encoder-dict.h
index 960f165..79b3781 100644
--- a/server/glz-encoder-dict.h
+++ b/server/glz-encoder-dict.h
@@ -19,7 +19,6 @@
#define GLZ_ENCODER_DICT_H_
#include <stdint.h>
-#include "glz_encoder_config.h"
/*
Interface for maintaining lz dictionary that is shared among several encoders.
@@ -30,6 +29,9 @@
typedef void GlzEncDictContext;
typedef void GlzEncDictImageContext;
+typedef void GlzUsrImageContext;
+typedef struct GlzEncoderUsrContext GlzEncoderUsrContext;
+
/* NOTE: DISPLAY_MIGRATE_DATA_VERSION should change in case GlzEncDictRestoreData changes*/
typedef struct GlzEncDictRestoreData {
uint32_t size;
diff --git a/server/glz-encoder-priv.h b/server/glz-encoder-priv.h
index a408966..919c439 100644
--- a/server/glz-encoder-priv.h
+++ b/server/glz-encoder-priv.h
@@ -18,6 +18,8 @@
#ifndef GLZ_ENCODER_PRIV_H_
#define GLZ_ENCODER_PRIV_H_
+#include "red-common.h"
+
/* Interface for using the dictionary for encoding.
Data structures are exposed for the encoder for efficiency
purposes. */
@@ -183,4 +185,16 @@ void glz_dictionary_post_encode(uint32_t encoder_id, GlzEncoderUsrContext *usr,
(dict)->window.encoders_heads[enc_id]].pixels_so_far <= \
ref_seg->pixels_so_far)))
+#ifdef DEBUG
+
+#define GLZ_ASSERT(usr, x) \
+ if (!(x)) (usr)->error(usr, "%s: ASSERT %s failed\n", __FUNCTION__, #x);
+
+#else
+
+#define GLZ_ASSERT(usr, x)
+
+#endif
+
+
#endif // GLZ_ENCODER_PRIV_H_
diff --git a/server/glz-encoder.h b/server/glz-encoder.h
index 93164ed..0493b83 100644
--- a/server/glz-encoder.h
+++ b/server/glz-encoder.h
@@ -20,10 +20,28 @@
/* Manging the lz encoding using a dictionary that is shared among encoders */
-#include <stdint.h>
+#include "red-common.h"
#include "common/lz_common.h"
#include "glz-encoder-dict.h"
-#include "glz_encoder_config.h"
+
+struct GlzEncoderUsrContext {
+ SPICE_GNUC_PRINTF(2, 3) void (*error)(GlzEncoderUsrContext *usr, const char *fmt, ...);
+ SPICE_GNUC_PRINTF(2, 3) void (*warn)(GlzEncoderUsrContext *usr, const char *fmt, ...);
+ SPICE_GNUC_PRINTF(2, 3) void (*info)(GlzEncoderUsrContext *usr, const char *fmt, ...);
+ void *(*malloc)(GlzEncoderUsrContext *usr, int size);
+ void (*free)(GlzEncoderUsrContext *usr, void *ptr);
+
+ // get the next chunk of the image which is entered to the dictionary. If the image is down to
+ // top, return it from the last line to the first one (stride should always be positive)
+ int (*more_lines)(GlzEncoderUsrContext *usr, uint8_t **lines);
+
+ // get the next chunk of the compressed buffer.return number of bytes in the chunk.
+ int (*more_space)(GlzEncoderUsrContext *usr, uint8_t **io_ptr);
+
+ // called when an image is removed from the dictionary, due to the window size limit
+ void (*free_image)(GlzEncoderUsrContext *usr, GlzUsrImageContext *image);
+
+};
typedef void GlzEncoderContext;
diff --git a/server/glz_encoder_config.h b/server/glz_encoder_config.h
deleted file mode 100644
index 6472668..0000000
--- a/server/glz_encoder_config.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- Copyright (C) 2009 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_GLZ_ENCODER_CONFIG
-#define _H_GLZ_ENCODER_CONFIG
-
-#include <spice/macros.h>
-#include "common/lz_common.h"
-
-typedef void GlzUsrImageContext;
-typedef struct GlzEncoderUsrContext GlzEncoderUsrContext;
-
-struct GlzEncoderUsrContext {
- SPICE_GNUC_PRINTF(2, 3) void (*error)(GlzEncoderUsrContext *usr, const char *fmt, ...);
- SPICE_GNUC_PRINTF(2, 3) void (*warn)(GlzEncoderUsrContext *usr, const char *fmt, ...);
- SPICE_GNUC_PRINTF(2, 3) void (*info)(GlzEncoderUsrContext *usr, const char *fmt, ...);
- void *(*malloc)(GlzEncoderUsrContext *usr, int size);
- void (*free)(GlzEncoderUsrContext *usr, void *ptr);
-
- // get the next chunk of the image which is entered to the dictionary. If the image is down to
- // top, return it from the last line to the first one (stride should always be positive)
- int (*more_lines)(GlzEncoderUsrContext *usr, uint8_t **lines);
-
- // get the next chunk of the compressed buffer.return number of bytes in the chunk.
- int (*more_space)(GlzEncoderUsrContext *usr, uint8_t **io_ptr);
-
- // called when an image is removed from the dictionary, due to the window size limit
- void (*free_image)(GlzEncoderUsrContext *usr, GlzUsrImageContext *image);
-
-};
-
-
-#ifdef DEBUG
-
-#define GLZ_ASSERT(usr, x) \
- if (!(x)) (usr)->error(usr, "%s: ASSERT %s failed\n", __FUNCTION__, #x);
-
-#else
-
-#define GLZ_ASSERT(usr, x)
-
-#endif
-
-
-#endif
diff --git a/server/memslot.c b/server/memslot.c
index b8d320e..b7d56e0 100644
--- a/server/memslot.c
+++ b/server/memslot.c
@@ -21,7 +21,6 @@
#include <inttypes.h>
-#include "red-common.h"
#include "memslot.h"
static unsigned long __get_clean_virt(RedMemSlotInfo *info, QXLPHYSICAL addr)
diff --git a/server/red-common.h b/server/red-common.h
index 7f1677e..2d3977b 100644
--- a/server/red-common.h
+++ b/server/red-common.h
@@ -18,15 +18,26 @@
#ifndef _H_RED_COMMON
#define _H_RED_COMMON
-#include <spice/macros.h>
+#include <glib.h>
+
+#include <errno.h>
+#include <stdbool.h>
+#include <stdint.h>
#include <string.h>
+#include <unistd.h>
+#include <spice/macros.h>
+#include "common/log.h"
+#include "common/lz_common.h"
+#include "common/marshaller.h"
#include "common/mem.h"
-#include "common/spice_common.h"
#include "common/messages.h"
-#include "common/lz_common.h"
+#include "common/ring.h"
+#include "common/spice_common.h"
+#include "common/draw.h"
#include "spice.h"
+#include "utils.h"
#define SPICE_GNUC_VISIBLE __attribute__ ((visibility ("default")))
diff --git a/server/red-dispatcher.h b/server/red-dispatcher.h
index d9ee0ec..d99695d 100644
--- a/server/red-dispatcher.h
+++ b/server/red-dispatcher.h
@@ -18,8 +18,6 @@
#ifndef _H_RED_DISPATCHER
#define _H_RED_DISPATCHER
-#include <unistd.h>
-#include <errno.h>
#include "red-channel.h"
typedef struct RedDispatcher RedDispatcher;
diff --git a/server/red-worker.h b/server/red-worker.h
index 710b54c..44f35f7 100644
--- a/server/red-worker.h
+++ b/server/red-worker.h
@@ -18,9 +18,6 @@
#ifndef _H_REDWORKER
#define _H_REDWORKER
-#include <unistd.h>
-#include <errno.h>
-#include "utils.h"
#include "red-common.h"
#include "red-dispatcher.h"
#include "red-parse-qxl.h"
diff --git a/server/reds.c b/server/reds.c
index 7bdf6a6..f3d1b24 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -58,7 +58,6 @@
#include "agent-msg-filter.h"
#include "inputs-channel.h"
#include "main-channel.h"
-#include "red-common.h"
#include "red-dispatcher.h"
#include "main-dispatcher.h"
#include "sound.h"
diff --git a/server/reds.h b/server/reds.h
index 4d1b631..9e4d492 100644
--- a/server/reds.h
+++ b/server/reds.h
@@ -30,6 +30,8 @@
#include "red-channel.h"
#include "migration-protocol.h"
+#define SPICE_GNUC_VISIBLE __attribute__ ((visibility ("default")))
+
struct QXLState {
QXLInterface *qif;
struct RedDispatcher *dispatcher;
diff --git a/server/sw-canvas.c b/server/sw-canvas.c
index 0ef050e..5a8782b 100644
--- a/server/sw-canvas.c
+++ b/server/sw-canvas.c
@@ -1,3 +1,4 @@
+/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
Copyright (C) 2011 Red Hat, Inc.
@@ -17,9 +18,6 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-
-#include "common/spice_common.h"
-
#include "sw-canvas.h"
#define SW_CANVAS_IMAGE_CACHE
#include "common/sw_canvas.c"
diff --git a/server/sw-canvas.h b/server/sw-canvas.h
index 2a037c2..cea8f03 100644
--- a/server/sw-canvas.h
+++ b/server/sw-canvas.h
@@ -1,3 +1,4 @@
+/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
Copyright (C) 2011 Red Hat, Inc.
diff --git a/server/utils.h b/server/utils.h
index aba85f9..d7b9e40 100644
--- a/server/utils.h
+++ b/server/utils.h
@@ -18,11 +18,9 @@
#ifndef UTILS_H_
# define UTILS_H_
-#include <glib.h>
-#include <time.h>
+#include "red-common.h"
-#include "common/ring.h"
-#include "common/log.h"
+#define SPICE_GNUC_VISIBLE __attribute__ ((visibility ("default")))
static inline void set_bit(int index, uint32_t *addr)
{
--
2.4.3
More information about the Spice-devel
mailing list