mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-12 10:14:53 +00:00
char-device: Make send_tokens_to_client() optional
Only RedCharDeviceVDIPortClass implements this vfunc, rather than forcing every classes deriving from RedCharDeviceClass to implement it, red_char_device_send_tokens_to_client() can deal with it. Signed-off-by: Christophe Fergeau <cfergeau@redhat.com> Acked-by: Uri Lublin <uril@redhat.com>
This commit is contained in:
parent
046be756fc
commit
dedc4184c9
@ -122,6 +122,10 @@ red_char_device_send_tokens_to_client(RedCharDevice *dev,
|
||||
{
|
||||
RedCharDeviceClass *klass = RED_CHAR_DEVICE_GET_CLASS(dev);
|
||||
|
||||
if (klass->send_tokens_to_client == NULL) {
|
||||
g_warn_if_reached();
|
||||
return;
|
||||
}
|
||||
klass->send_tokens_to_client(dev, client, tokens);
|
||||
}
|
||||
|
||||
|
||||
@ -573,12 +573,6 @@ stream_device_send_msg_to_client(RedCharDevice *self, RedPipeItem *msg, RedClien
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
stream_device_send_tokens_to_client(RedCharDevice *self, RedClient *client, uint32_t tokens)
|
||||
{
|
||||
g_warning("%s: Not implemented!", G_STRFUNC);
|
||||
}
|
||||
|
||||
static void
|
||||
stream_device_remove_client(RedCharDevice *self, RedClient *client)
|
||||
{
|
||||
@ -795,7 +789,6 @@ stream_device_class_init(StreamDeviceClass *klass)
|
||||
|
||||
char_dev_class->read_one_msg_from_device = stream_device_read_msg_from_dev;
|
||||
char_dev_class->send_msg_to_client = stream_device_send_msg_to_client;
|
||||
char_dev_class->send_tokens_to_client = stream_device_send_tokens_to_client;
|
||||
char_dev_class->remove_client = stream_device_remove_client;
|
||||
char_dev_class->port_event = stream_device_port_event;
|
||||
}
|
||||
|
||||
@ -181,13 +181,6 @@ static void smartcard_send_msg_to_client(RedCharDevice *self,
|
||||
red_channel_client_pipe_add_push(rcc, msg);
|
||||
}
|
||||
|
||||
static void smartcard_send_tokens_to_client(RedCharDevice *self,
|
||||
RedClient *client,
|
||||
uint32_t tokens)
|
||||
{
|
||||
spice_error("not implemented");
|
||||
}
|
||||
|
||||
static void smartcard_remove_client(RedCharDevice *self, RedClient *client)
|
||||
{
|
||||
RedCharDeviceSmartcard *dev = RED_CHAR_DEVICE_SMARTCARD(self);
|
||||
@ -608,7 +601,6 @@ red_char_device_smartcard_class_init(RedCharDeviceSmartcardClass *klass)
|
||||
|
||||
char_dev_class->read_one_msg_from_device = smartcard_read_msg_from_device;
|
||||
char_dev_class->send_msg_to_client = smartcard_send_msg_to_client;
|
||||
char_dev_class->send_tokens_to_client = smartcard_send_tokens_to_client;
|
||||
char_dev_class->remove_client = smartcard_remove_client;
|
||||
}
|
||||
|
||||
|
||||
@ -420,16 +420,6 @@ static void spicevmc_port_send_event(RedChannelClient *rcc, uint8_t event)
|
||||
red_channel_client_pipe_add_push(rcc, &item->base);
|
||||
}
|
||||
|
||||
static void spicevmc_char_dev_send_tokens_to_client(RedCharDevice *self,
|
||||
RedClient *client,
|
||||
uint32_t tokens)
|
||||
{
|
||||
RedCharDeviceSpiceVmc *vmc = RED_CHAR_DEVICE_SPICEVMC(self);
|
||||
RedVmcChannel *channel = RED_VMC_CHANNEL(vmc->channel);
|
||||
|
||||
red_channel_warning(RED_CHANNEL(channel), "%s: Not implemented!", G_STRFUNC);
|
||||
}
|
||||
|
||||
static void spicevmc_char_dev_remove_client(RedCharDevice *self,
|
||||
RedClient *client)
|
||||
{
|
||||
@ -905,7 +895,6 @@ red_char_device_spicevmc_class_init(RedCharDeviceSpiceVmcClass *klass)
|
||||
|
||||
char_dev_class->read_one_msg_from_device = spicevmc_chardev_read_msg_from_dev;
|
||||
char_dev_class->send_msg_to_client = spicevmc_chardev_send_msg_to_client;
|
||||
char_dev_class->send_tokens_to_client = spicevmc_char_dev_send_tokens_to_client;
|
||||
char_dev_class->remove_client = spicevmc_char_dev_remove_client;
|
||||
char_dev_class->port_event = spicevmc_port_event;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user