[Spice-commits] 3 commits - server/char-device.c server/char-device.h server/main-channel.h server/red-channel.h server/red-common.h server/red-qxl.h server/reds-stream.h server/reds.h

Christophe Fergau teuf at kemper.freedesktop.org
Wed Apr 6 08:33:15 UTC 2016


 server/char-device.c  |    2 +-
 server/char-device.h  |    8 +++-----
 server/main-channel.h |    4 +---
 server/red-channel.h  |   14 ++++++--------
 server/red-common.h   |    2 ++
 server/red-qxl.h      |    3 +--
 server/reds-stream.h  |    2 +-
 server/reds.h         |    2 --
 8 files changed, 15 insertions(+), 22 deletions(-)

New commits:
commit 05093f2187921a84fedefd7a7cd727fce05c3a8b
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Tue Apr 5 15:37:59 2016 +0200

    qxl: Remove duplicate QXLState typedef
    
    We can directly include spice-qxl.h in red-qxl.h as it already gets it indirectly anyway.
    >

diff --git a/server/red-qxl.h b/server/red-qxl.h
index b1ebbe1..c9b6b36 100644
--- a/server/red-qxl.h
+++ b/server/red-qxl.h
@@ -19,8 +19,7 @@
 #define _H_RED_DISPATCHER
 
 #include "red-channel.h"
-
-typedef struct QXLState QXLState;
+#include "spice-qxl.h"
 
 typedef struct AsyncCommand AsyncCommand;
 
commit e37f97a9f8b8e6dd2d209645f17d57482e98632f
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Tue Apr 5 15:37:58 2016 +0200

    reds: Move RedsState typedef to red-common.h
    
    This allows to stop using struct RedsState * rather than RedsState * in
    headers which cannot include reds.h. This also allows to remove the
    duplicate RedsState typedef in reds.h and reds-stream.h which is causing
    issues with older gcc versions.

diff --git a/server/char-device.h b/server/char-device.h
index 0a4ae5d..88961cc 100644
--- a/server/char-device.h
+++ b/server/char-device.h
@@ -119,8 +119,6 @@ void red_char_device_set_callbacks(RedCharDevice *dev,
  *
  * */
 
-struct RedsState;
-
 /* buffer that is used for writing to the device */
 typedef struct RedCharDeviceWriteBuffer {
     RingItem link;
@@ -170,7 +168,7 @@ struct RedCharDeviceCallbacks {
 };
 
 RedCharDevice *red_char_device_create(SpiceCharDeviceInstance *sin,
-                                      struct RedsState *reds,
+                                      RedsState *reds,
                                       uint32_t client_tokens_interval,
                                       uint32_t self_tokens,
                                       RedCharDeviceCallbacks *cbs,
@@ -253,10 +251,10 @@ void red_char_device_write_buffer_release(RedCharDevice *dev,
 
 /* api for specific char devices */
 
-RedCharDevice *spicevmc_device_connect(struct RedsState *reds,
+RedCharDevice *spicevmc_device_connect(RedsState *reds,
                                        SpiceCharDeviceInstance *sin,
                                        uint8_t channel_type);
-void spicevmc_device_disconnect(struct RedsState *reds,
+void spicevmc_device_disconnect(RedsState *reds,
                                 SpiceCharDeviceInstance *char_device);
 
 SpiceCharDeviceInterface *spice_char_device_get_interface(SpiceCharDeviceInstance *instance);
diff --git a/server/main-channel.h b/server/main-channel.h
index 26e2129..fd16c94 100644
--- a/server/main-channel.h
+++ b/server/main-channel.h
@@ -32,8 +32,6 @@
 #define MAIN_CHANNEL_RECEIVE_BUF_SIZE \
     (4096 + (REDS_AGENT_WINDOW_SIZE + REDS_NUM_INTERNAL_AGENT_MESSAGES) * SPICE_AGENT_MAX_DATA_SIZE)
 
-struct RedsState;
-
 struct RedsMigSpice {
     char *host;
     char *cert_subject;
@@ -50,7 +48,7 @@ typedef struct MainChannel {
 } MainChannel;
 
 
-MainChannel *main_channel_new(struct RedsState *reds);
+MainChannel *main_channel_new(RedsState *reds);
 RedClient *main_channel_get_client_by_link_id(MainChannel *main_chan, uint32_t link_id);
 /* This is a 'clone' from the reds.h Channel.link callback to allow passing link_id */
 MainChannelClient *main_channel_link(MainChannel *, RedClient *client,
diff --git a/server/red-channel.h b/server/red-channel.h
index c3aeda6..94b09eb 100644
--- a/server/red-channel.h
+++ b/server/red-channel.h
@@ -47,8 +47,6 @@
    The intention is to move towards one channel interface gradually.
    At the final stage, this interface shouldn't be exposed. Only RedChannel will use it. */
 
-struct RedsState;
-
 typedef struct SpiceDataHeaderOpaque SpiceDataHeaderOpaque;
 
 typedef uint16_t (*get_msg_type_proc)(SpiceDataHeaderOpaque *header);
@@ -339,7 +337,7 @@ struct RedChannel {
 
     // TODO: when different channel_clients are in different threads from Channel -> need to protect!
     pthread_t thread_id;
-    struct RedsState *reds;
+    RedsState *reds;
 #ifdef RED_STATISTICS
     StatNodeRef stat;
     uint64_t *out_bytes_counter;
@@ -362,7 +360,7 @@ struct RedChannel {
 /* if one of the callbacks should cause disconnect, use red_channel_shutdown and don't
  * explicitly destroy the channel */
 RedChannel *red_channel_create(int size,
-                               struct RedsState *reds,
+                               RedsState *reds,
                                const SpiceCoreInterfaceInternal *core,
                                uint32_t type, uint32_t id,
                                int handle_acks,
@@ -373,7 +371,7 @@ RedChannel *red_channel_create(int size,
 /* alternative constructor, meant for marshaller based (inputs,main) channels,
  * will become default eventually */
 RedChannel *red_channel_create_parser(int size,
-                                      struct RedsState *reds,
+                                      RedsState *reds,
                                       const SpiceCoreInterfaceInternal *core,
                                       uint32_t type, uint32_t id,
                                       int handle_acks,
@@ -396,7 +394,7 @@ RedChannelClient *red_channel_client_create(int size, RedChannel *channel, RedCl
 // TODO: tmp, for channels that don't use RedChannel yet (e.g., snd channel), but
 // do use the client callbacks. So the channel clients are not connected (the channel doesn't
 // have list of them, but they do have a link to the channel, and the client has a list of them)
-RedChannel *red_channel_create_dummy(int size, struct RedsState *reds, uint32_t type, uint32_t id);
+RedChannel *red_channel_create_dummy(int size, RedsState *reds, uint32_t type, uint32_t id);
 RedChannelClient *red_channel_client_create_dummy(int size,
                                                   RedChannel *channel,
                                                   RedClient  *client,
@@ -569,7 +567,7 @@ void red_channel_apply_clients(RedChannel *channel, channel_client_callback v);
 struct RedsState* red_channel_get_server(RedChannel *channel);
 
 struct RedClient {
-    struct RedsState *reds;
+    RedsState *reds;
     RingItem link;
     Ring channels;
     int channels_num;
@@ -591,7 +589,7 @@ struct RedClient {
     int refs;
 };
 
-RedClient *red_client_new(struct RedsState *reds, int migrated);
+RedClient *red_client_new(RedsState *reds, int migrated);
 
 /*
  * disconnects all the client's channels (should be called from the client's thread)
diff --git a/server/red-common.h b/server/red-common.h
index 90a7d20..a9339fb 100644
--- a/server/red-common.h
+++ b/server/red-common.h
@@ -58,4 +58,6 @@ struct SpiceCoreInterfaceInternal {
 
 extern SpiceCoreInterfaceInternal event_loop_core;
 
+typedef struct RedsState RedsState;
+
 #endif
diff --git a/server/reds-stream.h b/server/reds-stream.h
index 1123048..705d7fd 100644
--- a/server/reds-stream.h
+++ b/server/reds-stream.h
@@ -20,6 +20,7 @@
 
 #include "spice.h"
 #include "common/mem.h"
+#include "red-common.h"
 
 #include <stdbool.h>
 
@@ -28,7 +29,6 @@
 typedef void (*AsyncReadDone)(void *opaque);
 typedef void (*AsyncReadError)(void *opaque, int err);
 
-typedef struct RedsState RedsState;
 typedef struct RedsStream RedsStream;
 typedef struct RedsStreamPrivate RedsStreamPrivate;
 
diff --git a/server/reds.h b/server/reds.h
index 83618e9..2cfd451 100644
--- a/server/reds.h
+++ b/server/reds.h
@@ -32,8 +32,6 @@
 #include "main-dispatcher.h"
 #include "migration-protocol.h"
 
-typedef struct RedsState RedsState;
-
 static inline QXLInterface * qxl_get_interface(QXLInstance *qxl)
 {
     return SPICE_CONTAINEROF(qxl->base.sif, QXLInterface, base);
commit 852a9824a1a9643f15f0f4134d49aeca85e1cbbb
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Tue Apr 5 17:19:54 2016 +0200

    char-device: Fix property name in red_char_device_new()
    
    This method will be removed in a subsequent commit, but for now it's
    causing breakage since it's setting "reds" instead of "spice-server"

diff --git a/server/char-device.c b/server/char-device.c
index f492657..bd2737f 100644
--- a/server/char-device.c
+++ b/server/char-device.c
@@ -1265,7 +1265,7 @@ red_char_device_new(SpiceCharDeviceInstance *sin,
 
     char_dev = g_object_new(RED_TYPE_CHAR_DEVICE,
                             "sin", sin,
-                            "reds", reds,
+                            "spice-server", reds,
                             "client-tokens-interval", (guint64) client_tokens_interval,
                             "self-tokens", (guint64) self_tokens,
                             "opaque", opaque,


More information about the Spice-commits mailing list