[Spice-devel] [spice-server v2 2/6] Make RedCharDeviceWriteBuffer::origin private
Christophe Fergeau
cfergeau at redhat.com
Fri Apr 28 09:10:58 UTC 2017
Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
---
server/char-device.c | 19 ++++++++++---------
server/char-device.h | 1 -
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/server/char-device.c b/server/char-device.c
index fa137e416..e3c3ef7aa 100644
--- a/server/char-device.c
+++ b/server/char-device.c
@@ -32,6 +32,7 @@
#define MAX_POOL_SIZE (10 * 64 * 1024)
struct RedCharDeviceWriteBufferPrivate {
+ int origin;
};
typedef struct RedCharDeviceClient RedCharDeviceClient;
@@ -164,7 +165,7 @@ static void red_char_device_write_buffer_pool_add(RedCharDevice *dev,
if (buf->refs == 1 &&
dev->priv->cur_pool_size < MAX_POOL_SIZE) {
buf->buf_used = 0;
- buf->origin = WRITE_BUFFER_ORIGIN_NONE;
+ buf->priv->origin = WRITE_BUFFER_ORIGIN_NONE;
buf->client = NULL;
dev->priv->cur_pool_size += buf->buf_size;
g_queue_push_head(&dev->priv->write_bufs_pool, buf);
@@ -192,7 +193,7 @@ static void red_char_device_client_free(RedCharDevice *dev,
RedCharDeviceWriteBuffer *write_buf = l->data;
next = l->next;
- if (write_buf->origin == WRITE_BUFFER_ORIGIN_CLIENT &&
+ if (write_buf->priv->origin == WRITE_BUFFER_ORIGIN_CLIENT &&
write_buf->client == dev_client->client) {
g_queue_delete_link(&dev->priv->write_queue, l);
red_char_device_write_buffer_pool_add(dev, write_buf);
@@ -200,9 +201,9 @@ static void red_char_device_client_free(RedCharDevice *dev,
l = next;
}
- if (dev->priv->cur_write_buf && dev->priv->cur_write_buf->origin == WRITE_BUFFER_ORIGIN_CLIENT &&
+ if (dev->priv->cur_write_buf && dev->priv->cur_write_buf->priv->origin == WRITE_BUFFER_ORIGIN_CLIENT &&
dev->priv->cur_write_buf->client == dev_client->client) {
- dev->priv->cur_write_buf->origin = WRITE_BUFFER_ORIGIN_NONE;
+ dev->priv->cur_write_buf->priv->origin = WRITE_BUFFER_ORIGIN_NONE;
dev->priv->cur_write_buf->client = NULL;
}
@@ -553,7 +554,7 @@ static RedCharDeviceWriteBuffer *__red_char_device_write_buffer_get(
ret->buf = spice_realloc(ret->buf, size);
ret->buf_size = size;
}
- ret->origin = origin;
+ ret->priv->origin = origin;
if (origin == WRITE_BUFFER_ORIGIN_CLIENT) {
spice_assert(client);
@@ -626,7 +627,7 @@ void red_char_device_write_buffer_add(RedCharDevice *dev,
{
spice_assert(dev);
/* caller shouldn't add buffers for client that was removed */
- if (write_buf->origin == WRITE_BUFFER_ORIGIN_CLIENT &&
+ if (write_buf->priv->origin == WRITE_BUFFER_ORIGIN_CLIENT &&
!red_char_device_client_find(dev, write_buf->client)) {
spice_printerr("client not found: dev %p client %p", dev, write_buf->client);
red_char_device_write_buffer_pool_add(dev, write_buf);
@@ -646,7 +647,7 @@ void red_char_device_write_buffer_release(RedCharDevice *dev,
}
*p_write_buf = NULL;
- int buf_origin = write_buf->origin;
+ int buf_origin = write_buf->priv->origin;
uint32_t buf_token_price = write_buf->token_price;
RedClient *client = write_buf->client;
@@ -903,7 +904,7 @@ void red_char_device_migrate_data_marshall(RedCharDevice *dev,
red_char_device_write_buffer_ref(dev->priv->cur_write_buf)
);
*write_to_dev_size_ptr += buf_remaining;
- if (dev->priv->cur_write_buf->origin == WRITE_BUFFER_ORIGIN_CLIENT) {
+ if (dev->priv->cur_write_buf->priv->origin == WRITE_BUFFER_ORIGIN_CLIENT) {
spice_assert(dev->priv->cur_write_buf->client == dev_client->client);
(*write_to_dev_tokens_ptr) += dev->priv->cur_write_buf->token_price;
}
@@ -917,7 +918,7 @@ void red_char_device_migrate_data_marshall(RedCharDevice *dev,
red_char_device_write_buffer_ref(write_buf)
);
*write_to_dev_size_ptr += write_buf->buf_used;
- if (write_buf->origin == WRITE_BUFFER_ORIGIN_CLIENT) {
+ if (write_buf->priv->origin == WRITE_BUFFER_ORIGIN_CLIENT) {
spice_assert(write_buf->client == dev_client->client);
(*write_to_dev_tokens_ptr) += write_buf->token_price;
}
diff --git a/server/char-device.h b/server/char-device.h
index 9bfd7c656..df15cfdff 100644
--- a/server/char-device.h
+++ b/server/char-device.h
@@ -148,7 +148,6 @@ 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.
NULL if the server created the message */
--
2.12.2
More information about the Spice-devel
mailing list