[Spice-devel] [PATCH 11/13] server/red_worker: renames to add channel_ prefix

Alon Levy alevy at redhat.com
Thu Feb 10 08:09:40 PST 2011


s/disconnect_channel_proc/channel_disconnect_proc/
s/hold_pipe_item_proc/channel_pipe_item_hold_proc/
s/release_item_proc/channel_release_pipe_item_proc/
s/handle_message_proc/channel_handle_parsed_proc/
---
 server/red_channel.c |    4 ++--
 server/red_channel.h |    8 ++++----
 server/red_worker.c  |   33 +++++++++++++++++----------------
 3 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/server/red_channel.c b/server/red_channel.c
index 6008876..585d99f 100644
--- a/server/red_channel.c
+++ b/server/red_channel.c
@@ -260,7 +260,7 @@ RedChannel *red_channel_create(int size, RedsStreamContext *peer,
                                channel_handle_message_proc handle_message,
                                channel_alloc_msg_recv_buf_proc alloc_recv_buf,
                                channel_release_msg_recv_buf_proc release_recv_buf,
-                               channel_hold_pipe_item_proc hold_item,
+                               channel_pipe_item_hold_proc hold_item,
                                channel_send_pipe_item_proc send_item,
                                channel_release_pipe_item_proc release_item)
 {
@@ -342,7 +342,7 @@ RedChannel *red_channel_create_parser(int size, RedsStreamContext *peer,
                                channel_handle_parsed_proc handle_parsed,
                                channel_alloc_msg_recv_buf_proc alloc_recv_buf,
                                channel_release_msg_recv_buf_proc release_recv_buf,
-                               channel_hold_pipe_item_proc hold_item,
+                               channel_pipe_item_hold_proc hold_item,
                                channel_send_pipe_item_proc send_item,
                                channel_release_pipe_item_proc release_item,
                                channel_on_incoming_error_proc incoming_error,
diff --git a/server/red_channel.h b/server/red_channel.h
index 2ee6566..baead18 100644
--- a/server/red_channel.h
+++ b/server/red_channel.h
@@ -107,7 +107,7 @@ typedef void (*channel_release_msg_recv_buf_proc)(RedChannel *channel,
 typedef void (*channel_disconnect_proc)(RedChannel *channel);
 typedef int (*channel_configure_socket_proc)(RedChannel *channel);
 typedef void (*channel_send_pipe_item_proc)(RedChannel *channel, PipeItem *item);
-typedef void (*channel_hold_pipe_item_proc)(PipeItem *item);
+typedef void (*channel_pipe_item_hold_proc)(PipeItem *item);
 typedef void (*channel_release_pipe_item_proc)(RedChannel *channel,
                                                PipeItem *item, int item_pushed);
 typedef void (*channel_on_incoming_error_proc)(RedChannel *channel);
@@ -147,7 +147,7 @@ struct RedChannel {
 
     channel_disconnect_proc disconnect;
     channel_send_pipe_item_proc send_item;
-    channel_hold_pipe_item_proc hold_item;
+    channel_pipe_item_hold_proc hold_item;
     channel_release_pipe_item_proc release_item;
 
     int during_send;
@@ -168,7 +168,7 @@ RedChannel *red_channel_create(int size, RedsStreamContext *peer,
                                channel_handle_message_proc handle_message,
                                channel_alloc_msg_recv_buf_proc alloc_recv_buf,
                                channel_release_msg_recv_buf_proc release_recv_buf,
-                               channel_hold_pipe_item_proc hold_item,
+                               channel_pipe_item_hold_proc hold_item,
                                channel_send_pipe_item_proc send_item,
                                channel_release_pipe_item_proc release_item);
 
@@ -182,7 +182,7 @@ RedChannel *red_channel_create_parser(int size, RedsStreamContext *peer,
                                channel_handle_parsed_proc handle_parsed,
                                channel_alloc_msg_recv_buf_proc alloc_recv_buf,
                                channel_release_msg_recv_buf_proc release_recv_buf,
-                               channel_hold_pipe_item_proc hold_item,
+                               channel_pipe_item_hold_proc hold_item,
                                channel_send_pipe_item_proc send_item,
                                channel_release_pipe_item_proc release_item,
                                channel_on_incoming_error_proc incoming_error,
diff --git a/server/red_worker.c b/server/red_worker.c
index 1574b99..5dcb93e 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -348,10 +348,10 @@ typedef struct LocalCursor {
 #define PALETTE_CACHE_HASH_KEY(id) ((id) & PALETTE_CACHE_HASH_MASK)
 
 typedef struct RedChannel RedChannel;
-typedef void (*disconnect_channel_proc)(RedChannel *channel);
-typedef void (*hold_pipe_item_proc)(PipeItem *item);
-typedef void (*release_item_proc)(RedChannel *channel, void *item);
-typedef int (*handle_message_proc)(RedChannel *channel, size_t size, uint32_t type, void *message);
+typedef void (*channel_disconnect_proc)(RedChannel *channel);
+typedef void (*channel_pipe_item_hold_proc)(PipeItem *item);
+typedef void (*channel_release_pipe_item_proc)(RedChannel *channel, void *item);
+typedef int (*channel_handle_parsed_proc)(RedChannel *channel, uint32_t size, uint16_t type, void *message);
 
 struct RedChannel {
     spice_parse_channel_func_t parser;
@@ -385,10 +385,11 @@ struct RedChannel {
         uint8_t *end;
     } recive_data;
 
-    disconnect_channel_proc disconnect;
-    hold_pipe_item_proc hold_item;
-    release_item_proc release_item;
-    handle_message_proc handle_message;
+    channel_disconnect_proc disconnect;
+    channel_pipe_item_hold_proc hold_item;
+    channel_release_pipe_item_proc release_item;
+    channel_handle_parsed_proc handle_parsed;
+
 #ifdef RED_STATISTICS
     uint64_t *out_bytes_counter;
 #endif
@@ -8940,7 +8941,7 @@ static void on_new_display_channel(RedWorker *worker)
     }
 }
 
-static int channel_handle_message(RedChannel *channel, size_t size, uint32_t type, void *message)
+static int channel_handle_message(RedChannel *channel, uint32_t size, uint16_t type, void *message)
 {
     switch (type) {
     case SPICE_MSGC_ACK_SYNC:
@@ -9247,7 +9248,7 @@ static int display_channel_handle_migrate_data(DisplayChannel *channel, size_t s
     return TRUE;
 }
 
-static int display_channel_handle_message(RedChannel *channel, size_t size, uint32_t type, void *message)
+static int display_channel_handle_message(RedChannel *channel, uint32_t size, uint16_t type, void *message)
 {
     switch (type) {
     case SPICE_MSGC_DISPLAY_INIT:
@@ -9315,7 +9316,7 @@ static void red_receive(RedChannel *channel)
                     return;
                 }
 
-                if (!channel->handle_message(channel, parsed_size, header->type, parsed)) {
+                if (!channel->handle_parsed(channel, parsed_size, header->type, parsed)) {
                     free(parsed);
                     channel->disconnect(channel);
                     return;
@@ -9348,10 +9349,10 @@ static void free_common_channel_from_listener(EventListener *ctx)
 static RedChannel *__new_channel(RedWorker *worker, int size, uint32_t channel_id,
                                  RedsStreamContext *peer, int migrate,
                                  event_listener_action_proc handler,
-                                 disconnect_channel_proc disconnect,
-                                 hold_pipe_item_proc hold_item,
-                                 release_item_proc release_item,
-                                 handle_message_proc handle_message)
+                                 channel_disconnect_proc disconnect,
+                                 channel_pipe_item_hold_proc hold_item,
+                                 channel_release_pipe_item_proc release_item,
+                                 channel_handle_parsed_proc handle_parsed)
 {
     struct epoll_event event;
     RedChannel *channel;
@@ -9386,7 +9387,7 @@ static RedChannel *__new_channel(RedWorker *worker, int size, uint32_t channel_i
     channel->disconnect = disconnect;
     channel->hold_item = hold_item;
     channel->release_item = release_item;
-    channel->handle_message = handle_message;
+    channel->handle_parsed = handle_parsed;
     channel->peer = peer;
     common->worker = worker;
     channel->ack_data.messages_window = ~0;  // blocks send message (maybe use send_data.blocked +
-- 
1.7.4



More information about the Spice-devel mailing list