[Spice-devel] [PATCH v2 01/15] Rename SpiceCharDeviceMsgToClient to RedCharDeviceMsgToClient

Jonathon Jongsma jjongsma at redhat.com
Thu Mar 31 21:06:59 UTC 2016


Internal types should use Red namespace for consistency
---
 server/char-device.c | 36 ++++++++++++++++++------------------
 server/char-device.h | 12 ++++++------
 server/reds.c        | 12 ++++++------
 server/smartcard.c   | 12 ++++++------
 server/spicevmc.c    | 16 ++++++++--------
 5 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/server/char-device.c b/server/char-device.c
index 6704678..25fcbba 100644
--- a/server/char-device.c
+++ b/server/char-device.c
@@ -93,34 +93,34 @@ static void spice_char_device_write_buffer_unref(SpiceCharDeviceWriteBuffer *wri
 
 static void spice_char_dev_write_retry(void *opaque);
 
-typedef struct SpiceCharDeviceMsgToClientItem {
+typedef struct RedCharDeviceMsgToClientItem {
     RingItem link;
-    SpiceCharDeviceMsgToClient *msg;
-} SpiceCharDeviceMsgToClientItem;
+    RedCharDeviceMsgToClient *msg;
+} RedCharDeviceMsgToClientItem;
 
-static SpiceCharDeviceMsgToClient *
+static RedCharDeviceMsgToClient *
 spice_char_device_read_one_msg_from_device(SpiceCharDeviceState *dev)
 {
    return dev->priv->cbs.read_one_msg_from_device(dev->priv->sin, dev->priv->opaque);
 }
 
-static SpiceCharDeviceMsgToClient *
+static RedCharDeviceMsgToClient *
 spice_char_device_ref_msg_to_client(SpiceCharDeviceState *dev,
-                                    SpiceCharDeviceMsgToClient *msg)
+                                    RedCharDeviceMsgToClient *msg)
 {
    return dev->priv->cbs.ref_msg_to_client(msg, dev->priv->opaque);
 }
 
 static void
 spice_char_device_unref_msg_to_client(SpiceCharDeviceState *dev,
-                                      SpiceCharDeviceMsgToClient *msg)
+                                      RedCharDeviceMsgToClient *msg)
 {
    dev->priv->cbs.unref_msg_to_client(msg, dev->priv->opaque);
 }
 
 static void
 spice_char_device_send_msg_to_client(SpiceCharDeviceState *dev,
-                                     SpiceCharDeviceMsgToClient *msg,
+                                     RedCharDeviceMsgToClient *msg,
                                      RedClient *client)
 {
    dev->priv->cbs.send_msg_to_client(msg, client, dev->priv->opaque);
@@ -192,9 +192,9 @@ static void spice_char_device_client_send_queue_free(SpiceCharDeviceState *dev,
     spice_debug("send_queue_empty %d", ring_is_empty(&dev_client->send_queue));
     while (!ring_is_empty(&dev_client->send_queue)) {
         RingItem *item = ring_get_tail(&dev_client->send_queue);
-        SpiceCharDeviceMsgToClientItem *msg_item = SPICE_CONTAINEROF(item,
-                                                                     SpiceCharDeviceMsgToClientItem,
-                                                                     link);
+        RedCharDeviceMsgToClientItem *msg_item = SPICE_CONTAINEROF(item,
+                                                                   RedCharDeviceMsgToClientItem,
+                                                                   link);
 
         ring_remove(item);
         spice_char_device_unref_msg_to_client(dev, msg_item->msg);
@@ -301,17 +301,17 @@ static uint64_t spice_char_device_max_send_tokens(SpiceCharDeviceState *dev)
 }
 
 static void spice_char_device_add_msg_to_client_queue(SpiceCharDeviceClientState *dev_client,
-                                                      SpiceCharDeviceMsgToClient *msg)
+                                                      RedCharDeviceMsgToClient *msg)
 {
     SpiceCharDeviceState *dev = dev_client->dev;
-    SpiceCharDeviceMsgToClientItem *msg_item;
+    RedCharDeviceMsgToClientItem *msg_item;
 
     if (dev_client->send_queue_size >= dev_client->max_send_queue_size) {
         spice_char_device_handle_client_overflow(dev_client);
         return;
     }
 
-    msg_item = spice_new0(SpiceCharDeviceMsgToClientItem, 1);
+    msg_item = spice_new0(RedCharDeviceMsgToClientItem, 1);
     msg_item->msg = spice_char_device_ref_msg_to_client(dev, msg);
     ring_add(&dev_client->send_queue, &msg_item->link);
     dev_client->send_queue_size++;
@@ -323,7 +323,7 @@ static void spice_char_device_add_msg_to_client_queue(SpiceCharDeviceClientState
 }
 
 static void spice_char_device_send_msg_to_clients(SpiceCharDeviceState *dev,
-                                                  SpiceCharDeviceMsgToClient *msg)
+                                                  RedCharDeviceMsgToClient *msg)
 {
     RingItem *item, *next;
 
@@ -369,7 +369,7 @@ static int spice_char_device_read_from_device(SpiceCharDeviceState *dev)
      * All messages will be discarded if no client is attached to the device
      */
     while ((max_send_tokens || ring_is_empty(&dev->priv->clients)) && dev->priv->running) {
-        SpiceCharDeviceMsgToClient *msg;
+        RedCharDeviceMsgToClient *msg;
 
         msg = spice_char_device_read_one_msg_from_device(dev);
         if (!msg) {
@@ -398,9 +398,9 @@ static void spice_char_device_client_send_queue_push(SpiceCharDeviceClientState
     RingItem *item;
     while ((item = ring_get_tail(&dev_client->send_queue)) &&
            spice_char_device_can_send_to_client(dev_client)) {
-        SpiceCharDeviceMsgToClientItem *msg_item;
+        RedCharDeviceMsgToClientItem *msg_item;
 
-        msg_item = SPICE_CONTAINEROF(item, SpiceCharDeviceMsgToClientItem, link);
+        msg_item = SPICE_CONTAINEROF(item, RedCharDeviceMsgToClientItem, link);
         ring_remove(item);
 
         dev_client->num_send_tokens--;
diff --git a/server/char-device.h b/server/char-device.h
index 7c78524..f352396 100644
--- a/server/char-device.h
+++ b/server/char-device.h
@@ -95,7 +95,7 @@ typedef struct SpiceCharDeviceWriteBuffer {
     uint32_t refs;
 } SpiceCharDeviceWriteBuffer;
 
-typedef void SpiceCharDeviceMsgToClient;
+typedef void RedCharDeviceMsgToClient;
 
 typedef struct SpiceCharDeviceCallbacks {
     /*
@@ -105,13 +105,13 @@ typedef struct SpiceCharDeviceCallbacks {
 
     /* reads from the device till reaching a msg that should be sent to the client,
      * or till the reading fails */
-    SpiceCharDeviceMsgToClient* (*read_one_msg_from_device)(SpiceCharDeviceInstance *sin,
+    RedCharDeviceMsgToClient* (*read_one_msg_from_device)(SpiceCharDeviceInstance *sin,
                                                             void *opaque);
-    SpiceCharDeviceMsgToClient* (*ref_msg_to_client)(SpiceCharDeviceMsgToClient *msg,
-                                                     void *opaque);
-    void (*unref_msg_to_client)(SpiceCharDeviceMsgToClient *msg,
+    RedCharDeviceMsgToClient* (*ref_msg_to_client)(RedCharDeviceMsgToClient *msg,
+                                                   void *opaque);
+    void (*unref_msg_to_client)(RedCharDeviceMsgToClient *msg,
                                 void *opaque);
-    void (*send_msg_to_client)(SpiceCharDeviceMsgToClient *msg,
+    void (*send_msg_to_client)(RedCharDeviceMsgToClient *msg,
                                RedClient *client,
                                void *opaque); /* after this call, the message is unreferenced */
 
diff --git a/server/reds.c b/server/reds.c
index 8942258..eb13cd3 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -706,8 +706,8 @@ static void vdi_port_read_buf_unref(VDIReadBuf *buf)
 
 /* reads from the device till completes reading a message that is addressed to the client,
  * or otherwise, when reading from the device fails */
-static SpiceCharDeviceMsgToClient *vdi_port_read_one_msg_from_device(SpiceCharDeviceInstance *sin,
-                                                                     void *opaque)
+static RedCharDeviceMsgToClient *vdi_port_read_one_msg_from_device(SpiceCharDeviceInstance *sin,
+                                                                   void *opaque)
 {
     RedsState *reds = opaque;
     VDIPortState *state = &reds->agent_state;
@@ -778,20 +778,20 @@ static SpiceCharDeviceMsgToClient *vdi_port_read_one_msg_from_device(SpiceCharDe
     return NULL;
 }
 
-static SpiceCharDeviceMsgToClient *vdi_port_ref_msg_to_client(SpiceCharDeviceMsgToClient *msg,
-                                                              void *opaque)
+static RedCharDeviceMsgToClient *vdi_port_ref_msg_to_client(RedCharDeviceMsgToClient *msg,
+                                                            void *opaque)
 {
     return vdi_port_read_buf_ref(msg);
 }
 
-static void vdi_port_unref_msg_to_client(SpiceCharDeviceMsgToClient *msg,
+static void vdi_port_unref_msg_to_client(RedCharDeviceMsgToClient *msg,
                                          void *opaque)
 {
     vdi_port_read_buf_unref(msg);
 }
 
 /* after calling this, we unref the message, and the ref is in the instance side */
-static void vdi_port_send_msg_to_client(SpiceCharDeviceMsgToClient *msg,
+static void vdi_port_send_msg_to_client(RedCharDeviceMsgToClient *msg,
                                         RedClient *client,
                                         void *opaque)
 {
diff --git a/server/smartcard.c b/server/smartcard.c
index d34fa05..20d7261 100644
--- a/server/smartcard.c
+++ b/server/smartcard.c
@@ -136,8 +136,8 @@ static void smartcard_read_buf_prepare(SmartCardDeviceState *state, VSCMsgHeader
     }
 }
 
-static SpiceCharDeviceMsgToClient *smartcard_read_msg_from_device(SpiceCharDeviceInstance *sin,
-                                                                  void *opaque)
+static RedCharDeviceMsgToClient *smartcard_read_msg_from_device(SpiceCharDeviceInstance *sin,
+                                                                void *opaque)
 {
     SmartCardDeviceState *state = opaque;
     SpiceCharDeviceInterface *sif = spice_char_device_get_interface(sin);
@@ -173,19 +173,19 @@ static SpiceCharDeviceMsgToClient *smartcard_read_msg_from_device(SpiceCharDevic
     return NULL;
 }
 
-static SpiceCharDeviceMsgToClient *smartcard_ref_msg_to_client(SpiceCharDeviceMsgToClient *msg,
-                                                               void *opaque)
+static RedCharDeviceMsgToClient *smartcard_ref_msg_to_client(RedCharDeviceMsgToClient *msg,
+                                                             void *opaque)
 {
     return smartcard_ref_vsc_msg_item((MsgItem *)msg);
 }
 
-static void smartcard_unref_msg_to_client(SpiceCharDeviceMsgToClient *msg,
+static void smartcard_unref_msg_to_client(RedCharDeviceMsgToClient *msg,
                                           void *opaque)
 {
     smartcard_unref_vsc_msg_item((MsgItem *)msg);
 }
 
-static void smartcard_send_msg_to_client(SpiceCharDeviceMsgToClient *msg,
+static void smartcard_send_msg_to_client(RedCharDeviceMsgToClient *msg,
                                          RedClient *client,
                                          void *opaque)
 {
diff --git a/server/spicevmc.c b/server/spicevmc.c
index 367132c..c67b408 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -92,20 +92,20 @@ static void spicevmc_pipe_item_unref(SpiceVmcPipeItem *item)
     }
 }
 
-static SpiceCharDeviceMsgToClient *spicevmc_chardev_ref_msg_to_client(SpiceCharDeviceMsgToClient *msg,
-                                                                      void *opaque)
+static RedCharDeviceMsgToClient *spicevmc_chardev_ref_msg_to_client(RedCharDeviceMsgToClient *msg,
+                                                                    void *opaque)
 {
     return spicevmc_pipe_item_ref((SpiceVmcPipeItem *)msg);
 }
 
-static void spicevmc_chardev_unref_msg_to_client(SpiceCharDeviceMsgToClient *msg,
+static void spicevmc_chardev_unref_msg_to_client(RedCharDeviceMsgToClient *msg,
                                                  void *opaque)
 {
     spicevmc_pipe_item_unref((SpiceVmcPipeItem *)msg);
 }
 
-static SpiceCharDeviceMsgToClient *spicevmc_chardev_read_msg_from_dev(SpiceCharDeviceInstance *sin,
-                                                                      void *opaque)
+static RedCharDeviceMsgToClient *spicevmc_chardev_read_msg_from_dev(SpiceCharDeviceInstance *sin,
+                                                                    void *opaque)
 {
     SpiceVmcState *state = opaque;
     SpiceCharDeviceInterface *sif;
@@ -140,9 +140,9 @@ static SpiceCharDeviceMsgToClient *spicevmc_chardev_read_msg_from_dev(SpiceCharD
     }
 }
 
-static void spicevmc_chardev_send_msg_to_client(SpiceCharDeviceMsgToClient *msg,
-                                                 RedClient *client,
-                                                 void *opaque)
+static void spicevmc_chardev_send_msg_to_client(RedCharDeviceMsgToClient *msg,
+                                                RedClient *client,
+                                                void *opaque)
 {
     SpiceVmcState *state = opaque;
     SpiceVmcPipeItem *vmc_msg = msg;
-- 
2.4.3



More information about the Spice-devel mailing list