[Spice-devel] [PATCH EXP 3/3] try to minimize header dependencies

Frediano Ziglio fziglio at redhat.com
Mon May 9 10:51:22 UTC 2016


Different headers changes:
- order headers:
  - system/no-spice library includes;
  - spice-common/spice-protocol;
  - spice-server;
- every header must be auto sufficient;
- use definition include only if necessary.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/agent-msg-filter.h       |  9 ++++++---
 server/cache-item.h             |  2 +-
 server/char-device.h            |  3 +--
 server/cursor-channel.h         |  3 ---
 server/dcc-encoders.h           | 42 +++++++++++++++++++++++------------------
 server/dcc-send.c               |  8 +++++---
 server/dcc.c                    |  2 ++
 server/dcc.h                    | 10 ++++++----
 server/demarshallers.h          |  3 +++
 server/dispatcher.c             |  1 +
 server/dispatcher.h             |  2 +-
 server/display-channel.c        |  3 +++
 server/display-channel.h        | 24 ++---------------------
 server/glz-encoder-priv.h       |  4 +++-
 server/glz-encoder.h            |  1 -
 server/inputs-channel.h         |  2 ++
 server/main-dispatcher.h        |  1 -
 server/memslot.c                |  3 +--
 server/memslot.h                |  2 --
 server/migration-protocol.h     |  2 ++
 server/pixmap-cache.c           |  1 +
 server/pixmap-cache.h           | 10 +++++++---
 server/red-channel.h            |  4 +---
 server/red-parse-qxl.h          |  9 ++++++---
 server/red-pipe-item.h          |  1 +
 server/red-qxl.h                |  1 -
 server/red-record-qxl.h         |  7 ++++---
 server/red-replay-qxl.h         |  3 ++-
 server/red-worker.c             |  3 +++
 server/red-worker.h             |  3 +--
 server/reds-private.h           |  5 +++++
 server/reds-stream.h            |  8 ++------
 server/reds.h                   |  6 ++----
 server/smartcard.h              |  2 ++
 server/sound.h                  |  6 ++++--
 server/spice-bitmap-utils.h     |  5 ++++-
 server/stat.h                   |  1 +
 server/stream.c                 |  2 ++
 server/stream.h                 |  4 ++--
 server/tests/replay.c           |  1 +
 server/tests/test-qxl-parsing.c |  1 +
 server/tree.h                   |  3 ++-
 server/utils.h                  |  3 ++-
 server/video-encoder.h          |  3 +++
 server/zlib-encoder.h           |  2 ++
 45 files changed, 124 insertions(+), 97 deletions(-)

diff --git a/server/agent-msg-filter.h b/server/agent-msg-filter.h
index 836ddbd..e7eef1a 100644
--- a/server/agent-msg-filter.h
+++ b/server/agent-msg-filter.h
@@ -21,6 +21,9 @@
 #ifndef _H_AGENT_MSG_FILTER
 #define _H_AGENT_MSG_FILTER
 
+#include <inttypes.h>
+#include <glib.h>
+
 /* Possible return values for agent_msg_filter_process_data */
 enum {
     AGENT_MSG_FILTER_OK,
@@ -39,14 +42,14 @@ typedef struct AgentMsgFilter {
     gboolean discard_all;
 } AgentMsgFilter;
 
-void agent_msg_filter_init(struct AgentMsgFilter *filter,
+void agent_msg_filter_init(AgentMsgFilter *filter,
                            gboolean copy_paste, gboolean file_xfer,
                            gboolean use_client_monitors_config,
                            gboolean discard_all);
-void agent_msg_filter_config(struct AgentMsgFilter *filter,
+void agent_msg_filter_config(AgentMsgFilter *filter,
                              gboolean copy_paste, gboolean file_xfer,
                              gboolean use_client_monitors_config);
-int agent_msg_filter_process_data(struct AgentMsgFilter *filter,
+int agent_msg_filter_process_data(AgentMsgFilter *filter,
                                   uint8_t *data, uint32_t len);
 
 #endif
diff --git a/server/cache-item.h b/server/cache-item.h
index f72c0ff..f13a69a 100644
--- a/server/cache-item.h
+++ b/server/cache-item.h
@@ -18,8 +18,8 @@
 #ifndef CACHE_ITEM_H_
 # define CACHE_ITEM_H_
 
-#include "red-channel.h"
 #include <common/ring.h>
+#include "red-pipe-item.h"
 
 typedef struct RedCacheItem RedCacheItem;
 
diff --git a/server/char-device.h b/server/char-device.h
index d05b1fd..0dec86a 100644
--- a/server/char-device.h
+++ b/server/char-device.h
@@ -20,9 +20,8 @@
 
 #include <glib-object.h>
 
-#include "spice.h"
-#include "red-channel.h"
 #include "migration-protocol.h"
+#include "red-channel.h"
 
 #define RED_TYPE_CHAR_DEVICE red_char_device_get_type()
 
diff --git a/server/cursor-channel.h b/server/cursor-channel.h
index 4dad4b6..3b56824 100644
--- a/server/cursor-channel.h
+++ b/server/cursor-channel.h
@@ -18,10 +18,7 @@
 #ifndef CURSOR_CHANNEL_H_
 # define CURSOR_CHANNEL_H_
 
-#include "spice.h"
-#include "reds.h"
 #include "red-worker.h"
-#include "red-parse-qxl.h"
 
 typedef struct CursorChannel CursorChannel;
 typedef struct CursorChannelClient CursorChannelClient;
diff --git a/server/dcc-encoders.h b/server/dcc-encoders.h
index 14759c5..5f2f519 100644
--- a/server/dcc-encoders.h
+++ b/server/dcc-encoders.h
@@ -19,11 +19,13 @@
 #define DCC_ENCODERS_H_
 
 #include <setjmp.h>
+
 #include <common/marshaller.h>
 #include <common/quic.h>
-#include "red-channel.h"
+#include <common/lz.h>
+#include <common/ring.h>
+
 #include "red-parse-qxl.h"
-#include "image-cache.h"
 #include "glz-encoder.h"
 #include "jpeg-encoder.h"
 #ifdef USE_LZ4
@@ -31,21 +33,25 @@
 #endif
 #include "zlib-encoder.h"
 
+struct RedClient;
+struct Drawable;
+struct DisplayChannelClient;
+
 typedef struct RedCompressBuf RedCompressBuf;
 typedef struct GlzDrawableInstanceItem GlzDrawableInstanceItem;
 typedef struct RedGlzDrawable RedGlzDrawable;
 
-void             dcc_encoders_init                           (DisplayChannelClient *dcc);
-void             dcc_encoders_free                           (DisplayChannelClient *dcc);
-void             dcc_free_glz_drawable_instance              (DisplayChannelClient *dcc,
+void             dcc_encoders_init                           (struct DisplayChannelClient *dcc);
+void             dcc_encoders_free                           (struct DisplayChannelClient *dcc);
+void             dcc_free_glz_drawable_instance              (struct DisplayChannelClient *dcc,
                                                               GlzDrawableInstanceItem *item);
-void             dcc_free_glz_drawable                       (DisplayChannelClient *dcc,
+void             dcc_free_glz_drawable                       (struct DisplayChannelClient *dcc,
                                                               RedGlzDrawable *drawable);
-int              dcc_free_some_independent_glz_drawables     (DisplayChannelClient *dcc);
-void             dcc_free_glz_drawables                      (DisplayChannelClient *dcc);
-void             dcc_free_glz_drawables_to_free              (DisplayChannelClient* dcc);
-void             dcc_freeze_glz                              (DisplayChannelClient *dcc);
-void             dcc_release_glz                             (DisplayChannelClient *dcc);
+int              dcc_free_some_independent_glz_drawables     (struct DisplayChannelClient *dcc);
+void             dcc_free_glz_drawables                      (struct DisplayChannelClient *dcc);
+void             dcc_free_glz_drawables_to_free              (struct DisplayChannelClient* dcc);
+void             dcc_freeze_glz                              (struct DisplayChannelClient *dcc);
+void             dcc_release_glz                             (struct DisplayChannelClient *dcc);
 
 void             marshaller_add_compressed                   (SpiceMarshaller *m,
                                                               RedCompressBuf *comp_buf,
@@ -71,17 +77,17 @@ typedef struct GlzSharedDictionary {
     uint8_t id;
     pthread_rwlock_t encode_lock;
     int migrate_freeze;
-    RedClient *client; // channel clients of the same client share the dict
+    struct RedClient *client; // channel clients of the same client share the dict
 } GlzSharedDictionary;
 
-GlzSharedDictionary* dcc_get_glz_dictionary                  (DisplayChannelClient *dcc,
+GlzSharedDictionary* dcc_get_glz_dictionary                  (struct DisplayChannelClient *dcc,
                                                               uint8_t id, int window_size);
-GlzSharedDictionary* dcc_restore_glz_dictionary              (DisplayChannelClient *dcc,
+GlzSharedDictionary* dcc_restore_glz_dictionary              (struct DisplayChannelClient *dcc,
                                                               uint8_t id,
                                                               GlzEncDictRestoreData *restore_data);
 
 typedef struct  {
-    DisplayChannelClient *dcc;
+    struct DisplayChannelClient *dcc;
     RedCompressBuf *bufs_head;
     RedCompressBuf *bufs_tail;
     jmp_buf jmp_env;
@@ -100,7 +106,7 @@ typedef struct  {
     char message_buf[512];
 } EncoderData;
 
-void encoder_data_init(EncoderData *data, DisplayChannelClient *dcc);
+void encoder_data_init(EncoderData *data, struct DisplayChannelClient *dcc);
 void encoder_data_reset(EncoderData *data);
 
 typedef struct {
@@ -155,11 +161,11 @@ struct RedGlzDrawable {
     RingItem link;    // ordered by the time it was encoded
     RingItem drawable_link;
     RedDrawable *red_drawable;
-    Drawable    *drawable;
+    struct Drawable    *drawable;
     GlzDrawableInstanceItem instances_pool[MAX_GLZ_DRAWABLE_INSTANCES];
     Ring instances;
     uint8_t instances_count;
-    DisplayChannelClient *dcc;
+    struct DisplayChannelClient *dcc;
 };
 
 #define RED_RELEASE_BUNCH_SIZE 64
diff --git a/server/dcc-send.c b/server/dcc-send.c
index 5f967cc..67e505c 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -19,12 +19,14 @@
 #include <config.h>
 #endif
 
-#include "dcc.h"
-#include "display-channel.h"
-
 #include <common/marshaller.h>
 #include <common/generated_server_marshallers.h>
 
+#include "reds.h"
+#include "dcc.h"
+#include "display-channel.h"
+#include "cache-item.h"
+
 typedef enum {
     FILL_BITS_TYPE_INVALID,
     FILL_BITS_TYPE_CACHE,
diff --git a/server/dcc.c b/server/dcc.c
index db77cc7..a73d9b9 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -21,6 +21,8 @@
 
 #include "dcc.h"
 #include "display-channel.h"
+#include "migration-protocol.h"
+#include "cache-item.h"
 
 #define DISPLAY_CLIENT_SHORT_TIMEOUT 15000000000ULL //nano
 
diff --git a/server/dcc.h b/server/dcc.h
index 1dd53bd..9d0b554 100644
--- a/server/dcc.h
+++ b/server/dcc.h
@@ -18,12 +18,12 @@
 #ifndef DCC_H_
 # define DCC_H_
 
-#include "red-worker.h"
+#include "image-cache.h"
 #include "pixmap-cache.h"
-#include "cache-item.h"
+#include "display-limits.h"
+#include "red-worker.h"
 #include "dcc-encoders.h"
 #include "stream.h"
-#include "display-limits.h"
 
 #define PALETTE_CACHE_HASH_SHIFT 8
 #define PALETTE_CACHE_HASH_SIZE (1 << PALETTE_CACHE_HASH_SHIFT)
@@ -42,6 +42,8 @@
 
 #define MAX_PIPE_SIZE 50
 
+struct RedCacheItem;
+
 typedef struct WaitForChannels {
     SpiceMsgWaitForChannels header;
     SpiceWaitForChannel buf[MAX_CACHE_CLIENTS];
@@ -82,7 +84,7 @@ struct DisplayChannelClient {
     uint32_t pixmap_cache_generation;
     int pending_pixmaps_sync;
 
-    RedCacheItem *palette_cache[PALETTE_CACHE_HASH_SIZE];
+    struct RedCacheItem *palette_cache[PALETTE_CACHE_HASH_SIZE];
     Ring palette_cache_lru;
     long palette_cache_available;
     uint32_t palette_cache_items;
diff --git a/server/demarshallers.h b/server/demarshallers.h
index c3d770d..dc35645 100644
--- a/server/demarshallers.h
+++ b/server/demarshallers.h
@@ -17,6 +17,9 @@
 #ifndef _H_DEMARSHAL
 #define _H_DEMARSHAL
 
+#include <stddef.h>
+#include <inttypes.h>
+
 typedef void (*message_destructor_t)(uint8_t *message);
 typedef uint8_t * (*spice_parse_channel_func_t)(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor,
                                                 size_t *size_out, message_destructor_t *free_message);
diff --git a/server/dispatcher.c b/server/dispatcher.c
index b9e23f6..96dccb8 100644
--- a/server/dispatcher.c
+++ b/server/dispatcher.c
@@ -30,6 +30,7 @@
 
 #include <common/mem.h>
 #include <common/spice_common.h>
+#include "red-common.h"
 #include "dispatcher.h"
 
 //#define DEBUG_DISPATCHER
diff --git a/server/dispatcher.h b/server/dispatcher.h
index caaebc5..b187a0e 100644
--- a/server/dispatcher.h
+++ b/server/dispatcher.h
@@ -18,8 +18,8 @@
 #ifndef DISPATCHER_H
 #define DISPATCHER_H
 
+#include <inttypes.h>
 #include <glib-object.h>
-#include "red-common.h"
 
 #define TYPE_DISPATCHER dispatcher_get_type()
 
diff --git a/server/display-channel.c b/server/display-channel.c
index 1f4d66f..245f241 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -18,7 +18,10 @@
 #include <config.h>
 #endif
 
+#include <common/sw_canvas.h>
+
 #include "display-channel.h"
+#include "reds.h"
 
 static void drawable_draw(DisplayChannel *display, Drawable *drawable);
 
diff --git a/server/display-channel.h b/server/display-channel.h
index 1d20be0..efb0b44 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -21,32 +21,12 @@
 #include <setjmp.h>
 
 #include <common/rect.h>
-#include <common/sw_canvas.h>
-
-#include "red-worker.h"
-#include "reds-stream.h"
-#include "cache-item.h"
-#include "pixmap-cache.h"
-#include "stat.h"
-#include "reds.h"
-#include "memslot.h"
-#include "red-parse-qxl.h"
-#include "red-record-qxl.h"
-#include "demarshallers.h"
-#include "red-channel.h"
-#include "red-qxl.h"
-#include "dispatcher.h"
-#include "main-channel.h"
-#include "migration-protocol.h"
-#include "main-dispatcher.h"
+
 #include "spice-bitmap-utils.h"
-#include "image-cache.h"
-#include "utils.h"
 #include "tree.h"
+#include "red-channel.h"
 #include "stream.h"
 #include "dcc.h"
-#include "display-limits.h"
-
 
 typedef struct DependItem {
     Drawable *drawable;
diff --git a/server/glz-encoder-priv.h b/server/glz-encoder-priv.h
index 919c439..1c76576 100644
--- a/server/glz-encoder-priv.h
+++ b/server/glz-encoder-priv.h
@@ -18,7 +18,9 @@
 #ifndef GLZ_ENCODER_PRIV_H_
 #define GLZ_ENCODER_PRIV_H_
 
-#include "red-common.h"
+#include <pthread.h>
+#include <common/lz_common.h>
+#include "glz-encoder-dict.h"
 
 /* Interface for using the dictionary for encoding.
    Data structures are exposed for the encoder for efficiency
diff --git a/server/glz-encoder.h b/server/glz-encoder.h
index 6f4f44d..6a597d7 100644
--- a/server/glz-encoder.h
+++ b/server/glz-encoder.h
@@ -20,7 +20,6 @@
 
 /* Manging the lz encoding using a dictionary that is shared among encoders */
 
-#include "red-common.h"
 #include <common/lz_common.h>
 #include "glz-encoder-dict.h"
 
diff --git a/server/inputs-channel.h b/server/inputs-channel.h
index fce757f..9213aec 100644
--- a/server/inputs-channel.h
+++ b/server/inputs-channel.h
@@ -24,6 +24,8 @@
 #include <stdint.h>
 #include <spice/vd_agent.h>
 
+#include "red-channel.h"
+
 typedef struct InputsChannel InputsChannel;
 
 InputsChannel* inputs_channel_new(RedsState *reds);
diff --git a/server/main-dispatcher.h b/server/main-dispatcher.h
index ffe82c8..3e9d9de 100644
--- a/server/main-dispatcher.h
+++ b/server/main-dispatcher.h
@@ -18,7 +18,6 @@
 #ifndef MAIN_DISPATCHER_H
 #define MAIN_DISPATCHER_H
 
-#include <spice.h>
 #include "dispatcher.h"
 #include "red-channel.h"
 
diff --git a/server/memslot.c b/server/memslot.c
index 99c63e4..0881f86 100644
--- a/server/memslot.c
+++ b/server/memslot.c
@@ -19,8 +19,7 @@
 #include <config.h>
 #endif
 
-#include <inttypes.h>
-
+#include "red-common.h"
 #include "memslot.h"
 
 static unsigned long __get_clean_virt(RedMemSlotInfo *info, QXLPHYSICAL addr)
diff --git a/server/memslot.h b/server/memslot.h
index 0caa627..c4aa8c6 100644
--- a/server/memslot.h
+++ b/server/memslot.h
@@ -19,8 +19,6 @@
 #ifndef MEMSLOT_H_
 #define MEMSLOT_H_
 
-#include "red-common.h"
-
 #include <spice/qxl_dev.h>
 
 typedef struct MemSlot {
diff --git a/server/migration-protocol.h b/server/migration-protocol.h
index c1d97ef..3f08150 100644
--- a/server/migration-protocol.h
+++ b/server/migration-protocol.h
@@ -20,6 +20,8 @@
 
 #include <spice/macros.h>
 #include <spice/vd_agent.h>
+#include <common/log.h>
+
 #include "glz-encoder-dict.h"
 
 /* ************************************************
diff --git a/server/pixmap-cache.c b/server/pixmap-cache.c
index a485268..12081ac 100644
--- a/server/pixmap-cache.c
+++ b/server/pixmap-cache.c
@@ -18,6 +18,7 @@
 #include <config.h>
 #endif
 
+#include "red-channel.h"
 #include "pixmap-cache.h"
 
 int pixmap_cache_unlocked_set_lossy(PixmapCache *cache, uint64_t id, int lossy)
diff --git a/server/pixmap-cache.h b/server/pixmap-cache.h
index 66658f3..6bce986 100644
--- a/server/pixmap-cache.h
+++ b/server/pixmap-cache.h
@@ -18,7 +18,9 @@
 #ifndef _PIXMAP_CACHE_H
 # define _PIXMAP_CACHE_H
 
-#include "red-channel.h"
+#include <stddef.h>
+#include <inttypes.h>
+#include <common/ring.h>
 
 #define MAX_CACHE_CLIENTS 4
 
@@ -27,6 +29,8 @@
 #define BITS_CACHE_HASH_MASK (BITS_CACHE_HASH_SIZE - 1)
 #define BITS_CACHE_HASH_KEY(id) ((id) & BITS_CACHE_HASH_MASK)
 
+struct RedClient;
+
 typedef struct PixmapCache PixmapCache;
 typedef struct NewCacheItem NewCacheItem;
 
@@ -61,10 +65,10 @@ struct PixmapCache {
     } generation_initiator;
     uint64_t sync[MAX_CACHE_CLIENTS]; // here CLIENTS refer to different channel
                                       // clients of the same client
-    RedClient *client;
+    struct RedClient *client;
 };
 
-PixmapCache *pixmap_cache_get(RedClient *client, uint8_t id, int64_t size);
+PixmapCache *pixmap_cache_get(struct RedClient *client, uint8_t id, int64_t size);
 void         pixmap_cache_unref(PixmapCache *cache);
 void         pixmap_cache_clear(PixmapCache *cache);
 int          pixmap_cache_unlocked_set_lossy(PixmapCache *cache, uint64_t id, int lossy);
diff --git a/server/red-channel.h b/server/red-channel.h
index bc225c6..e0998fa 100644
--- a/server/red-channel.h
+++ b/server/red-channel.h
@@ -28,12 +28,10 @@
 #include <common/ring.h>
 #include <common/marshaller.h>
 
-#include "spice.h"
-#include "red-common.h"
 #include "demarshallers.h"
-#include "reds-stream.h"
 #include "stat.h"
 #include "red-pipe-item.h"
+#include "reds-stream.h"
 
 #define MAX_SEND_BUFS 1000
 #define CLIENT_ACK_WINDOW 20
diff --git a/server/red-parse-qxl.h b/server/red-parse-qxl.h
index 9c30572..508a1b3 100644
--- a/server/red-parse-qxl.h
+++ b/server/red-parse-qxl.h
@@ -16,11 +16,14 @@
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
 
-#ifndef RED_ABI_TRANSLATE_H
-#define RED_ABI_TRANSLATE_H
+#ifndef RED_PARSE_QXL_H
+#define RED_PARSE_QXL_H
 
+#include <common/draw.h>
+#include <common/messages.h>
 #include <spice/qxl_dev.h>
-#include "red-common.h"
+
+#include "spice-qxl.h"
 #include "memslot.h"
 
 typedef struct RedDrawable {
diff --git a/server/red-pipe-item.h b/server/red-pipe-item.h
index 8bb12b7..0ff4852 100644
--- a/server/red-pipe-item.h
+++ b/server/red-pipe-item.h
@@ -19,6 +19,7 @@
 #define _H_RED_PIPE_ITEM
 
 #include <glib.h>
+#include <common/ring.h>
 
 typedef struct {
     RingItem link;
diff --git a/server/red-qxl.h b/server/red-qxl.h
index c9b6b36..ce80f97 100644
--- a/server/red-qxl.h
+++ b/server/red-qxl.h
@@ -19,7 +19,6 @@
 #define _H_RED_DISPATCHER
 
 #include "red-channel.h"
-#include "spice-qxl.h"
 
 typedef struct AsyncCommand AsyncCommand;
 
diff --git a/server/red-record-qxl.h b/server/red-record-qxl.h
index 21f0bc9..4137ff8 100644
--- a/server/red-record-qxl.h
+++ b/server/red-record-qxl.h
@@ -16,11 +16,12 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#ifndef RED_ABI_RECORD_H
-#define RED_ABI_RECORD_H
+#ifndef RED_RECORD_QXL_H
+#define RED_RECORD_QXL_H
 
+#include <stdio.h>
 #include <spice/qxl_dev.h>
-#include "red-common.h"
+#include "spice-qxl.h"
 #include "memslot.h"
 
 void red_record_dev_input_primary_surface_create(
diff --git a/server/red-replay-qxl.h b/server/red-replay-qxl.h
index a89b3d4..f33820c 100644
--- a/server/red-replay-qxl.h
+++ b/server/red-replay-qxl.h
@@ -20,7 +20,8 @@
 
 #include <stdio.h>
 #include <spice/qxl_dev.h>
-#include <spice.h>
+
+#include "spice-qxl.h"
 
 typedef struct SpiceReplay SpiceReplay;
 
diff --git a/server/red-worker.c b/server/red-worker.c
index 8d8073e..33af442 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -48,9 +48,12 @@
 #include "stream.h"
 
 #include "spice.h"
+#include "red-record-qxl.h"
 #include "red-worker.h"
 #include "cursor-channel.h"
 #include "tree.h"
+#include "main-channel.h"
+#include "reds.h"
 
 #define CMD_RING_POLL_TIMEOUT 10 //milli
 #define CMD_RING_POLL_RETRIES 1
diff --git a/server/red-worker.h b/server/red-worker.h
index d7525e0..8517af5 100644
--- a/server/red-worker.h
+++ b/server/red-worker.h
@@ -18,9 +18,8 @@
 #ifndef _H_REDWORKER
 #define _H_REDWORKER
 
-#include "red-common.h"
-#include "red-qxl.h"
 #include "red-parse-qxl.h"
+#include "red-qxl.h"
 
 typedef struct RedWorker RedWorker;
 
diff --git a/server/reds-private.h b/server/reds-private.h
index 74a251b..b2f00b6 100644
--- a/server/reds-private.h
+++ b/server/reds-private.h
@@ -19,6 +19,11 @@
 #define REDS_PRIVATE_H
 
 #include <spice/protocol.h>
+#include <spice/stats.h>
+
+#include "main-dispatcher.h"
+#include "main-channel.h"
+#include "inputs-channel.h"
 
 #define MIGRATE_TIMEOUT (MSEC_PER_SEC * 10)
 #define MM_TIME_DELTA 400 /*ms*/
diff --git a/server/reds-stream.h b/server/reds-stream.h
index 7392f56..9d8038f 100644
--- a/server/reds-stream.h
+++ b/server/reds-stream.h
@@ -18,14 +18,10 @@
 #ifndef _H_REDS_STREAM
 #define _H_REDS_STREAM
 
-#include "spice.h"
-#include <common/mem.h>
-#include "red-common.h"
-
-#include <stdbool.h>
-
 #include <openssl/ssl.h>
 
+#include "red-common.h"
+
 typedef void (*AsyncReadDone)(void *opaque);
 typedef void (*AsyncReadError)(void *opaque, int err);
 
diff --git a/server/reds.h b/server/reds.h
index f0f28da9e..6673923 100644
--- a/server/reds.h
+++ b/server/reds.h
@@ -21,16 +21,14 @@
 #include <stdint.h>
 #include <sys/uio.h>
 #include <spice/vd_agent.h>
-#include <config.h>
-
 
 #include <common/marshaller.h>
 #include <common/messages.h>
+
+#include "migration-protocol.h"
 #include "char-device.h"
-#include "spice.h"
 #include "red-channel.h"
 #include "main-dispatcher.h"
-#include "migration-protocol.h"
 
 static inline QXLInterface * qxl_get_interface(QXLInstance *qxl)
 {
diff --git a/server/smartcard.h b/server/smartcard.h
index 6bda594..2d1356e 100644
--- a/server/smartcard.h
+++ b/server/smartcard.h
@@ -20,6 +20,8 @@
 
 #include <glib-object.h>
 
+#include "char-device.h"
+
 #define RED_TYPE_CHAR_DEVICE_SMARTCARD red_char_device_smartcard_get_type()
 
 #define RED_CHAR_DEVICE_SMARTCARD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), RED_TYPE_CHAR_DEVICE_SMARTCARD, RedCharDeviceSmartcard))
diff --git a/server/sound.h b/server/sound.h
index 25e59f0..76174cf 100644
--- a/server/sound.h
+++ b/server/sound.h
@@ -18,7 +18,9 @@
 #ifndef SOUND_H_
 #define SOUND_H_
 
-#include "spice.h"
+#include "red-common.h"
+
+struct RedClient;
 
 void snd_attach_playback(RedsState *reds, SpicePlaybackInstance *sin);
 void snd_detach_playback(SpicePlaybackInstance *sin);
@@ -28,6 +30,6 @@ void snd_detach_record(SpiceRecordInstance *sin);
 
 void snd_set_playback_compression(int on);
 
-void snd_set_playback_latency(RedClient *client, uint32_t latency);
+void snd_set_playback_latency(struct RedClient *client, uint32_t latency);
 
 #endif
diff --git a/server/spice-bitmap-utils.h b/server/spice-bitmap-utils.h
index ffb6c74..89a9068 100644
--- a/server/spice-bitmap-utils.h
+++ b/server/spice-bitmap-utils.h
@@ -18,7 +18,10 @@
 #ifndef SPICE_BITMAP_UTILS_H_
 #define SPICE_BITMAP_UTILS_H_
 
-#include "red-common.h"
+#include <glib.h>
+#include <spice/qxl_dev.h>
+#include <common/draw.h>
+#include <common/log.h>
 
 typedef enum {
     BITMAP_GRADUAL_INVALID,
diff --git a/server/stat.h b/server/stat.h
index 7db27ee..ec7e88d 100644
--- a/server/stat.h
+++ b/server/stat.h
@@ -20,6 +20,7 @@
 
 #include <stdint.h>
 #include <glib.h>
+#include <spice.h>
 
 typedef uint32_t StatNodeRef;
 #define INVALID_STAT_REF (~(StatNodeRef)0)
diff --git a/server/stream.c b/server/stream.c
index 8884480..2f194ce 100644
--- a/server/stream.c
+++ b/server/stream.c
@@ -20,6 +20,8 @@
 
 #include "stream.h"
 #include "display-channel.h"
+#include "main-channel.h"
+#include "reds.h"
 
 #define FPS_TEST_INTERVAL 1
 #define FOREACH_STREAMS(display, item)                  \
diff --git a/server/stream.h b/server/stream.h
index 011467b..a21f6b0 100644
--- a/server/stream.h
+++ b/server/stream.h
@@ -19,9 +19,9 @@
 #define STREAM_H_
 
 #include <glib.h>
-#include "utils.h"
-#include "video-encoder.h"
 #include <common/region.h>
+
+#include "video-encoder.h"
 #include "red-channel.h"
 #include "image-cache.h"
 
diff --git a/server/tests/replay.c b/server/tests/replay.c
index d552327..0b5f0ed 100644
--- a/server/tests/replay.c
+++ b/server/tests/replay.c
@@ -36,6 +36,7 @@
 #include <pthread.h>
 
 #include <spice/macros.h>
+#include "spice.h"
 #include "red-replay-qxl.h"
 #include "test_display_base.h"
 #include <common/log.h>
diff --git a/server/tests/test-qxl-parsing.c b/server/tests/test-qxl-parsing.c
index a3b2e6c..0a6b8e4 100644
--- a/server/tests/test-qxl-parsing.c
+++ b/server/tests/test-qxl-parsing.c
@@ -10,6 +10,7 @@
 #include <assert.h>
 
 #include <spice/macros.h>
+#include "spice.h"
 #include "memslot.h"
 #include "red-parse-qxl.h"
 
diff --git a/server/tree.h b/server/tree.h
index 6476082..042123d 100644
--- a/server/tree.h
+++ b/server/tree.h
@@ -19,9 +19,10 @@
 # define TREE_H_
 
 #include <stdint.h>
+
 #include <common/region.h>
 #include <common/ring.h>
-#include "spice-bitmap-utils.h"
+#include <spice/qxl_dev.h>
 
 enum {
     TREE_ITEM_TYPE_NONE,
diff --git a/server/utils.h b/server/utils.h
index 00631f8..fcd6a43 100644
--- a/server/utils.h
+++ b/server/utils.h
@@ -18,7 +18,8 @@
 #ifndef UTILS_H_
 # define UTILS_H_
 
-#include "red-common.h"
+#include <inttypes.h>
+#include <glib.h>
 
 #define SPICE_GNUC_VISIBLE __attribute__ ((visibility ("default")))
 
diff --git a/server/video-encoder.h b/server/video-encoder.h
index 9833e13..8aa7783 100644
--- a/server/video-encoder.h
+++ b/server/video-encoder.h
@@ -21,6 +21,9 @@
 #ifndef _H_VIDEO_ENCODER
 #define _H_VIDEO_ENCODER
 
+#include <inttypes.h>
+#include <common/draw.h>
+
 enum {
     VIDEO_ENCODER_FRAME_UNSUPPORTED = -1,
     VIDEO_ENCODER_FRAME_DROP,
diff --git a/server/zlib-encoder.h b/server/zlib-encoder.h
index 0620fc7..2800102 100644
--- a/server/zlib-encoder.h
+++ b/server/zlib-encoder.h
@@ -30,6 +30,8 @@
 #ifndef _H_ZLIB_ENCODER
 #define _H_ZLIB_ENCODER
 
+#include <inttypes.h>
+
 typedef struct ZlibEncoder ZlibEncoder;
 typedef struct ZlibEncoderUsrContext ZlibEncoderUsrContext;
 
-- 
2.5.5



More information about the Spice-devel mailing list