[Spice-devel] [PATCH v2 05/15] Rename RedCharDevice functions
Frediano Ziglio
fziglio at redhat.com
Fri Apr 1 10:58:40 UTC 2016
>
> make the function names match the type names. So
> spice_char_device_state_* becomes red_char_device_* and
> spice_char_device_* also becomes red_char_device_*.
> ---
> server/char-device.c | 320
> +++++++++++++++++++++++++--------------------------
> server/char-device.h | 108 ++++++++---------
> server/reds.c | 116 +++++++++----------
> server/smartcard.c | 60 +++++-----
> server/spicevmc.c | 44 +++----
> 5 files changed, 324 insertions(+), 324 deletions(-)
>
> diff --git a/server/char-device.c b/server/char-device.c
> index 59b5d32..3056f51 100644
> --- a/server/char-device.c
> +++ b/server/char-device.c
> @@ -27,7 +27,7 @@
> #include "reds.h"
>
> #define CHAR_DEVICE_WRITE_TO_TIMEOUT 100
> -#define SPICE_CHAR_DEVICE_WAIT_TOKENS_TIMEOUT 30000
> +#define RED_CHAR_DEVICE_WAIT_TOKENS_TIMEOUT 30000
> #define MAX_POOL_SIZE (10 * 64 * 1024)
>
> typedef struct RedCharDeviceClient RedCharDeviceClient;
> @@ -88,8 +88,8 @@ enum {
>
> /* Holding references for avoiding access violation if the char device was
> * destroyed during a callback */
> -static void spice_char_device_state_ref(RedCharDevice *char_dev);
> -static void spice_char_device_state_unref(RedCharDevice *char_dev);
> +static void red_char_device_ref(RedCharDevice *char_dev);
> +static void red_char_device_unref(RedCharDevice *char_dev);
> static void red_char_device_write_buffer_unref(RedCharDeviceWriteBuffer
> *write_buf);
>
> static void spice_char_dev_write_retry(void *opaque);
> @@ -100,43 +100,43 @@ typedef struct RedCharDeviceMsgToClientItem {
> } RedCharDeviceMsgToClientItem;
>
> static RedCharDeviceMsgToClient *
> -spice_char_device_read_one_msg_from_device(RedCharDevice *dev)
> +red_char_device_read_one_msg_from_device(RedCharDevice *dev)
> {
> return dev->priv->cbs.read_one_msg_from_device(dev->priv->sin,
> dev->priv->opaque);
> }
>
> static RedCharDeviceMsgToClient *
> -spice_char_device_ref_msg_to_client(RedCharDevice *dev,
> - RedCharDeviceMsgToClient *msg)
> +red_char_device_ref_msg_to_client(RedCharDevice *dev,
> + RedCharDeviceMsgToClient *msg)
> {
> return dev->priv->cbs.ref_msg_to_client(msg, dev->priv->opaque);
> }
>
> static void
> -spice_char_device_unref_msg_to_client(RedCharDevice *dev,
> - RedCharDeviceMsgToClient *msg)
> +red_char_device_unref_msg_to_client(RedCharDevice *dev,
> + RedCharDeviceMsgToClient *msg)
> {
> dev->priv->cbs.unref_msg_to_client(msg, dev->priv->opaque);
> }
>
> static void
> -spice_char_device_send_msg_to_client(RedCharDevice *dev,
> - RedCharDeviceMsgToClient *msg,
> - RedClient *client)
> +red_char_device_send_msg_to_client(RedCharDevice *dev,
> + RedCharDeviceMsgToClient *msg,
> + RedClient *client)
> {
> dev->priv->cbs.send_msg_to_client(msg, client, dev->priv->opaque);
> }
>
> static void
> -spice_char_device_send_tokens_to_client(RedCharDevice *dev,
> - RedClient *client,
> - uint32_t tokens)
> +red_char_device_send_tokens_to_client(RedCharDevice *dev,
> + RedClient *client,
> + uint32_t tokens)
> {
> dev->priv->cbs.send_tokens_to_client(client, tokens, dev->priv->opaque);
> }
>
> static void
> -spice_char_device_on_free_self_token(RedCharDevice *dev)
> +red_char_device_on_free_self_token(RedCharDevice *dev)
> {
> if (dev->priv->cbs.on_free_self_token != NULL) {
> dev->priv->cbs.on_free_self_token(dev->priv->opaque);
> @@ -144,7 +144,7 @@ spice_char_device_on_free_self_token(RedCharDevice *dev)
> }
>
> static void
> -spice_char_device_remove_client(RedCharDevice *dev, RedClient *client)
> +red_char_device_remove_client(RedCharDevice *dev, RedClient *client)
> {
> dev->priv->cbs.remove_client(client, dev->priv->opaque);
> }
> @@ -170,8 +170,8 @@ static void write_buffers_queue_free(Ring *write_queue)
> }
> }
>
> -static void spice_char_device_write_buffer_pool_add(RedCharDevice *dev,
> - RedCharDeviceWriteBuffer
> *buf)
> +static void red_char_device_write_buffer_pool_add(RedCharDevice *dev,
> + RedCharDeviceWriteBuffer
> *buf)
> {
> if (buf->refs == 1 &&
> dev->priv->cur_pool_size < MAX_POOL_SIZE) {
> @@ -187,8 +187,8 @@ static void
> spice_char_device_write_buffer_pool_add(RedCharDevice *dev,
> red_char_device_write_buffer_unref(buf);
> }
>
> -static void spice_char_device_client_send_queue_free(RedCharDevice *dev,
> - RedCharDeviceClient
> *dev_client)
> +static void red_char_device_client_send_queue_free(RedCharDevice *dev,
> + RedCharDeviceClient
> *dev_client)
> {
> spice_debug("send_queue_empty %d",
> ring_is_empty(&dev_client->send_queue));
> while (!ring_is_empty(&dev_client->send_queue)) {
> @@ -198,15 +198,15 @@ static void
> spice_char_device_client_send_queue_free(RedCharDevice *dev,
> link);
>
> ring_remove(item);
> - spice_char_device_unref_msg_to_client(dev, msg_item->msg);
> + red_char_device_unref_msg_to_client(dev, msg_item->msg);
> free(msg_item);
> }
> dev_client->num_send_tokens += dev_client->send_queue_size;
> dev_client->send_queue_size = 0;
> }
>
> -static void spice_char_device_client_free(RedCharDevice *dev,
> - RedCharDeviceClient *dev_client)
> +static void red_char_device_client_free(RedCharDevice *dev,
> + RedCharDeviceClient *dev_client)
> {
> RingItem *item, *next;
>
> @@ -214,7 +214,7 @@ static void spice_char_device_client_free(RedCharDevice
> *dev,
> reds_core_timer_remove(dev->priv->reds,
> dev_client->wait_for_tokens_timer);
> }
>
> - spice_char_device_client_send_queue_free(dev, dev_client);
> + red_char_device_client_send_queue_free(dev, dev_client);
>
> /* remove write buffers that are associated with the client */
> spice_debug("write_queue_is_empty %d",
> ring_is_empty(&dev->priv->write_queue) && !dev->priv->cur_write_buf);
> @@ -225,7 +225,7 @@ static void spice_char_device_client_free(RedCharDevice
> *dev,
> if (write_buf->origin == WRITE_BUFFER_ORIGIN_CLIENT &&
> write_buf->client == dev_client->client) {
> ring_remove(item);
> - spice_char_device_write_buffer_pool_add(dev, write_buf);
> + red_char_device_write_buffer_pool_add(dev, write_buf);
> }
> }
>
> @@ -240,15 +240,15 @@ static void spice_char_device_client_free(RedCharDevice
> *dev,
> free(dev_client);
> }
>
> -static void spice_char_device_handle_client_overflow(RedCharDeviceClient
> *dev_client)
> +static void red_char_device_handle_client_overflow(RedCharDeviceClient
> *dev_client)
> {
> RedCharDevice *dev = dev_client->dev;
> spice_printerr("dev %p client %p ", dev, dev_client);
> - spice_char_device_remove_client(dev, dev_client->client);
> + red_char_device_remove_client(dev, dev_client->client);
> }
>
> -static RedCharDeviceClient *spice_char_device_client_find(RedCharDevice
> *dev,
> - RedClient *client)
> +static RedCharDeviceClient *red_char_device_client_find(RedCharDevice *dev,
> + RedClient *client)
> {
> RingItem *item;
>
> @@ -271,15 +271,15 @@ static void device_client_wait_for_tokens_timeout(void
> *opaque)
> {
> RedCharDeviceClient *dev_client = opaque;
>
> - spice_char_device_handle_client_overflow(dev_client);
> + red_char_device_handle_client_overflow(dev_client);
> }
>
> -static int spice_char_device_can_send_to_client(RedCharDeviceClient
> *dev_client)
> +static int red_char_device_can_send_to_client(RedCharDeviceClient
> *dev_client)
> {
> return !dev_client->do_flow_control || dev_client->num_send_tokens;
> }
>
> -static uint64_t spice_char_device_max_send_tokens(RedCharDevice *dev)
> +static uint64_t red_char_device_max_send_tokens(RedCharDevice *dev)
> {
> RingItem *item;
> uint64_t max = 0;
> @@ -301,30 +301,30 @@ static uint64_t
> spice_char_device_max_send_tokens(RedCharDevice *dev)
> return max;
> }
>
> -static void spice_char_device_add_msg_to_client_queue(RedCharDeviceClient
> *dev_client,
> -
> RedCharDeviceMsgToClient
> *msg)
> +static void red_char_device_add_msg_to_client_queue(RedCharDeviceClient
> *dev_client,
> + RedCharDeviceMsgToClient
> *msg)
> {
> RedCharDevice *dev = dev_client->dev;
> RedCharDeviceMsgToClientItem *msg_item;
>
> if (dev_client->send_queue_size >= dev_client->max_send_queue_size) {
> - spice_char_device_handle_client_overflow(dev_client);
> + red_char_device_handle_client_overflow(dev_client);
> return;
> }
>
> msg_item = spice_new0(RedCharDeviceMsgToClientItem, 1);
> - msg_item->msg = spice_char_device_ref_msg_to_client(dev, msg);
> + msg_item->msg = red_char_device_ref_msg_to_client(dev, msg);
> ring_add(&dev_client->send_queue, &msg_item->link);
> dev_client->send_queue_size++;
> if (!dev_client->wait_for_tokens_started) {
> reds_core_timer_start(dev->priv->reds,
> dev_client->wait_for_tokens_timer,
> - SPICE_CHAR_DEVICE_WAIT_TOKENS_TIMEOUT);
> + RED_CHAR_DEVICE_WAIT_TOKENS_TIMEOUT);
> dev_client->wait_for_tokens_started = TRUE;
> }
> }
>
> -static void spice_char_device_send_msg_to_clients(RedCharDevice *dev,
> - RedCharDeviceMsgToClient
> *msg)
> +static void red_char_device_send_msg_to_clients(RedCharDevice *dev,
> + RedCharDeviceMsgToClient
> *msg)
> {
> RingItem *item, *next;
>
> @@ -332,19 +332,19 @@ static void
> spice_char_device_send_msg_to_clients(RedCharDevice *dev,
> RedCharDeviceClient *dev_client;
>
> dev_client = SPICE_CONTAINEROF(item, RedCharDeviceClient, link);
> - if (spice_char_device_can_send_to_client(dev_client)) {
> + if (red_char_device_can_send_to_client(dev_client)) {
> dev_client->num_send_tokens--;
> spice_assert(ring_is_empty(&dev_client->send_queue));
> - spice_char_device_send_msg_to_client(dev, msg,
> dev_client->client);
> + red_char_device_send_msg_to_client(dev, msg,
> dev_client->client);
>
> /* don't refer to dev_client anymore, it may have been released
> */
> } else {
> - spice_char_device_add_msg_to_client_queue(dev_client, msg);
> + red_char_device_add_msg_to_client_queue(dev_client, msg);
> }
> }
> }
>
> -static int spice_char_device_read_from_device(RedCharDevice *dev)
> +static int red_char_device_read_from_device(RedCharDevice *dev)
> {
> uint64_t max_send_tokens;
> int did_read = FALSE;
> @@ -363,8 +363,8 @@ static int
> spice_char_device_read_from_device(RedCharDevice *dev)
> return FALSE;
> }
>
> - max_send_tokens = spice_char_device_max_send_tokens(dev);
> - spice_char_device_state_ref(dev);
> + max_send_tokens = red_char_device_max_send_tokens(dev);
> + red_char_device_ref(dev);
> /*
> * Reading from the device only in case at least one of the clients have
> a free token.
> * All messages will be discarded if no client is attached to the device
> @@ -372,7 +372,7 @@ static int
> spice_char_device_read_from_device(RedCharDevice *dev)
> while ((max_send_tokens || ring_is_empty(&dev->priv->clients)) &&
> dev->priv->running) {
> RedCharDeviceMsgToClient *msg;
>
> - msg = spice_char_device_read_one_msg_from_device(dev);
> + msg = red_char_device_read_one_msg_from_device(dev);
> if (!msg) {
> if (dev->priv->during_read_from_device > 1) {
> dev->priv->during_read_from_device = 1;
> @@ -382,82 +382,82 @@ static int
> spice_char_device_read_from_device(RedCharDevice *dev)
> break;
> }
> did_read = TRUE;
> - spice_char_device_send_msg_to_clients(dev, msg);
> - spice_char_device_unref_msg_to_client(dev, msg);
> + red_char_device_send_msg_to_clients(dev, msg);
> + red_char_device_unref_msg_to_client(dev, msg);
> max_send_tokens--;
> }
> dev->priv->during_read_from_device = 0;
> if (dev->priv->running) {
> dev->priv->active = dev->priv->active || did_read;
> }
> - spice_char_device_state_unref(dev);
> + red_char_device_unref(dev);
> return did_read;
> }
>
> -static void spice_char_device_client_send_queue_push(RedCharDeviceClient
> *dev_client)
> +static void red_char_device_client_send_queue_push(RedCharDeviceClient
> *dev_client)
> {
> RingItem *item;
> while ((item = ring_get_tail(&dev_client->send_queue)) &&
> - spice_char_device_can_send_to_client(dev_client)) {
> + red_char_device_can_send_to_client(dev_client)) {
> RedCharDeviceMsgToClientItem *msg_item;
>
> msg_item = SPICE_CONTAINEROF(item, RedCharDeviceMsgToClientItem,
> link);
> ring_remove(item);
>
> dev_client->num_send_tokens--;
> - spice_char_device_send_msg_to_client(dev_client->dev,
> - msg_item->msg,
> - dev_client->client);
> - spice_char_device_unref_msg_to_client(dev_client->dev,
> msg_item->msg);
> + red_char_device_send_msg_to_client(dev_client->dev,
> + msg_item->msg,
> + dev_client->client);
> + red_char_device_unref_msg_to_client(dev_client->dev, msg_item->msg);
> dev_client->send_queue_size--;
> free(msg_item);
> }
> }
>
> -static void
> spice_char_device_send_to_client_tokens_absorb(RedCharDeviceClient
> *dev_client,
> - uint32_t tokens)
> +static void red_char_device_send_to_client_tokens_absorb(RedCharDeviceClient
> *dev_client,
> + uint32_t tokens)
> {
> RedCharDevice *dev = dev_client->dev;
> dev_client->num_send_tokens += tokens;
>
> if (dev_client->send_queue_size) {
> spice_assert(dev_client->num_send_tokens == tokens);
> - spice_char_device_client_send_queue_push(dev_client);
> + red_char_device_client_send_queue_push(dev_client);
> }
>
> - if (spice_char_device_can_send_to_client(dev_client)) {
> + if (red_char_device_can_send_to_client(dev_client)) {
> reds_core_timer_cancel(dev->priv->reds,
> dev_client->wait_for_tokens_timer);
> dev_client->wait_for_tokens_started = FALSE;
> - spice_char_device_read_from_device(dev_client->dev);
> + red_char_device_read_from_device(dev_client->dev);
> } else if (dev_client->send_queue_size) {
> reds_core_timer_start(dev->priv->reds,
> dev_client->wait_for_tokens_timer,
> - SPICE_CHAR_DEVICE_WAIT_TOKENS_TIMEOUT);
> + RED_CHAR_DEVICE_WAIT_TOKENS_TIMEOUT);
> dev_client->wait_for_tokens_started = TRUE;
> }
> }
>
> -void spice_char_device_send_to_client_tokens_add(RedCharDevice *dev,
> - RedClient *client,
> - uint32_t tokens)
> +void red_char_device_send_to_client_tokens_add(RedCharDevice *dev,
> + RedClient *client,
> + uint32_t tokens)
> {
> RedCharDeviceClient *dev_client;
>
> - dev_client = spice_char_device_client_find(dev, client);
> + dev_client = red_char_device_client_find(dev, client);
>
> if (!dev_client) {
> spice_error("client wasn't found dev %p client %p", dev, client);
> return;
> }
> - spice_char_device_send_to_client_tokens_absorb(dev_client, tokens);
> + red_char_device_send_to_client_tokens_absorb(dev_client, tokens);
> }
>
> -void spice_char_device_send_to_client_tokens_set(RedCharDevice *dev,
> - RedClient *client,
> - uint32_t tokens)
> +void red_char_device_send_to_client_tokens_set(RedCharDevice *dev,
> + RedClient *client,
> + uint32_t tokens)
> {
> RedCharDeviceClient *dev_client;
>
> - dev_client = spice_char_device_client_find(dev, client);
> + dev_client = red_char_device_client_find(dev, client);
>
> if (!dev_client) {
> spice_error("client wasn't found dev %p client %p", dev, client);
> @@ -465,16 +465,16 @@ void
> spice_char_device_send_to_client_tokens_set(RedCharDevice *dev,
> }
>
> dev_client->num_send_tokens = 0;
> - spice_char_device_send_to_client_tokens_absorb(dev_client, tokens);
> + red_char_device_send_to_client_tokens_absorb(dev_client, tokens);
> }
>
> /**************************
> * Writing to the device *
> ***************************/
>
> -static void spice_char_device_client_tokens_add(RedCharDevice *dev,
> - RedCharDeviceClient
> *dev_client,
> - uint32_t num_tokens)
> +static void red_char_device_client_tokens_add(RedCharDevice *dev,
> + RedCharDeviceClient
> *dev_client,
> + uint32_t num_tokens)
> {
> if (!dev_client->do_flow_control) {
> return;
> @@ -488,11 +488,11 @@ static void
> spice_char_device_client_tokens_add(RedCharDevice *dev,
>
> dev_client->num_client_tokens += dev_client->num_client_tokens_free;
> dev_client->num_client_tokens_free = 0;
> - spice_char_device_send_tokens_to_client(dev, dev_client->client,
> tokens);
> + red_char_device_send_tokens_to_client(dev, dev_client->client,
> tokens);
> }
> }
>
> -static int spice_char_device_write_to_device(RedCharDevice *dev)
> +static int red_char_device_write_to_device(RedCharDevice *dev)
> {
> SpiceCharDeviceInterface *sif;
> int total = 0;
> @@ -502,12 +502,12 @@ static int
> spice_char_device_write_to_device(RedCharDevice *dev)
> return 0;
> }
>
> - /* protect against recursion with spice_char_device_wakeup */
> + /* protect against recursion with red_char_device_wakeup */
> if (dev->priv->during_write_to_device++ > 0) {
> return 0;
> }
>
> - spice_char_device_state_ref(dev);
> + red_char_device_ref(dev);
>
> if (dev->priv->write_to_dev_timer) {
> reds_core_timer_cancel(dev->priv->reds,
> dev->priv->write_to_dev_timer);
> @@ -543,7 +543,7 @@ static int
> spice_char_device_write_to_device(RedCharDevice *dev)
> if (!write_len) {
> RedCharDeviceWriteBuffer *release_buf =
> dev->priv->cur_write_buf;
> dev->priv->cur_write_buf = NULL;
> - spice_char_device_write_buffer_release(dev, release_buf);
> + red_char_device_write_buffer_release(dev, release_buf);
> continue;
> }
> dev->priv->cur_write_buf_pos += n;
> @@ -561,7 +561,7 @@ static int
> spice_char_device_write_to_device(RedCharDevice *dev)
> dev->priv->active = dev->priv->active || total;
> }
> dev->priv->during_write_to_device = 0;
> - spice_char_device_state_unref(dev);
> + red_char_device_unref(dev);
> return total;
> }
>
> @@ -572,10 +572,10 @@ static void spice_char_dev_write_retry(void *opaque)
> if (dev->priv->write_to_dev_timer) {
> reds_core_timer_cancel(dev->priv->reds,
> dev->priv->write_to_dev_timer);
> }
> - spice_char_device_write_to_device(dev);
> + red_char_device_write_to_device(dev);
> }
>
> -static RedCharDeviceWriteBuffer *__spice_char_device_write_buffer_get(
> +static RedCharDeviceWriteBuffer *__red_char_device_write_buffer_get(
> RedCharDevice *dev, RedClient *client,
> int size, int origin, int migrated_data_tokens)
> {
> @@ -604,12 +604,12 @@ static RedCharDeviceWriteBuffer
> *__spice_char_device_write_buffer_get(
>
> if (origin == WRITE_BUFFER_ORIGIN_CLIENT) {
> spice_assert(client);
> - RedCharDeviceClient *dev_client = spice_char_device_client_find(dev,
> client);
> + RedCharDeviceClient *dev_client = red_char_device_client_find(dev,
> client);
> if (dev_client) {
> if (!migrated_data_tokens &&
> dev_client->do_flow_control &&
> !dev_client->num_client_tokens) {
> spice_printerr("token violation: dev %p client %p", dev,
> client);
> - spice_char_device_handle_client_overflow(dev_client);
> + red_char_device_handle_client_overflow(dev_client);
> goto error;
> }
> ret->client = client;
> @@ -635,19 +635,19 @@ error:
> return NULL;
> }
>
> -RedCharDeviceWriteBuffer *spice_char_device_write_buffer_get(RedCharDevice
> *dev,
> - RedClient
> *client,
> - int size)
> +RedCharDeviceWriteBuffer *red_char_device_write_buffer_get(RedCharDevice
> *dev,
> + RedClient
> *client,
> + int size)
> {
> - return __spice_char_device_write_buffer_get(dev, client, size,
> + return __red_char_device_write_buffer_get(dev, client, size,
> client ? WRITE_BUFFER_ORIGIN_CLIENT :
> WRITE_BUFFER_ORIGIN_SERVER,
> 0);
> }
>
> -RedCharDeviceWriteBuffer
> *spice_char_device_write_buffer_get_server_no_token(
> +RedCharDeviceWriteBuffer *red_char_device_write_buffer_get_server_no_token(
> RedCharDevice *dev, int size)
> {
> - return __spice_char_device_write_buffer_get(dev, NULL, size,
> + return __red_char_device_write_buffer_get(dev, NULL, size,
> WRITE_BUFFER_ORIGIN_SERVER_NO_TOKEN, 0);
> }
>
> @@ -668,24 +668,24 @@ static void
> red_char_device_write_buffer_unref(RedCharDeviceWriteBuffer *write_b
> red_char_device_write_buffer_free(write_buf);
> }
>
> -void spice_char_device_write_buffer_add(RedCharDevice *dev,
> - RedCharDeviceWriteBuffer *write_buf)
> +void red_char_device_write_buffer_add(RedCharDevice *dev,
> + RedCharDeviceWriteBuffer *write_buf)
> {
> spice_assert(dev);
> /* caller shouldn't add buffers for client that was removed */
> if (write_buf->origin == WRITE_BUFFER_ORIGIN_CLIENT &&
> - !spice_char_device_client_find(dev, write_buf->client)) {
> + !red_char_device_client_find(dev, write_buf->client)) {
> spice_printerr("client not found: dev %p client %p", dev,
> write_buf->client);
> - spice_char_device_write_buffer_pool_add(dev, write_buf);
> + red_char_device_write_buffer_pool_add(dev, write_buf);
> return;
> }
>
> ring_add(&dev->priv->write_queue, &write_buf->link);
> - spice_char_device_write_to_device(dev);
> + red_char_device_write_to_device(dev);
> }
>
> -void spice_char_device_write_buffer_release(RedCharDevice *dev,
> - RedCharDeviceWriteBuffer
> *write_buf)
> +void red_char_device_write_buffer_release(RedCharDevice *dev,
> + RedCharDeviceWriteBuffer
> *write_buf)
> {
> int buf_origin = write_buf->origin;
> uint32_t buf_token_price = write_buf->token_price;
> @@ -700,18 +700,18 @@ void
> spice_char_device_write_buffer_release(RedCharDevice *dev,
>
> spice_assert(dev->priv->cur_write_buf != write_buf);
>
> - spice_char_device_write_buffer_pool_add(dev, write_buf);
> + red_char_device_write_buffer_pool_add(dev, write_buf);
> if (buf_origin == WRITE_BUFFER_ORIGIN_CLIENT) {
> RedCharDeviceClient *dev_client;
>
> spice_assert(client);
> - dev_client = spice_char_device_client_find(dev, client);
> + dev_client = red_char_device_client_find(dev, client);
> /* when a client is removed, we remove all the buffers that are
> associated with it */
> spice_assert(dev_client);
> - spice_char_device_client_tokens_add(dev, dev_client,
> buf_token_price);
> + red_char_device_client_tokens_add(dev, dev_client, buf_token_price);
> } else if (buf_origin == WRITE_BUFFER_ORIGIN_SERVER) {
> dev->priv->num_self_tokens++;
> - spice_char_device_on_free_self_token(dev);
> + red_char_device_on_free_self_token(dev);
> }
> }
>
> @@ -719,12 +719,12 @@ void
> spice_char_device_write_buffer_release(RedCharDevice *dev,
> * char_device_state management *
> ********************************/
>
> -RedCharDevice *spice_char_device_state_create(SpiceCharDeviceInstance *sin,
> - RedsState *reds,
> - uint32_t
> client_tokens_interval,
> - uint32_t self_tokens,
> - SpiceCharDeviceCallbacks *cbs,
> - void *opaque)
> +RedCharDevice *red_char_device_create(SpiceCharDeviceInstance *sin,
> + RedsState *reds,
> + uint32_t client_tokens_interval,
> + uint32_t self_tokens,
> + SpiceCharDeviceCallbacks *cbs,
> + void *opaque)
> {
> RedCharDevice *char_dev;
> SpiceCharDeviceInterface *sif;
> @@ -761,39 +761,39 @@ RedCharDevice
> *spice_char_device_state_create(SpiceCharDeviceInstance *sin,
> return char_dev;
> }
>
> -void spice_char_device_state_reset_dev_instance(RedCharDevice *state,
> - SpiceCharDeviceInstance
> *sin)
> +void red_char_device_reset_dev_instance(RedCharDevice *state,
> + SpiceCharDeviceInstance *sin)
> {
> spice_debug("sin %p dev_state %p", sin, state);
> state->priv->sin = sin;
> sin->st = state;
> }
>
> -void *spice_char_device_state_opaque_get(RedCharDevice *dev)
> +void *red_char_device_opaque_get(RedCharDevice *dev)
> {
> return dev->priv->opaque;
> }
>
> -static void spice_char_device_state_ref(RedCharDevice *char_dev)
> +static void red_char_device_ref(RedCharDevice *char_dev)
> {
> char_dev->priv->refs++;
> }
>
> -static void spice_char_device_state_unref(RedCharDevice *char_dev)
> +static void red_char_device_unref(RedCharDevice *char_dev)
> {
> /* The refs field protects the char_dev from being deallocated in
> - * case spice_char_device_state_destroy has been called
> + * case red_char_device_destroy has been called
> * during a callabck, and we might still access the char_dev afterwards.
> - * spice_char_device_state_unref is always coupled with a preceding
> - * spice_char_device_state_ref. Here, refs can turn 0
> - * only when spice_char_device_state_destroy is called in between
> - * the calls to spice_char_device_state_ref and
> spice_char_device_state_unref.*/
> + * red_char_device_unref is always coupled with a preceding
> + * red_char_device_ref. Here, refs can turn 0
> + * only when red_char_device_destroy is called in between
> + * the calls to red_char_device_ref and red_char_device_unref.*/
> if (!--char_dev->priv->refs) {
> free(char_dev);
> }
> }
>
> -void spice_char_device_state_destroy(RedCharDevice *char_dev)
> +void red_char_device_destroy(RedCharDevice *char_dev)
> {
> reds_on_char_device_state_destroy(char_dev->priv->reds, char_dev);
> if (char_dev->priv->write_to_dev_timer) {
> @@ -811,11 +811,11 @@ void spice_char_device_state_destroy(RedCharDevice
> *char_dev)
> RedCharDeviceClient *dev_client;
>
> dev_client = SPICE_CONTAINEROF(item, RedCharDeviceClient, link);
> - spice_char_device_client_free(char_dev, dev_client);
> + red_char_device_client_free(char_dev, dev_client);
> }
> char_dev->priv->running = FALSE;
>
> - spice_char_device_state_unref(char_dev);
> + red_char_device_unref(char_dev);
> }
>
> static RedCharDeviceClient *red_char_device_client_new(RedClient *client,
> @@ -849,13 +849,13 @@ static RedCharDeviceClient
> *red_char_device_client_new(RedClient *client,
> return dev_client;
> }
>
> -int spice_char_device_client_add(RedCharDevice *dev,
> - RedClient *client,
> - int do_flow_control,
> - uint32_t max_send_queue_size,
> - uint32_t num_client_tokens,
> - uint32_t num_send_tokens,
> - int wait_for_migrate_data)
> +int red_char_device_client_add(RedCharDevice *dev,
> + RedClient *client,
> + int do_flow_control,
> + uint32_t max_send_queue_size,
> + uint32_t num_client_tokens,
> + uint32_t num_send_tokens,
> + int wait_for_migrate_data)
> {
> RedCharDeviceClient *dev_client;
>
> @@ -879,27 +879,27 @@ int spice_char_device_client_add(RedCharDevice *dev,
> ring_add(&dev->priv->clients, &dev_client->link);
> dev->priv->num_clients++;
> /* Now that we have a client, forward any pending device data */
> - spice_char_device_wakeup(dev);
> + red_char_device_wakeup(dev);
> return TRUE;
> }
>
> -void spice_char_device_client_remove(RedCharDevice *dev,
> - RedClient *client)
> +void red_char_device_client_remove(RedCharDevice *dev,
> + RedClient *client)
> {
> RedCharDeviceClient *dev_client;
>
> spice_debug("dev_state %p client %p", dev, client);
> - dev_client = spice_char_device_client_find(dev, client);
> + dev_client = red_char_device_client_find(dev, client);
>
> if (!dev_client) {
> spice_error("client wasn't found");
> return;
> }
> - spice_char_device_client_free(dev, dev_client);
> + red_char_device_client_free(dev, dev_client);
> if (dev->priv->wait_for_migrate_data) {
> spice_assert(dev->priv->num_clients == 0);
> dev->priv->wait_for_migrate_data = FALSE;
> - spice_char_device_read_from_device(dev);
> + red_char_device_read_from_device(dev);
> }
>
> if (dev->priv->num_clients == 0) {
> @@ -909,23 +909,23 @@ void spice_char_device_client_remove(RedCharDevice
> *dev,
> }
> }
>
> -int spice_char_device_client_exists(RedCharDevice *dev,
> - RedClient *client)
> +int red_char_device_client_exists(RedCharDevice *dev,
> + RedClient *client)
> {
> - return (spice_char_device_client_find(dev, client) != NULL);
> + return (red_char_device_client_find(dev, client) != NULL);
> }
>
> -void spice_char_device_start(RedCharDevice *dev)
> +void red_char_device_start(RedCharDevice *dev)
> {
> spice_debug("dev_state %p", dev);
> dev->priv->running = TRUE;
> - spice_char_device_state_ref(dev);
> - while (spice_char_device_write_to_device(dev) ||
> - spice_char_device_read_from_device(dev));
> - spice_char_device_state_unref(dev);
> + red_char_device_ref(dev);
> + while (red_char_device_write_to_device(dev) ||
> + red_char_device_read_from_device(dev));
> + red_char_device_unref(dev);
> }
>
> -void spice_char_device_stop(RedCharDevice *dev)
> +void red_char_device_stop(RedCharDevice *dev)
> {
> spice_debug("dev_state %p", dev);
> dev->priv->running = FALSE;
> @@ -935,11 +935,11 @@ void spice_char_device_stop(RedCharDevice *dev)
> }
> }
>
> -void spice_char_device_reset(RedCharDevice *dev)
> +void red_char_device_reset(RedCharDevice *dev)
> {
> RingItem *client_item;
>
> - spice_char_device_stop(dev);
> + red_char_device_stop(dev);
> dev->priv->wait_for_migrate_data = FALSE;
> spice_debug("dev_state %p", dev);
> while (!ring_is_empty(&dev->priv->write_queue)) {
> @@ -949,35 +949,35 @@ void spice_char_device_reset(RedCharDevice *dev)
> ring_remove(item);
> buf = SPICE_CONTAINEROF(item, RedCharDeviceWriteBuffer, link);
> /* tracking the tokens */
> - spice_char_device_write_buffer_release(dev, buf);
> + red_char_device_write_buffer_release(dev, buf);
> }
> if (dev->priv->cur_write_buf) {
> RedCharDeviceWriteBuffer *release_buf = dev->priv->cur_write_buf;
>
> dev->priv->cur_write_buf = NULL;
> - spice_char_device_write_buffer_release(dev, release_buf);
> + red_char_device_write_buffer_release(dev, release_buf);
> }
>
> RING_FOREACH(client_item, &dev->priv->clients) {
> RedCharDeviceClient *dev_client;
>
> dev_client = SPICE_CONTAINEROF(client_item, RedCharDeviceClient,
> link);
> - spice_char_device_client_send_queue_free(dev, dev_client);
> + red_char_device_client_send_queue_free(dev, dev_client);
> }
> dev->priv->sin = NULL;
> }
>
> -void spice_char_device_wakeup(RedCharDevice *dev)
> +void red_char_device_wakeup(RedCharDevice *dev)
> {
> - spice_char_device_write_to_device(dev);
> - spice_char_device_read_from_device(dev);
> + red_char_device_write_to_device(dev);
> + red_char_device_read_from_device(dev);
> }
>
> /*************
> * Migration *
> * **********/
>
> -void spice_char_device_state_migrate_data_marshall_empty(SpiceMarshaller *m)
> +void red_char_device_migrate_data_marshall_empty(SpiceMarshaller *m)
> {
> SpiceMigrateDataCharDevice *mig_data;
>
> @@ -996,8 +996,8 @@ static void
> migrate_data_marshaller_write_buffer_free(uint8_t *data, void *opaqu
> red_char_device_write_buffer_unref(write_buf);
> }
>
> -void spice_char_device_state_migrate_data_marshall(RedCharDevice *dev,
> - SpiceMarshaller *m)
> +void red_char_device_migrate_data_marshall(RedCharDevice *dev,
> + SpiceMarshaller *m)
> {
> RedCharDeviceClient *dev_client;
> RingItem *item;
> @@ -1056,8 +1056,8 @@ void
> spice_char_device_state_migrate_data_marshall(RedCharDevice *dev,
> dev, *write_to_dev_size_ptr, *write_to_dev_tokens_ptr);
> }
>
> -int spice_char_device_state_restore(RedCharDevice *dev,
> - SpiceMigrateDataCharDevice *mig_data)
> +int red_char_device_restore(RedCharDevice *dev,
> + SpiceMigrateDataCharDevice *mig_data)
> {
> RedCharDeviceClient *dev_client;
> uint32_t client_tokens_window;
> @@ -1086,12 +1086,12 @@ int spice_char_device_state_restore(RedCharDevice
> *dev,
> if (mig_data->write_size > 0) {
> if (mig_data->write_num_client_tokens) {
> dev->priv->cur_write_buf =
> - __spice_char_device_write_buffer_get(dev,
> dev_client->client,
> + __red_char_device_write_buffer_get(dev, dev_client->client,
> mig_data->write_size, WRITE_BUFFER_ORIGIN_CLIENT,
> mig_data->write_num_client_tokens);
> } else {
> dev->priv->cur_write_buf =
> - __spice_char_device_write_buffer_get(dev, NULL,
> + __red_char_device_write_buffer_get(dev, NULL,
> mig_data->write_size, WRITE_BUFFER_ORIGIN_SERVER, 0);
> }
> /* the first write buffer contains all the data that was saved for
> migration */
> @@ -1102,12 +1102,12 @@ int spice_char_device_state_restore(RedCharDevice
> *dev,
> dev->priv->cur_write_buf_pos = dev->priv->cur_write_buf->buf;
> }
> dev->priv->wait_for_migrate_data = FALSE;
> - spice_char_device_write_to_device(dev);
> - spice_char_device_read_from_device(dev);
> + red_char_device_write_to_device(dev);
> + red_char_device_read_from_device(dev);
> return TRUE;
> }
>
> -SpiceServer* spice_char_device_get_server(RedCharDevice *dev)
> +SpiceServer* red_char_device_get_server(RedCharDevice *dev)
> {
> return dev->priv->reds;
> }
> diff --git a/server/char-device.h b/server/char-device.h
> index 86bf1b9..f3ae6cb 100644
> --- a/server/char-device.h
> +++ b/server/char-device.h
> @@ -27,19 +27,19 @@
> *
> * How to use the api:
> * ==================
> - * device attached: call spice_char_device_state_create
> - * device detached: call spice_char_device_state_destroy/reset
> + * device attached: call red_char_device_create
> + * device detached: call red_char_device_destroy/reset
> *
> - * client connected and associated with a device:
> spice_char_device_client_add
> - * client disconnected: spice_char_device_client_remove
> + * client connected and associated with a device: red_char_device__add
> + * client disconnected: red_char_device__remove
> *
> * Writing to the device
> * ---------------------
> * Write the data into RedCharDeviceWriteBuffer:
> - * call spice_char_device_write_buffer_get in order to get an appropriate
> buffer.
> - * call spice_char_device_write_buffer_add in order to push the buffer to
> the write queue.
> + * call red_char_device_buffer_get in order to get an appropriate buffer.
> + * call red_char_device_buffer_add in order to push the buffer to the write
> queue.
> * If you choose not to push the buffer to the device, call
> - * spice_char_device_write_buffer_release
> + * red_char_device_buffer_release
> *
> * reading from the device
> * -----------------------
> @@ -51,9 +51,9 @@
> *
> * calls triggered from the device (qemu):
> * --------------------------------------
> - * spice_char_device_start
> - * spice_char_device_stop
> - * spice_char_device_wakeup (for reading from the device)
> + * red_char_device_start
> + * red_char_device_stop
> + * red_char_device_wakeup (for reading from the device)
> */
>
> /*
> @@ -131,26 +131,26 @@ typedef struct SpiceCharDeviceCallbacks {
> void (*remove_client)(RedClient *client, void *opaque);
> } SpiceCharDeviceCallbacks;
>
> -RedCharDevice *spice_char_device_state_create(SpiceCharDeviceInstance *sin,
> - struct RedsState *reds,
> - uint32_t
> client_tokens_interval,
> - uint32_t self_tokens,
> - SpiceCharDeviceCallbacks *cbs,
> - void *opaque);
> +RedCharDevice *red_char_device_create(SpiceCharDeviceInstance *sin,
> + struct RedsState *reds,
> + uint32_t client_tokens_interval,
> + uint32_t self_tokens,
> + SpiceCharDeviceCallbacks *cbs,
> + void *opaque);
>
> -void spice_char_device_state_reset_dev_instance(RedCharDevice *dev,
> - SpiceCharDeviceInstance
> *sin);
> -void spice_char_device_state_destroy(RedCharDevice *dev);
> +void red_char_device_reset_dev_instance(RedCharDevice *dev,
> + SpiceCharDeviceInstance *sin);
> +void red_char_device_destroy(RedCharDevice *dev);
>
> -void *spice_char_device_state_opaque_get(RedCharDevice *dev);
> +void *red_char_device_opaque_get(RedCharDevice *dev);
>
> /* only one client is supported */
> -void spice_char_device_state_migrate_data_marshall(RedCharDevice *dev,
> - SpiceMarshaller *m);
> -void spice_char_device_state_migrate_data_marshall_empty(SpiceMarshaller
> *m);
> +void red_char_device_migrate_data_marshall(RedCharDevice *dev,
> + SpiceMarshaller *m);
> +void red_char_device_migrate_data_marshall_empty(SpiceMarshaller *m);
>
> -int spice_char_device_state_restore(RedCharDevice *dev,
> - SpiceMigrateDataCharDevice *mig_data);
> +int red_char_device_restore(RedCharDevice *dev,
> + SpiceMigrateDataCharDevice *mig_data);
>
> /*
> * Resets write/read queues, and moves that state to being stopped.
> @@ -167,50 +167,50 @@ int spice_char_device_state_restore(RedCharDevice *dev,
> *
> * todo: change AGENT_CONNECT msg to contain tokens count.
> */
> -void spice_char_device_reset(RedCharDevice *dev);
> +void red_char_device_reset(RedCharDevice *dev);
>
> /* max_send_queue_size = how many messages we can read from the device and
> enqueue for this client,
> * when we have tokens for other clients and no tokens for this one */
> -int spice_char_device_client_add(RedCharDevice *dev,
> - RedClient *client,
> - int do_flow_control,
> - uint32_t max_send_queue_size,
> - uint32_t num_client_tokens,
> - uint32_t num_send_tokens,
> - int wait_for_migrate_data);
> -
> -void spice_char_device_client_remove(RedCharDevice *dev,
> - RedClient *client);
> -int spice_char_device_client_exists(RedCharDevice *dev,
> - RedClient *client);
> -
> -void spice_char_device_start(RedCharDevice *dev);
> -void spice_char_device_stop(RedCharDevice *dev);
> -SpiceServer* spice_char_device_get_server(RedCharDevice *dev);
> +int red_char_device_client_add(RedCharDevice *dev,
> + RedClient *client,
> + int do_flow_control,
> + uint32_t max_send_queue_size,
> + uint32_t num_client_tokens,
> + uint32_t num_send_tokens,
> + int wait_for_migrate_data);
> +
> +void red_char_device_client_remove(RedCharDevice *dev,
> + RedClient *client);
> +int red_char_device_client_exists(RedCharDevice *dev,
> + RedClient *client);
> +
> +void red_char_device_start(RedCharDevice *dev);
> +void red_char_device_stop(RedCharDevice *dev);
> +SpiceServer* red_char_device_get_server(RedCharDevice *dev);
>
> /** Read from device **/
>
> -void spice_char_device_wakeup(RedCharDevice *dev);
> +void red_char_device_wakeup(RedCharDevice *dev);
>
> -void spice_char_device_send_to_client_tokens_add(RedCharDevice *dev,
> - RedClient *client,
> - uint32_t tokens);
> +void red_char_device_send_to_client_tokens_add(RedCharDevice *dev,
> + RedClient *client,
> + uint32_t tokens);
>
>
> -void spice_char_device_send_to_client_tokens_set(RedCharDevice *dev,
> - RedClient *client,
> - uint32_t tokens);
> +void red_char_device_send_to_client_tokens_set(RedCharDevice *dev,
> + RedClient *client,
> + uint32_t tokens);
> /** Write to device **/
>
> -RedCharDeviceWriteBuffer *spice_char_device_write_buffer_get(RedCharDevice
> *dev,
> - RedClient
> *client, int size);
> -RedCharDeviceWriteBuffer
> *spice_char_device_write_buffer_get_server_no_token(
> +RedCharDeviceWriteBuffer *red_char_device_write_buffer_get(RedCharDevice
> *dev,
> + RedClient
> *client, int size);
> +RedCharDeviceWriteBuffer *red_char_device_write_buffer_get_server_no_token(
> RedCharDevice *dev, int size);
>
> /* Either add the buffer to the write queue or release it */
> -void spice_char_device_write_buffer_add(RedCharDevice *dev,
> +void red_char_device_write_buffer_add(RedCharDevice *dev,
> RedCharDeviceWriteBuffer
> *write_buf);
> -void spice_char_device_write_buffer_release(RedCharDevice *dev,
> +void red_char_device_write_buffer_release(RedCharDevice *dev,
> RedCharDeviceWriteBuffer
> *write_buf);
>
> /* api for specific char devices */
> diff --git a/server/reds.c b/server/reds.c
> index bb96d09..12de608 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -434,10 +434,10 @@ static void reds_reset_vdp(RedsState *reds)
> */
> if (red_channel_test_remote_cap(&reds->main_channel->base,
> SPICE_MAIN_CAP_AGENT_CONNECTED_TOKENS))
> {
> - spice_char_device_state_destroy(state->base);
> + red_char_device_destroy(state->base);
> state->base = NULL;
> } else {
> - spice_char_device_reset(state->base);
> + red_char_device_reset(state->base);
> }
>
> sif = spice_char_device_get_interface(reds->vdagent);
> @@ -488,8 +488,8 @@ void reds_client_disconnect(RedsState *reds, RedClient
> *client)
> if (reds->agent_state.base) {
> /* note that vdagent might be NULL, if the vdagent was once
> * up and than was removed */
> - if (spice_char_device_client_exists(reds->agent_state.base, client))
> {
> - spice_char_device_client_remove(reds->agent_state.base, client);
> + if (red_char_device_client_exists(reds->agent_state.base, client)) {
> + red_char_device_client_remove(reds->agent_state.base, client);
> }
> }
>
> @@ -507,7 +507,7 @@ void reds_client_disconnect(RedsState *reds, RedClient
> *client)
> uint32_t total_msg_size;
>
> total_msg_size = sizeof(VDIChunkHeader) +
> sizeof(VDAgentMessage);
> - char_dev_buf =
> spice_char_device_write_buffer_get_server_no_token(
> + char_dev_buf = red_char_device_write_buffer_get_server_no_token(
> reds->agent_state.base, total_msg_size);
> char_dev_buf->buf_used = total_msg_size;
> internal_buf = (VDInternalBuf *)char_dev_buf->buf;
> @@ -518,8 +518,8 @@ void reds_client_disconnect(RedsState *reds, RedClient
> *client)
> internal_buf->header.opaque = 0;
> internal_buf->header.size = 0;
>
> - spice_char_device_write_buffer_add(reds->agent_state.base,
> - char_dev_buf);
> + red_char_device_write_buffer_add(reds->agent_state.base,
> + char_dev_buf);
> }
>
> /* Reset write filter to start with clean state on client reconnect
> */
> @@ -696,10 +696,10 @@ static void vdi_port_read_buf_unref(VDIReadBuf *buf)
>
> /* read_one_msg_from_vdi_port may have never completed because the
> read_bufs
> ring was empty. So we call it again so it can complete its work if
> - necessary. Note that since we can be called from
> spice_char_device_wakeup
> + necessary. Note that since we can be called from
> red_char_device_wakeup
> this can cause recursion, but we have protection for that */
> if (buf->state->base) {
> - spice_char_device_wakeup(buf->state->base);
> + red_char_device_wakeup(buf->state->base);
> }
> }
> }
> @@ -845,9 +845,9 @@ void reds_handle_agent_mouse_event(RedsState *reds, const
> VDAgentMouseState *mou
>
> total_msg_size = sizeof(VDIChunkHeader) + sizeof(VDAgentMessage) +
> sizeof(VDAgentMouseState);
> - char_dev_buf =
> spice_char_device_write_buffer_get(reds->agent_state.base,
> - NULL,
> - total_msg_size);
> + char_dev_buf = red_char_device_write_buffer_get(reds->agent_state.base,
> + NULL,
> + total_msg_size);
>
> if (!char_dev_buf) {
> reds->pending_mouse_event = TRUE;
> @@ -866,7 +866,7 @@ void reds_handle_agent_mouse_event(RedsState *reds, const
> VDAgentMouseState *mou
> internal_buf->u.mouse_state = *mouse_state;
>
> char_dev_buf->buf_used = total_msg_size;
> - spice_char_device_write_buffer_add(reds->agent_state.base,
> char_dev_buf);
> + red_char_device_write_buffer_add(reds->agent_state.base, char_dev_buf);
> }
>
> int reds_get_n_channels(RedsState *reds)
> @@ -938,16 +938,16 @@ void reds_on_main_agent_start(RedsState *reds,
> MainChannelClient *mcc, uint32_t
> * and vice versa, the sending from the server to the client won't have
> * flow control, but will have no other problem.
> */
> - if (!spice_char_device_client_exists(dev_state, rcc->client)) {
> + if (!red_char_device_client_exists(dev_state, rcc->client)) {
> int client_added;
>
> - client_added = spice_char_device_client_add(dev_state,
> - rcc->client,
> - TRUE, /* flow control */
> -
> REDS_VDI_PORT_NUM_RECEIVE_BUFFS,
> - REDS_AGENT_WINDOW_SIZE,
> - num_tokens,
> -
> red_channel_client_is_waiting_for_migrate_data(rcc));
> + client_added = red_char_device_client_add(dev_state,
> + rcc->client,
> + TRUE, /* flow control */
> +
> REDS_VDI_PORT_NUM_RECEIVE_BUFFS,
> + REDS_AGENT_WINDOW_SIZE,
> + num_tokens,
> +
> red_channel_client_is_waiting_for_migrate_data(rcc));
>
> if (!client_added) {
> spice_warning("failed to add client to agent");
> @@ -955,9 +955,9 @@ void reds_on_main_agent_start(RedsState *reds,
> MainChannelClient *mcc, uint32_t
> return;
> }
> } else {
> - spice_char_device_send_to_client_tokens_set(dev_state,
> - rcc->client,
> - num_tokens);
> + red_char_device_send_to_client_tokens_set(dev_state,
> + rcc->client,
> + num_tokens);
> }
>
> agent_msg_filter_config(&reds->agent_state.write_filter,
> reds->agent_copypaste,
> @@ -972,7 +972,7 @@ void reds_on_main_agent_tokens(RedsState *reds,
> MainChannelClient *mcc, uint32_t
> return;
> }
> spice_assert(reds->vdagent->st);
> - spice_char_device_send_to_client_tokens_add(reds->vdagent->st,
> + red_char_device_send_to_client_tokens_add(reds->vdagent->st,
> main_channel_client_get_base(mcc)->client,
> num_tokens);
> }
> @@ -995,9 +995,9 @@ uint8_t *reds_get_agent_data_buffer(RedsState *reds,
> MainChannelClient *mcc, siz
>
> spice_assert(dev_state->recv_from_client_buf == NULL);
> client = main_channel_client_get_base(mcc)->client;
> - dev_state->recv_from_client_buf =
> spice_char_device_write_buffer_get(dev_state->base,
> -
> client,
> -
> size
> + sizeof(VDIChunkHeader));
> + dev_state->recv_from_client_buf =
> red_char_device_write_buffer_get(dev_state->base,
> +
> client,
> + size
> + sizeof(VDIChunkHeader));
> dev_state->recv_from_client_buf_pushed = FALSE;
> return dev_state->recv_from_client_buf->buf + sizeof(VDIChunkHeader);
> }
> @@ -1013,8 +1013,8 @@ void reds_release_agent_data_buffer(RedsState *reds,
> uint8_t *buf)
>
> spice_assert(buf == dev_state->recv_from_client_buf->buf +
> sizeof(VDIChunkHeader));
> if (!dev_state->recv_from_client_buf_pushed) {
> - spice_char_device_write_buffer_release(reds->agent_state.base,
> -
> dev_state->recv_from_client_buf);
> + red_char_device_write_buffer_release(reds->agent_state.base,
> +
> dev_state->recv_from_client_buf);
> }
> dev_state->recv_from_client_buf = NULL;
> dev_state->recv_from_client_buf_pushed = FALSE;
> @@ -1085,7 +1085,7 @@ void reds_on_main_agent_data(RedsState *reds,
> MainChannelClient *mcc, void *mess
> dev_state->recv_from_client_buf->buf_used = sizeof(VDIChunkHeader) +
> size;
>
> dev_state->recv_from_client_buf_pushed = TRUE;
> - spice_char_device_write_buffer_add(reds->agent_state.base,
> dev_state->recv_from_client_buf);
> + red_char_device_write_buffer_add(reds->agent_state.base,
> dev_state->recv_from_client_buf);
> }
>
> void reds_on_main_migrate_connected(RedsState *reds, int seamless)
> @@ -1180,7 +1180,7 @@ void reds_marshall_migrate_data(RedsState *reds,
> SpiceMarshaller *m)
> is destroyed when the agent is
> disconnected and
> there is no need to track the
> client tokens
> (see reds_reset_vdp) */
> - spice_char_device_state_migrate_data_marshall_empty(m);
> + red_char_device_migrate_data_marshall_empty(m);
> null_agent_mig_data = spice_marshaller_reserve_space(m,
> sizeof(SpiceMigrateDataMain)
> -
> sizeof(SpiceMigrateDataCharDevice));
> @@ -1190,7 +1190,7 @@ void reds_marshall_migrate_data(RedsState *reds,
> SpiceMarshaller *m)
> return;
> }
>
> - spice_char_device_state_migrate_data_marshall(reds->agent_state.base,
> m);
> + red_char_device_migrate_data_marshall(reds->agent_state.base, m);
> spice_marshaller_add_uint8(m, reds->agent_state.client_agent_started);
>
> mig_data.agent2client.chunk_header = agent_state->vdi_chunk_header;
> @@ -1310,7 +1310,7 @@ static int reds_agent_state_restore(RedsState *reds,
> SpiceMigrateDataMain *mig_d
> agent_state->read_filter.discard_all,
> agent_state->read_filter.msg_data_to_read,
> agent_state->read_filter.result);
> - return spice_char_device_state_restore(agent_state->base,
> &mig_data->agent_base);
> + return red_char_device_restore(agent_state->base,
> &mig_data->agent_base);
> }
>
> /*
> @@ -1340,7 +1340,7 @@ int reds_handle_migrate_data(RedsState *reds,
> MainChannelClient *mcc,
> spice_debug("agent is no longer connected");
> } else {
> if (agent_state->plug_generation > 1) {
> - /* spice_char_device_state_reset takes care of not
> making the device wait for migration data */
> + /* red_char_device_reset takes care of not making the
> device wait for migration data */
> spice_debug("agent has been detached and reattached
> before receiving migration data");
> main_channel_push_agent_disconnected(reds->main_channel);
> main_channel_push_agent_connected(reds->main_channel);
> @@ -1358,9 +1358,9 @@ int reds_handle_migrate_data(RedsState *reds,
> MainChannelClient *mcc,
> } else {
> spice_debug("agent was not attached on the source host");
> if (reds->vdagent) {
> - /* spice_char_device_client_remove disables waiting for
> migration data */
> - spice_char_device_client_remove(agent_state->base,
> -
> main_channel_client_get_base(mcc)->client);
> + /* red_char_device_client_remove disables waiting for migration
> data */
> + red_char_device_client_remove(agent_state->base,
> +
> main_channel_client_get_base(mcc)->client);
> main_channel_push_agent_connected(reds->main_channel);
> }
> }
> @@ -2983,14 +2983,14 @@ static RedCharDevice *attach_to_red_agent(RedsState
> *reds, SpiceCharDeviceInstan
> char_dev_state_cbs.remove_client = vdi_port_remove_client;
> char_dev_state_cbs.on_free_self_token = vdi_port_on_free_self_token;
>
> - state->base = spice_char_device_state_create(sin,
> - reds,
> - REDS_TOKENS_TO_SEND,
> -
> REDS_NUM_INTERNAL_AGENT_MESSAGES,
> - &char_dev_state_cbs,
> - reds);
> + state->base = red_char_device_create(sin,
> + reds,
> + REDS_TOKENS_TO_SEND,
> +
> REDS_NUM_INTERNAL_AGENT_MESSAGES,
> + &char_dev_state_cbs,
> + reds);
> } else {
> - spice_char_device_state_reset_dev_instance(state->base, sin);
> + red_char_device_reset_dev_instance(state->base, sin);
> }
>
> reds->vdagent = sin;
> @@ -3017,16 +3017,16 @@ static RedCharDevice *attach_to_red_agent(RedsState
> *reds, SpiceCharDeviceInstan
> * 2.b If this happens second ==> we already have spice migrate data
> * then restore state
> */
> - if (!spice_char_device_client_exists(reds->agent_state.base,
> reds_get_client(reds))) {
> + if (!red_char_device_client_exists(reds->agent_state.base,
> reds_get_client(reds))) {
> int client_added;
>
> - client_added =
> spice_char_device_client_add(reds->agent_state.base,
> -
> reds_get_client(reds),
> - TRUE, /* flow
> control */
> -
> REDS_VDI_PORT_NUM_RECEIVE_BUFFS,
> -
> REDS_AGENT_WINDOW_SIZE,
> - ~0,
> - TRUE);
> + client_added =
> red_char_device_client_add(reds->agent_state.base,
> + reds_get_client(reds),
> + TRUE, /* flow control
> */
> +
> REDS_VDI_PORT_NUM_RECEIVE_BUFFS,
> +
> REDS_AGENT_WINDOW_SIZE,
> + ~0,
> + TRUE);
>
> if (!client_added) {
> spice_warning("failed to add client to agent");
> @@ -3059,7 +3059,7 @@ SPICE_GNUC_VISIBLE void
> spice_server_char_device_wakeup(SpiceCharDeviceInstance*
> spice_warning("no RedCharDevice attached to instance %p", sin);
> return;
> }
> - spice_char_device_wakeup(sin->st);
> + red_char_device_wakeup(sin->st);
> }
>
> #define SUBTYPE_VDAGENT "vdagent"
> @@ -3135,7 +3135,7 @@ static int
> spice_server_char_device_add_interface(SpiceServer *reds,
> /* setting the char_device state to "started" for backward
> compatibily with
> * qemu releases that don't call spice api for start/stop (not
> implemented yet) */
> if (reds->vm_running) {
> - spice_char_device_start(char_device->st);
> + red_char_device_start(char_device->st);
> }
> reds_add_char_device(reds, char_device->st);
> } else {
> @@ -3297,7 +3297,7 @@ SPICE_GNUC_VISIBLE int
> spice_server_remove_interface(SpiceBaseInstance *sin)
> snd_detach_record(SPICE_CONTAINEROF(sin, SpiceRecordInstance,
> base));
> } else if (strcmp(interface->type, SPICE_INTERFACE_CHAR_DEVICE) == 0) {
> SpiceCharDeviceInstance *char_device = SPICE_CONTAINEROF(sin,
> SpiceCharDeviceInstance, base);
> - reds = spice_char_device_get_server(char_device->st);
> + reds = red_char_device_get_server(char_device->st);
> spice_server_char_device_remove_interface(reds, sin);
> } else {
> spice_warning("VD_INTERFACE_REMOVING unsupported");
> @@ -3976,7 +3976,7 @@ SPICE_GNUC_VISIBLE void
> spice_server_vm_start(SpiceServer *reds)
>
> reds->vm_running = TRUE;
> for (it = reds->char_devices; it != NULL; it = it->next) {
> - spice_char_device_start(it->data);
> + red_char_device_start(it->data);
> }
> reds_on_vm_start(reds);
> }
> @@ -3987,7 +3987,7 @@ SPICE_GNUC_VISIBLE void
> spice_server_vm_stop(SpiceServer *reds)
>
> reds->vm_running = FALSE;
> for (it = reds->char_devices; it != NULL; it = it->next) {
> - spice_char_device_stop(it->data);
> + red_char_device_stop(it->data);
> }
> reds_on_vm_stop(reds);
> }
> diff --git a/server/smartcard.c b/server/smartcard.c
> index 6e32f31..b3261d8 100644
> --- a/server/smartcard.c
> +++ b/server/smartcard.c
> @@ -240,7 +240,7 @@ MsgItem
> *smartcard_char_device_on_message_from_device(SmartCardDeviceState *stat
>
> static int smartcard_char_device_add_to_readers(RedsState *reds,
> SpiceCharDeviceInstance *char_device)
> {
> - SmartCardDeviceState *state =
> spice_char_device_state_opaque_get(char_device->st);
> + SmartCardDeviceState *state =
> red_char_device_opaque_get(char_device->st);
>
> if (g_smartcard_readers.num >= SMARTCARD_MAX_READERS) {
> return -1;
> @@ -265,7 +265,7 @@ static SpiceCharDeviceInstance
> *smartcard_readers_get_unattached(void)
> SmartCardDeviceState* state;
>
> for (i = 0; i < g_smartcard_readers.num; ++i) {
> - state =
> spice_char_device_state_opaque_get(g_smartcard_readers.sin[i]->st);
> + state = red_char_device_opaque_get(g_smartcard_readers.sin[i]->st);
> if (!state->priv->scc) {
> return g_smartcard_readers.sin[i];
> }
> @@ -286,12 +286,12 @@ static SmartCardDeviceState
> *smartcard_device_state_new(RedsState *reds, SpiceCh
> chardev_cbs.remove_client = smartcard_remove_client;
>
> st = spice_new0(SmartCardDeviceState, 1);
> - st->priv->chardev = spice_char_device_state_create(sin,
> - reds,
> - 0, /* tokens interval
> */
> - ~0, /* self tokens */
> - &chardev_cbs,
> - st);
> + st->priv->chardev = red_char_device_create(sin,
> + reds,
> + 0, /* tokens interval */
> + ~0, /* self tokens */
> + &chardev_cbs,
> + st);
> st->priv->reader_id = VSCARD_UNDEFINED_READER_ID;
> st->priv->reader_added = FALSE;
> st->priv->buf_size = APDUBufSize + sizeof(VSCMsgHeader);
> @@ -308,13 +308,13 @@ static void
> smartcard_device_state_free(SmartCardDeviceState* st)
> st->priv->scc->smartcard_state = NULL;
> }
> free(st->priv->buf);
> - spice_char_device_state_destroy(st->priv->chardev);
> + red_char_device_destroy(st->priv->chardev);
> free(st);
> }
>
> void smartcard_device_disconnect(SpiceCharDeviceInstance *char_device)
> {
> - SmartCardDeviceState *st =
> spice_char_device_state_opaque_get(char_device->st);
> + SmartCardDeviceState *st = red_char_device_opaque_get(char_device->st);
>
> smartcard_device_state_free(st);
> }
> @@ -336,7 +336,7 @@ static void
> smartcard_char_device_notify_reader_add(SmartCardDeviceState *st)
> RedCharDeviceWriteBuffer *write_buf;
> VSCMsgHeader *vheader;
>
> - write_buf = spice_char_device_write_buffer_get(st->priv->chardev, NULL,
> sizeof(vheader));
> + write_buf = red_char_device_write_buffer_get(st->priv->chardev, NULL,
> sizeof(vheader));
> if (!write_buf) {
> spice_error("failed to allocate write buffer");
> return;
> @@ -352,20 +352,20 @@ static void
> smartcard_char_device_notify_reader_add(SmartCardDeviceState *st)
> static void smartcard_char_device_attach_client(SpiceCharDeviceInstance
> *char_device,
> SmartCardChannelClient *scc)
> {
> - SmartCardDeviceState *st =
> spice_char_device_state_opaque_get(char_device->st);
> + SmartCardDeviceState *st = red_char_device_opaque_get(char_device->st);
> int client_added;
>
> spice_assert(!scc->smartcard_state && !st->priv->scc);
> st->priv->scc = scc;
> scc->smartcard_state = st;
> - client_added = spice_char_device_client_add(st->priv->chardev,
> - scc->base.client,
> - FALSE, /* no flow control
> yet */
> - 0, /* send queue size */
> - ~0,
> - ~0,
> -
> red_channel_client_is_waiting_for_migrate_data(
> - &scc->base));
> + client_added = red_char_device_client_add(st->priv->chardev,
> + scc->base.client,
> + FALSE, /* no flow control yet
> */
> + 0, /* send queue size */
> + ~0,
> + ~0,
> +
> red_channel_client_is_waiting_for_migrate_data(
> + &scc->base));
> if (!client_added) {
> spice_warning("failed");
> st->priv->scc = NULL;
> @@ -383,7 +383,7 @@ static void
> smartcard_char_device_notify_reader_remove(SmartCardDeviceState *st)
> spice_debug("reader add was never sent to the device");
> return;
> }
> - write_buf = spice_char_device_write_buffer_get(st->priv->chardev, NULL,
> sizeof(vheader));
> + write_buf = red_char_device_write_buffer_get(st->priv->chardev, NULL,
> sizeof(vheader));
> if (!write_buf) {
> spice_error("failed to allocate write buffer");
> return;
> @@ -405,7 +405,7 @@ static void
> smartcard_char_device_detach_client(SmartCardChannelClient *scc)
> }
> st = scc->smartcard_state;
> spice_assert(st->priv->scc == scc);
> - spice_char_device_client_remove(st->priv->chardev, scc->base.client);
> + red_char_device_client_remove(st->priv->chardev, scc->base.client);
> scc->smartcard_state = NULL;
> st->priv->scc = NULL;
> }
> @@ -434,7 +434,7 @@ static uint8_t
> *smartcard_channel_alloc_msg_rcv_buf(RedChannelClient *rcc,
> st = scc->smartcard_state;
> spice_assert(st->priv->scc || scc->smartcard_state);
> spice_assert(!scc->write_buf);
> - scc->write_buf =
> spice_char_device_write_buffer_get(st->priv->chardev, rcc->client, size);
> + scc->write_buf = red_char_device_write_buffer_get(st->priv->chardev,
> rcc->client, size);
>
> if (!scc->write_buf) {
> spice_error("failed to allocate write buffer");
> @@ -464,7 +464,7 @@ static void
> smartcard_channel_release_msg_rcv_buf(RedChannelClient *rcc,
> if (scc->write_buf) { /* msg hasn't been pushed to the guest */
> spice_assert(scc->write_buf->buf == msg);
> dev = scc->smartcard_state ? scc->smartcard_state->priv->chardev
> : NULL;
> - spice_char_device_write_buffer_release(dev, scc->write_buf);
> + red_char_device_write_buffer_release(dev, scc->write_buf);
> scc->write_buf = NULL;
> }
> }
> @@ -512,13 +512,13 @@ static void
> smartcard_channel_send_migrate_data(RedChannelClient *rcc,
> spice_marshaller_add_uint32(m, SPICE_MIGRATE_DATA_SMARTCARD_VERSION);
>
> if (!state) {
> - spice_char_device_state_migrate_data_marshall_empty(m);
> + red_char_device_migrate_data_marshall_empty(m);
> spice_marshaller_add_uint8(m, 0);
> spice_marshaller_add_uint32(m, 0);
> spice_marshaller_add_uint32(m, 0);
> spice_debug("null char dev state");
> } else {
> - spice_char_device_state_migrate_data_marshall(state->priv->chardev,
> m);
> + red_char_device_migrate_data_marshall(state->priv->chardev, m);
> spice_marshaller_add_uint8(m, state->priv->reader_added);
> spice_marshaller_add_uint32(m, state->priv->buf_used);
> m2 = spice_marshaller_get_ptr_submarshaller(m, 0);
> @@ -628,7 +628,7 @@ static void
> smartcard_remove_reader(SmartCardChannelClient *scc, uint32_t reader
> return;
> }
>
> - state = spice_char_device_state_opaque_get(char_device->st);
> + state = red_char_device_opaque_get(char_device->st);
> if (state->priv->reader_added == FALSE) {
> smartcard_push_error(&scc->base, reader_id,
> VSC_GENERAL_ERROR);
> @@ -669,7 +669,7 @@ static void
> smartcard_channel_write_to_reader(RedCharDeviceWriteBuffer *write_bu
>
> spice_assert(vheader->reader_id <= g_smartcard_readers.num);
> sin = g_smartcard_readers.sin[vheader->reader_id];
> - st = (SmartCardDeviceState
> *)spice_char_device_state_opaque_get(sin->st);
> + st = (SmartCardDeviceState *)red_char_device_opaque_get(sin->st);
> spice_assert(!st->priv->scc || st == st->priv->scc->smartcard_state);
> /* protocol requires messages to be in network endianess */
> vheader->type = htonl(vheader->type);
> @@ -678,7 +678,7 @@ static void
> smartcard_channel_write_to_reader(RedCharDeviceWriteBuffer *write_bu
> write_buf->buf_used = actual_length + sizeof(VSCMsgHeader);
> /* pushing the buffer to the write queue; It will be released
> * when it will be fully consumed by the device */
> - spice_char_device_write_buffer_add(sin->st, write_buf);
> + red_char_device_write_buffer_add(sin->st, write_buf);
> if (st->priv->scc && write_buf == st->priv->scc->write_buf) {
> st->priv->scc->write_buf = NULL;
> }
> @@ -746,7 +746,7 @@ static int
> smartcard_channel_client_handle_migrate_data(RedChannelClient *rcc,
> scc->smartcard_state->priv->reader_added = mig_data->reader_added;
>
> smartcard_device_state_restore_partial_read(scc->smartcard_state,
> mig_data);
> - return
> spice_char_device_state_restore(scc->smartcard_state->priv->chardev,
> &mig_data->base);
> + return red_char_device_restore(scc->smartcard_state->priv->chardev,
> &mig_data->base);
> }
>
> static int smartcard_channel_handle_message(RedChannelClient *rcc,
> diff --git a/server/spicevmc.c b/server/spicevmc.c
> index 36c5daf..d1e8222 100644
> --- a/server/spicevmc.c
> +++ b/server/spicevmc.c
> @@ -220,13 +220,13 @@ static void
> spicevmc_red_channel_client_on_disconnect(RedChannelClient *rcc)
> state = SPICE_CONTAINEROF(rcc->channel, SpiceVmcState, channel);
>
> if (state->recv_from_client_buf) { /* partial message which wasn't
> pushed to device */
> - spice_char_device_write_buffer_release(state->chardev,
> state->recv_from_client_buf);
> + red_char_device_write_buffer_release(state->chardev,
> state->recv_from_client_buf);
> state->recv_from_client_buf = NULL;
> }
>
> if (state->chardev) {
> - if (spice_char_device_client_exists(state->chardev, rcc->client)) {
> - spice_char_device_client_remove(state->chardev, rcc->client);
> + if (red_char_device_client_exists(state->chardev, rcc->client)) {
> + red_char_device_client_remove(state->chardev, rcc->client);
> } else {
> spice_printerr("client %p have already been removed from char
> dev %p",
> rcc->client, state->chardev);
> @@ -275,7 +275,7 @@ static int
> spicevmc_channel_client_handle_migrate_data(RedChannelClient *rcc,
> spice_error("bad header");
> return FALSE;
> }
> - return spice_char_device_state_restore(state->chardev, &mig_data->base);
> + return red_char_device_restore(state->chardev, &mig_data->base);
> }
>
> static int spicevmc_red_channel_client_handle_message(RedChannelClient *rcc,
> @@ -293,7 +293,7 @@ static int
> spicevmc_red_channel_client_handle_message(RedChannelClient *rcc,
> case SPICE_MSGC_SPICEVMC_DATA:
> spice_assert(state->recv_from_client_buf->buf == msg);
> state->recv_from_client_buf->buf_used = size;
> - spice_char_device_write_buffer_add(state->chardev,
> state->recv_from_client_buf);
> + red_char_device_write_buffer_add(state->chardev,
> state->recv_from_client_buf);
> state->recv_from_client_buf = NULL;
> break;
> case SPICE_MSGC_PORT_EVENT:
> @@ -323,9 +323,9 @@ static uint8_t
> *spicevmc_red_channel_alloc_msg_rcv_buf(RedChannelClient *rcc,
> case SPICE_MSGC_SPICEVMC_DATA:
> assert(!state->recv_from_client_buf);
>
> - state->recv_from_client_buf =
> spice_char_device_write_buffer_get(state->chardev,
> -
> rcc->client,
> -
> size);
> + state->recv_from_client_buf =
> red_char_device_write_buffer_get(state->chardev,
> +
> rcc->client,
> +
> size);
> if (!state->recv_from_client_buf) {
> spice_error("failed to allocate write buffer");
> return NULL;
> @@ -350,7 +350,7 @@ static void
> spicevmc_red_channel_release_msg_rcv_buf(RedChannelClient *rcc,
> switch (type) {
> case SPICE_MSGC_SPICEVMC_DATA:
> if (state->recv_from_client_buf) { /* buffer wasn't pushed to device
> */
> - spice_char_device_write_buffer_release(state->chardev,
> state->recv_from_client_buf);
> + red_char_device_write_buffer_release(state->chardev,
> state->recv_from_client_buf);
> state->recv_from_client_buf = NULL;
> }
> break;
> @@ -386,7 +386,7 @@ static void
> spicevmc_red_channel_send_migrate_data(RedChannelClient *rcc,
> spice_marshaller_add_uint32(m, SPICE_MIGRATE_DATA_SPICEVMC_MAGIC);
> spice_marshaller_add_uint32(m, SPICE_MIGRATE_DATA_SPICEVMC_VERSION);
>
> - spice_char_device_state_migrate_data_marshall(state->chardev, m);
> + red_char_device_migrate_data_marshall(state->chardev, m);
> }
>
> static void spicevmc_red_channel_send_port_init(RedChannelClient *rcc,
> @@ -486,8 +486,8 @@ static void spicevmc_connect(RedChannel *channel,
> RedClient *client,
> spicevmc_port_send_init(rcc);
> }
>
> - if (!spice_char_device_client_add(state->chardev, client, FALSE, 0, ~0,
> ~0,
> -
> red_channel_client_is_waiting_for_migrate_data(rcc)))
> {
> + if (!red_char_device_client_add(state->chardev, client, FALSE, 0, ~0,
> ~0,
> +
> red_channel_client_is_waiting_for_migrate_data(rcc)))
> {
> spice_warning("failed to add client to spicevmc");
> red_channel_client_disconnect(rcc);
> return;
> @@ -537,12 +537,12 @@ RedCharDevice *spicevmc_device_connect(RedsState *reds,
> char_dev_cbs.send_tokens_to_client =
> spicevmc_char_dev_send_tokens_to_client;
> char_dev_cbs.remove_client = spicevmc_char_dev_remove_client;
>
> - state->chardev = spice_char_device_state_create(sin,
> - reds,
> - 0, /* tokens interval */
> - ~0, /* self tokens */
> - &char_dev_cbs,
> - state);
> + state->chardev = red_char_device_create(sin,
> + reds,
> + 0, /* tokens interval */
> + ~0, /* self tokens */
> + &char_dev_cbs,
> + state);
> state->chardev_sin = sin;
>
> reds_register_channel(reds, &state->channel);
> @@ -555,13 +555,13 @@ void spicevmc_device_disconnect(RedsState *reds,
> SpiceCharDeviceInstance *sin)
> SpiceVmcState *state;
>
> /* FIXME */
> - state = (SpiceVmcState
> *)spice_char_device_state_opaque_get((RedCharDevice*)sin->st);
> + state = (SpiceVmcState
> *)red_char_device_opaque_get((RedCharDevice*)sin->st);
>
> if (state->recv_from_client_buf) {
> - spice_char_device_write_buffer_release(state->chardev,
> state->recv_from_client_buf);
> + red_char_device_write_buffer_release(state->chardev,
> state->recv_from_client_buf);
> }
> /* FIXME */
> - spice_char_device_state_destroy((RedCharDevice*)sin->st);
> + red_char_device_destroy((RedCharDevice*)sin->st);
> state->chardev = NULL;
> sin->st = NULL;
>
> @@ -580,7 +580,7 @@ SPICE_GNUC_VISIBLE void
> spice_server_port_event(SpiceCharDeviceInstance *sin, ui
> }
>
> /* FIXME */
> - state = (SpiceVmcState
> *)spice_char_device_state_opaque_get((RedCharDevice*)sin->st);
> + state = (SpiceVmcState
> *)red_char_device_opaque_get((RedCharDevice*)sin->st);
> if (event == SPICE_PORT_EVENT_OPENED) {
> state->port_opened = TRUE;
> } else if (event == SPICE_PORT_EVENT_CLOSED) {
Acked-by: Frediano Ziglio <fziglio at redhat.com>
Frediano
More information about the Spice-devel
mailing list