[Spice-devel] [spice-server v2 4/6] Make RedCharDeviceWriteBuffer::token_price private

Christophe Fergeau cfergeau at redhat.com
Fri Apr 28 09:11:00 UTC 2017


Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
---
 server/char-device.c | 9 +++++----
 server/char-device.h | 1 -
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/server/char-device.c b/server/char-device.c
index 7c7a98696..7e77b465b 100644
--- a/server/char-device.c
+++ b/server/char-device.c
@@ -35,6 +35,7 @@ struct RedCharDeviceWriteBufferPrivate {
     int origin;
     RedClient *client; /* The client that sent the message to the device.
                           NULL if the server created the message */
+    uint32_t token_price;
 };
 
 typedef struct RedCharDeviceClient RedCharDeviceClient;
@@ -582,7 +583,7 @@ static RedCharDeviceWriteBuffer *__red_char_device_write_buffer_get(
         dev->priv->num_self_tokens--;
     }
 
-    ret->token_price = migrated_data_tokens ? migrated_data_tokens : 1;
+    ret->priv->token_price = migrated_data_tokens ? migrated_data_tokens : 1;
     ret->refs = 1;
     return ret;
 error:
@@ -650,7 +651,7 @@ void red_char_device_write_buffer_release(RedCharDevice *dev,
     *p_write_buf = NULL;
 
     int buf_origin = write_buf->priv->origin;
-    uint32_t buf_token_price = write_buf->token_price;
+    uint32_t buf_token_price = write_buf->priv->token_price;
     RedClient *client = write_buf->priv->client;
 
     if (!dev) {
@@ -908,7 +909,7 @@ void red_char_device_migrate_data_marshall(RedCharDevice *dev,
         *write_to_dev_size_ptr += buf_remaining;
         if (dev->priv->cur_write_buf->priv->origin == WRITE_BUFFER_ORIGIN_CLIENT) {
             spice_assert(dev->priv->cur_write_buf->priv->client == dev_client->client);
-            (*write_to_dev_tokens_ptr) += dev->priv->cur_write_buf->token_price;
+            (*write_to_dev_tokens_ptr) += dev->priv->cur_write_buf->priv->token_price;
         }
     }
 
@@ -922,7 +923,7 @@ void red_char_device_migrate_data_marshall(RedCharDevice *dev,
         *write_to_dev_size_ptr += write_buf->buf_used;
         if (write_buf->priv->origin == WRITE_BUFFER_ORIGIN_CLIENT) {
             spice_assert(write_buf->priv->client == dev_client->client);
-            (*write_to_dev_tokens_ptr) += write_buf->token_price;
+            (*write_to_dev_tokens_ptr) += write_buf->priv->token_price;
         }
     }
     spice_debug("migration data dev %p: write_queue size %u tokens %u",
diff --git a/server/char-device.h b/server/char-device.h
index 0dd493c4d..13e625fe1 100644
--- a/server/char-device.h
+++ b/server/char-device.h
@@ -151,7 +151,6 @@ typedef struct RedCharDeviceWriteBuffer {
     uint8_t *buf;
     uint32_t buf_size;
     uint32_t buf_used;
-    uint32_t token_price;
     uint32_t refs;
 
     RedCharDeviceWriteBufferPrivate *priv;
-- 
2.12.2



More information about the Spice-devel mailing list