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

Christophe Fergeau cfergeau at redhat.com
Tue Apr 11 10:14:43 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 f7e40aa..21debdb 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 272eae9..d1cb9da 100644
--- a/server/char-device.h
+++ b/server/char-device.h
@@ -152,7 +152,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.9.3



More information about the Spice-devel mailing list