[Spice-devel] [PATCH 1/3] Namespace RECEIVE_BUF_SIZE

Christophe Fergeau cfergeau at redhat.com
Tue Oct 8 12:37:35 CEST 2013


---
 server/main_channel.h | 4 ++--
 server/red_worker.c   | 8 ++++----
 server/snd_worker.c   | 6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/server/main_channel.h b/server/main_channel.h
index 29eb8d4..c8e9ade 100644
--- a/server/main_channel.h
+++ b/server/main_channel.h
@@ -30,12 +30,12 @@
 #define REDS_NUM_INTERNAL_AGENT_MESSAGES 1
 
 // approximate max receive message size for main channel
-#define RECEIVE_BUF_SIZE \
+#define MAIN_CHANNEL_RECEIVE_BUF_SIZE \
     (4096 + (REDS_AGENT_WINDOW_SIZE + REDS_NUM_INTERNAL_AGENT_MESSAGES) * SPICE_AGENT_MAX_DATA_SIZE)
 
 typedef struct MainChannel {
     RedChannel base;
-    uint8_t recv_buf[RECEIVE_BUF_SIZE];
+    uint8_t recv_buf[MAIN_CHANNEL_RECEIVE_BUF_SIZE];
     RedsMigSpice mig_target; // TODO: add refs and release (afrer all clients completed migration in one way or the other?)
     int num_clients_mig_wait;
 } MainChannel;
diff --git a/server/red_worker.c b/server/red_worker.c
index 8763c8e..451c8ab 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -383,7 +383,7 @@ typedef struct LocalCursor {
 } LocalCursor;
 
 #define MAX_PIPE_SIZE 50
-#define RECIVE_BUF_SIZE 1024
+#define CHANNEL_RECIVE_BUF_SIZE 1024
 
 #define WIDE_CLIENT_ACK_WINDOW 40
 #define NARROW_CLIENT_ACK_WINDOW 20
@@ -654,7 +654,7 @@ typedef struct GlzSharedDictionary {
 typedef struct CommonChannel {
     RedChannel base; // Must be the first thing
     struct RedWorker *worker;
-    uint8_t recv_buf[RECIVE_BUF_SIZE];
+    uint8_t recv_buf[CHANNEL_RECIVE_BUF_SIZE];
     uint32_t id_alloc; // bitfield. TODO - use this instead of shift scheme.
     int during_target_migrate; /* TRUE when the client that is associated with the channel
                                   is during migration. Turned off when the vm is started.
@@ -1591,8 +1591,8 @@ static uint8_t *common_alloc_recv_buf(RedChannelClient *rcc, uint16_t type, uint
         return spice_malloc(size);
     }
 
-    if (size > RECIVE_BUF_SIZE) {
-        spice_critical("unexpected message size %u (max is %d)", size, RECIVE_BUF_SIZE);
+    if (size > CHANNEL_RECIVE_BUF_SIZE) {
+        spice_critical("unexpected message size %u (max is %d)", size, CHANNEL_RECIVE_BUF_SIZE);
         return NULL;
     }
     return common->recv_buf;
diff --git a/server/snd_worker.c b/server/snd_worker.c
index ebddfcd..19171e3 100644
--- a/server/snd_worker.c
+++ b/server/snd_worker.c
@@ -42,7 +42,7 @@
 #define IOV_MAX 1024
 #endif
 
-#define RECIVE_BUF_SIZE (16 * 1024 * 2)
+#define SND_RECIVE_BUF_SIZE (16 * 1024 * 2)
 
 #define FRAME_SIZE 256
 #define PLAYBACK_BUF_SIZE (FRAME_SIZE * 4)
@@ -50,7 +50,7 @@
 #define CELT_BIT_RATE (64 * 1024)
 #define CELT_COMPRESSED_FRAME_BYTES (FRAME_SIZE * CELT_BIT_RATE / SPICE_INTERFACE_PLAYBACK_FREQ / 8)
 
-#define RECORD_SAMPLES_SIZE (RECIVE_BUF_SIZE >> 2)
+#define RECORD_SAMPLES_SIZE (SND_RECIVE_BUF_SIZE >> 2)
 
 enum PlaybackeCommand {
     SND_PLAYBACK_MIGRATE,
@@ -112,7 +112,7 @@ struct SndChannel {
     } send_data;
 
     struct {
-        uint8_t buf[RECIVE_BUF_SIZE];
+        uint8_t buf[SND_RECIVE_BUF_SIZE];
         uint8_t *message_start;
         uint8_t *now;
         uint8_t *end;
-- 
1.8.3.1



More information about the Spice-devel mailing list