[Spice-devel] [spice-server v2 1/6] Add RedCharDeviceWriteBufferPrivate

Christophe Fergeau cfergeau at redhat.com
Fri Apr 28 09:10:57 UTC 2017


This is intended to hold the fields that only char-device.c has a use
for, but for now this only adds the boilerplate for it, the next commit
will move the relevant field there.

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

diff --git a/server/char-device.c b/server/char-device.c
index d32593209..fa137e416 100644
--- a/server/char-device.c
+++ b/server/char-device.c
@@ -31,6 +31,9 @@
 #define RED_CHAR_DEVICE_WAIT_TOKENS_TIMEOUT 30000
 #define MAX_POOL_SIZE (10 * 64 * 1024)
 
+struct RedCharDeviceWriteBufferPrivate {
+};
+
 typedef struct RedCharDeviceClient RedCharDeviceClient;
 struct RedCharDeviceClient {
     RedCharDevice *dev;
@@ -144,6 +147,7 @@ static void red_char_device_write_buffer_free(RedCharDeviceWriteBuffer *buf)
         return;
 
     free(buf->buf);
+    free(buf->priv);
     free(buf);
 }
 
@@ -540,6 +544,7 @@ static RedCharDeviceWriteBuffer *__red_char_device_write_buffer_get(
         dev->priv->cur_pool_size -= ret->buf_size;
     } else {
         ret = spice_new0(RedCharDeviceWriteBuffer, 1);
+        ret->priv = spice_new0(RedCharDeviceWriteBufferPrivate, 1);
     }
 
     spice_assert(!ret->buf_used);
diff --git a/server/char-device.h b/server/char-device.h
index 7854086c3..9bfd7c656 100644
--- a/server/char-device.h
+++ b/server/char-device.h
@@ -146,6 +146,7 @@ GType red_char_device_get_type(void) G_GNUC_CONST;
  * */
 
 /* buffer that is used for writing to the device */
+typedef struct RedCharDeviceWriteBufferPrivate RedCharDeviceWriteBufferPrivate;
 typedef struct RedCharDeviceWriteBuffer {
     int origin;
     RedClient *client; /* The client that sent the message to the device.
@@ -156,6 +157,8 @@ typedef struct RedCharDeviceWriteBuffer {
     uint32_t buf_used;
     uint32_t token_price;
     uint32_t refs;
+
+    RedCharDeviceWriteBufferPrivate *priv;
 } RedCharDeviceWriteBuffer;
 
 void red_char_device_reset_dev_instance(RedCharDevice *dev,
-- 
2.12.2



More information about the Spice-devel mailing list