mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-07 18:34:19 +00:00
Rename SpiceCharDeviceMsgToClient to RedCharDeviceMsgToClient
Internal types should use Red namespace for consistency Acked-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
parent
fe3d5d542d
commit
f02b66a225
@ -93,34 +93,34 @@ static void spice_char_device_write_buffer_unref(SpiceCharDeviceWriteBuffer *wri
|
||||
|
||||
static void spice_char_dev_write_retry(void *opaque);
|
||||
|
||||
typedef struct SpiceCharDeviceMsgToClientItem {
|
||||
typedef struct RedCharDeviceMsgToClientItem {
|
||||
RingItem link;
|
||||
SpiceCharDeviceMsgToClient *msg;
|
||||
} SpiceCharDeviceMsgToClientItem;
|
||||
RedCharDeviceMsgToClient *msg;
|
||||
} RedCharDeviceMsgToClientItem;
|
||||
|
||||
static SpiceCharDeviceMsgToClient *
|
||||
static RedCharDeviceMsgToClient *
|
||||
spice_char_device_read_one_msg_from_device(SpiceCharDeviceState *dev)
|
||||
{
|
||||
return dev->priv->cbs.read_one_msg_from_device(dev->priv->sin, dev->priv->opaque);
|
||||
}
|
||||
|
||||
static SpiceCharDeviceMsgToClient *
|
||||
static RedCharDeviceMsgToClient *
|
||||
spice_char_device_ref_msg_to_client(SpiceCharDeviceState *dev,
|
||||
SpiceCharDeviceMsgToClient *msg)
|
||||
RedCharDeviceMsgToClient *msg)
|
||||
{
|
||||
return dev->priv->cbs.ref_msg_to_client(msg, dev->priv->opaque);
|
||||
}
|
||||
|
||||
static void
|
||||
spice_char_device_unref_msg_to_client(SpiceCharDeviceState *dev,
|
||||
SpiceCharDeviceMsgToClient *msg)
|
||||
RedCharDeviceMsgToClient *msg)
|
||||
{
|
||||
dev->priv->cbs.unref_msg_to_client(msg, dev->priv->opaque);
|
||||
}
|
||||
|
||||
static void
|
||||
spice_char_device_send_msg_to_client(SpiceCharDeviceState *dev,
|
||||
SpiceCharDeviceMsgToClient *msg,
|
||||
RedCharDeviceMsgToClient *msg,
|
||||
RedClient *client)
|
||||
{
|
||||
dev->priv->cbs.send_msg_to_client(msg, client, dev->priv->opaque);
|
||||
@ -192,9 +192,9 @@ static void spice_char_device_client_send_queue_free(SpiceCharDeviceState *dev,
|
||||
spice_debug("send_queue_empty %d", ring_is_empty(&dev_client->send_queue));
|
||||
while (!ring_is_empty(&dev_client->send_queue)) {
|
||||
RingItem *item = ring_get_tail(&dev_client->send_queue);
|
||||
SpiceCharDeviceMsgToClientItem *msg_item = SPICE_CONTAINEROF(item,
|
||||
SpiceCharDeviceMsgToClientItem,
|
||||
link);
|
||||
RedCharDeviceMsgToClientItem *msg_item = SPICE_CONTAINEROF(item,
|
||||
RedCharDeviceMsgToClientItem,
|
||||
link);
|
||||
|
||||
ring_remove(item);
|
||||
spice_char_device_unref_msg_to_client(dev, msg_item->msg);
|
||||
@ -302,17 +302,17 @@ static uint64_t spice_char_device_max_send_tokens(SpiceCharDeviceState *dev)
|
||||
}
|
||||
|
||||
static void spice_char_device_add_msg_to_client_queue(SpiceCharDeviceClientState *dev_client,
|
||||
SpiceCharDeviceMsgToClient *msg)
|
||||
RedCharDeviceMsgToClient *msg)
|
||||
{
|
||||
SpiceCharDeviceState *dev = dev_client->dev;
|
||||
SpiceCharDeviceMsgToClientItem *msg_item;
|
||||
RedCharDeviceMsgToClientItem *msg_item;
|
||||
|
||||
if (dev_client->send_queue_size >= dev_client->max_send_queue_size) {
|
||||
spice_char_device_handle_client_overflow(dev_client);
|
||||
return;
|
||||
}
|
||||
|
||||
msg_item = spice_new0(SpiceCharDeviceMsgToClientItem, 1);
|
||||
msg_item = spice_new0(RedCharDeviceMsgToClientItem, 1);
|
||||
msg_item->msg = spice_char_device_ref_msg_to_client(dev, msg);
|
||||
ring_add(&dev_client->send_queue, &msg_item->link);
|
||||
dev_client->send_queue_size++;
|
||||
@ -324,7 +324,7 @@ static void spice_char_device_add_msg_to_client_queue(SpiceCharDeviceClientState
|
||||
}
|
||||
|
||||
static void spice_char_device_send_msg_to_clients(SpiceCharDeviceState *dev,
|
||||
SpiceCharDeviceMsgToClient *msg)
|
||||
RedCharDeviceMsgToClient *msg)
|
||||
{
|
||||
RingItem *item, *next;
|
||||
|
||||
@ -370,7 +370,7 @@ static int spice_char_device_read_from_device(SpiceCharDeviceState *dev)
|
||||
* All messages will be discarded if no client is attached to the device
|
||||
*/
|
||||
while ((max_send_tokens || ring_is_empty(&dev->priv->clients)) && dev->priv->running) {
|
||||
SpiceCharDeviceMsgToClient *msg;
|
||||
RedCharDeviceMsgToClient *msg;
|
||||
|
||||
msg = spice_char_device_read_one_msg_from_device(dev);
|
||||
if (!msg) {
|
||||
@ -399,9 +399,9 @@ static void spice_char_device_client_send_queue_push(SpiceCharDeviceClientState
|
||||
RingItem *item;
|
||||
while ((item = ring_get_tail(&dev_client->send_queue)) &&
|
||||
spice_char_device_can_send_to_client(dev_client)) {
|
||||
SpiceCharDeviceMsgToClientItem *msg_item;
|
||||
RedCharDeviceMsgToClientItem *msg_item;
|
||||
|
||||
msg_item = SPICE_CONTAINEROF(item, SpiceCharDeviceMsgToClientItem, link);
|
||||
msg_item = SPICE_CONTAINEROF(item, RedCharDeviceMsgToClientItem, link);
|
||||
ring_remove(item);
|
||||
|
||||
dev_client->num_send_tokens--;
|
||||
|
||||
@ -95,7 +95,7 @@ typedef struct SpiceCharDeviceWriteBuffer {
|
||||
uint32_t refs;
|
||||
} SpiceCharDeviceWriteBuffer;
|
||||
|
||||
typedef void SpiceCharDeviceMsgToClient;
|
||||
typedef void RedCharDeviceMsgToClient;
|
||||
|
||||
typedef struct SpiceCharDeviceCallbacks {
|
||||
/*
|
||||
@ -105,13 +105,13 @@ typedef struct SpiceCharDeviceCallbacks {
|
||||
|
||||
/* reads from the device till reaching a msg that should be sent to the client,
|
||||
* or till the reading fails */
|
||||
SpiceCharDeviceMsgToClient* (*read_one_msg_from_device)(SpiceCharDeviceInstance *sin,
|
||||
RedCharDeviceMsgToClient* (*read_one_msg_from_device)(SpiceCharDeviceInstance *sin,
|
||||
void *opaque);
|
||||
SpiceCharDeviceMsgToClient* (*ref_msg_to_client)(SpiceCharDeviceMsgToClient *msg,
|
||||
void *opaque);
|
||||
void (*unref_msg_to_client)(SpiceCharDeviceMsgToClient *msg,
|
||||
RedCharDeviceMsgToClient* (*ref_msg_to_client)(RedCharDeviceMsgToClient *msg,
|
||||
void *opaque);
|
||||
void (*unref_msg_to_client)(RedCharDeviceMsgToClient *msg,
|
||||
void *opaque);
|
||||
void (*send_msg_to_client)(SpiceCharDeviceMsgToClient *msg,
|
||||
void (*send_msg_to_client)(RedCharDeviceMsgToClient *msg,
|
||||
RedClient *client,
|
||||
void *opaque); /* after this call, the message is unreferenced */
|
||||
|
||||
|
||||
@ -706,8 +706,8 @@ static void vdi_port_read_buf_unref(VDIReadBuf *buf)
|
||||
|
||||
/* reads from the device till completes reading a message that is addressed to the client,
|
||||
* or otherwise, when reading from the device fails */
|
||||
static SpiceCharDeviceMsgToClient *vdi_port_read_one_msg_from_device(SpiceCharDeviceInstance *sin,
|
||||
void *opaque)
|
||||
static RedCharDeviceMsgToClient *vdi_port_read_one_msg_from_device(SpiceCharDeviceInstance *sin,
|
||||
void *opaque)
|
||||
{
|
||||
RedsState *reds = opaque;
|
||||
VDIPortState *state = &reds->agent_state;
|
||||
@ -778,20 +778,20 @@ static SpiceCharDeviceMsgToClient *vdi_port_read_one_msg_from_device(SpiceCharDe
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static SpiceCharDeviceMsgToClient *vdi_port_ref_msg_to_client(SpiceCharDeviceMsgToClient *msg,
|
||||
void *opaque)
|
||||
static RedCharDeviceMsgToClient *vdi_port_ref_msg_to_client(RedCharDeviceMsgToClient *msg,
|
||||
void *opaque)
|
||||
{
|
||||
return vdi_port_read_buf_ref(msg);
|
||||
}
|
||||
|
||||
static void vdi_port_unref_msg_to_client(SpiceCharDeviceMsgToClient *msg,
|
||||
static void vdi_port_unref_msg_to_client(RedCharDeviceMsgToClient *msg,
|
||||
void *opaque)
|
||||
{
|
||||
vdi_port_read_buf_unref(msg);
|
||||
}
|
||||
|
||||
/* after calling this, we unref the message, and the ref is in the instance side */
|
||||
static void vdi_port_send_msg_to_client(SpiceCharDeviceMsgToClient *msg,
|
||||
static void vdi_port_send_msg_to_client(RedCharDeviceMsgToClient *msg,
|
||||
RedClient *client,
|
||||
void *opaque)
|
||||
{
|
||||
|
||||
@ -136,8 +136,8 @@ static void smartcard_read_buf_prepare(SmartCardDeviceState *state, VSCMsgHeader
|
||||
}
|
||||
}
|
||||
|
||||
static SpiceCharDeviceMsgToClient *smartcard_read_msg_from_device(SpiceCharDeviceInstance *sin,
|
||||
void *opaque)
|
||||
static RedCharDeviceMsgToClient *smartcard_read_msg_from_device(SpiceCharDeviceInstance *sin,
|
||||
void *opaque)
|
||||
{
|
||||
SmartCardDeviceState *state = opaque;
|
||||
SpiceCharDeviceInterface *sif = spice_char_device_get_interface(sin);
|
||||
@ -173,19 +173,19 @@ static SpiceCharDeviceMsgToClient *smartcard_read_msg_from_device(SpiceCharDevic
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static SpiceCharDeviceMsgToClient *smartcard_ref_msg_to_client(SpiceCharDeviceMsgToClient *msg,
|
||||
void *opaque)
|
||||
static RedCharDeviceMsgToClient *smartcard_ref_msg_to_client(RedCharDeviceMsgToClient *msg,
|
||||
void *opaque)
|
||||
{
|
||||
return smartcard_ref_vsc_msg_item((MsgItem *)msg);
|
||||
}
|
||||
|
||||
static void smartcard_unref_msg_to_client(SpiceCharDeviceMsgToClient *msg,
|
||||
static void smartcard_unref_msg_to_client(RedCharDeviceMsgToClient *msg,
|
||||
void *opaque)
|
||||
{
|
||||
smartcard_unref_vsc_msg_item((MsgItem *)msg);
|
||||
}
|
||||
|
||||
static void smartcard_send_msg_to_client(SpiceCharDeviceMsgToClient *msg,
|
||||
static void smartcard_send_msg_to_client(RedCharDeviceMsgToClient *msg,
|
||||
RedClient *client,
|
||||
void *opaque)
|
||||
{
|
||||
|
||||
@ -92,20 +92,20 @@ static void spicevmc_pipe_item_unref(SpiceVmcPipeItem *item)
|
||||
}
|
||||
}
|
||||
|
||||
static SpiceCharDeviceMsgToClient *spicevmc_chardev_ref_msg_to_client(SpiceCharDeviceMsgToClient *msg,
|
||||
void *opaque)
|
||||
static RedCharDeviceMsgToClient *spicevmc_chardev_ref_msg_to_client(RedCharDeviceMsgToClient *msg,
|
||||
void *opaque)
|
||||
{
|
||||
return spicevmc_pipe_item_ref((SpiceVmcPipeItem *)msg);
|
||||
}
|
||||
|
||||
static void spicevmc_chardev_unref_msg_to_client(SpiceCharDeviceMsgToClient *msg,
|
||||
static void spicevmc_chardev_unref_msg_to_client(RedCharDeviceMsgToClient *msg,
|
||||
void *opaque)
|
||||
{
|
||||
spicevmc_pipe_item_unref((SpiceVmcPipeItem *)msg);
|
||||
}
|
||||
|
||||
static SpiceCharDeviceMsgToClient *spicevmc_chardev_read_msg_from_dev(SpiceCharDeviceInstance *sin,
|
||||
void *opaque)
|
||||
static RedCharDeviceMsgToClient *spicevmc_chardev_read_msg_from_dev(SpiceCharDeviceInstance *sin,
|
||||
void *opaque)
|
||||
{
|
||||
SpiceVmcState *state = opaque;
|
||||
SpiceCharDeviceInterface *sif;
|
||||
@ -140,9 +140,9 @@ static SpiceCharDeviceMsgToClient *spicevmc_chardev_read_msg_from_dev(SpiceCharD
|
||||
}
|
||||
}
|
||||
|
||||
static void spicevmc_chardev_send_msg_to_client(SpiceCharDeviceMsgToClient *msg,
|
||||
RedClient *client,
|
||||
void *opaque)
|
||||
static void spicevmc_chardev_send_msg_to_client(RedCharDeviceMsgToClient *msg,
|
||||
RedClient *client,
|
||||
void *opaque)
|
||||
{
|
||||
SpiceVmcState *state = opaque;
|
||||
SpiceVmcPipeItem *vmc_msg = msg;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user