mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-26 14:41:25 +00:00
smartcard: Use RedChannelClient as the type for RedCharDevice client
As now is an opaque type for RedCharDevice use the type that better suits us. This avoid useless conversions or look ups. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Victor Toso <victortoso@redhat.com>
This commit is contained in:
parent
14fe2c3766
commit
b862bee93f
@ -16,6 +16,8 @@
|
||||
*/
|
||||
#include <config.h>
|
||||
|
||||
#define RedCharDeviceClientOpaque RedChannelClient
|
||||
|
||||
#include "smartcard-channel-client.h"
|
||||
|
||||
struct SmartCardChannelClientPrivate
|
||||
@ -121,7 +123,6 @@ smartcard_channel_client_alloc_msg_rcv_buf(RedChannelClient *rcc,
|
||||
uint16_t type, uint32_t size)
|
||||
{
|
||||
SmartCardChannelClient *scc = SMARTCARD_CHANNEL_CLIENT(rcc);
|
||||
RedClient *client = red_channel_client_get_client(rcc);
|
||||
|
||||
/* TODO: only one reader is actually supported. When we fix the code to support
|
||||
* multiple readers, we will probably associate different devices to
|
||||
@ -137,7 +138,7 @@ smartcard_channel_client_alloc_msg_rcv_buf(RedChannelClient *rcc,
|
||||
spice_assert(smartcard_char_device_get_client(smartcard) || scc->priv->smartcard);
|
||||
spice_assert(!scc->priv->write_buf);
|
||||
scc->priv->write_buf =
|
||||
red_char_device_write_buffer_get_client(RED_CHAR_DEVICE(smartcard), client, size);
|
||||
red_char_device_write_buffer_get_client(RED_CHAR_DEVICE(smartcard), rcc, size);
|
||||
|
||||
if (!scc->priv->write_buf) {
|
||||
spice_error("failed to allocate write buffer");
|
||||
|
||||
@ -22,6 +22,8 @@
|
||||
#include <libcacard.h>
|
||||
#endif
|
||||
|
||||
#define RedCharDeviceClientOpaque RedChannelClient
|
||||
|
||||
#include "reds.h"
|
||||
#include "char-device.h"
|
||||
#include "smartcard.h"
|
||||
@ -164,24 +166,22 @@ static RedPipeItem *smartcard_read_msg_from_device(RedCharDevice *self,
|
||||
* so no mutex is required. */
|
||||
static void smartcard_send_msg_to_client(RedCharDevice *self,
|
||||
RedPipeItem *msg,
|
||||
RedClient *client)
|
||||
RedChannelClient *client)
|
||||
{
|
||||
RedCharDeviceSmartcard *dev = RED_CHAR_DEVICE_SMARTCARD(self);
|
||||
RedChannelClient *rcc = RED_CHANNEL_CLIENT(dev->priv->scc);
|
||||
|
||||
spice_assert(dev->priv->scc &&
|
||||
red_channel_client_get_client(rcc) == client);
|
||||
spice_assert(dev->priv->scc && rcc == client);
|
||||
red_pipe_item_ref(msg);
|
||||
red_channel_client_pipe_add_push(rcc, msg);
|
||||
}
|
||||
|
||||
static void smartcard_remove_client(RedCharDevice *self, RedClient *client)
|
||||
static void smartcard_remove_client(RedCharDevice *self, RedChannelClient *client)
|
||||
{
|
||||
RedCharDeviceSmartcard *dev = RED_CHAR_DEVICE_SMARTCARD(self);
|
||||
RedChannelClient *rcc = RED_CHANNEL_CLIENT(dev->priv->scc);
|
||||
|
||||
spice_assert(dev->priv->scc &&
|
||||
red_channel_client_get_client(rcc) == client);
|
||||
spice_assert(dev->priv->scc && rcc == client);
|
||||
red_channel_client_shutdown(rcc);
|
||||
}
|
||||
|
||||
@ -305,7 +305,7 @@ void smartcard_char_device_attach_client(SpiceCharDeviceInstance *char_device,
|
||||
dev->priv->scc = scc;
|
||||
smartcard_channel_client_set_char_device(scc, dev);
|
||||
client_added = red_char_device_client_add(RED_CHAR_DEVICE(dev),
|
||||
red_channel_client_get_client(RED_CHANNEL_CLIENT(scc)),
|
||||
RED_CHANNEL_CLIENT(scc),
|
||||
FALSE, /* no flow control yet */
|
||||
0, /* send queue size */
|
||||
~0,
|
||||
@ -362,7 +362,7 @@ void smartcard_char_device_detach_client(RedCharDeviceSmartcard *smartcard,
|
||||
|
||||
spice_assert(smartcard->priv->scc == scc);
|
||||
red_char_device_client_remove(RED_CHAR_DEVICE(smartcard),
|
||||
red_channel_client_get_client(RED_CHANNEL_CLIENT(scc)));
|
||||
RED_CHANNEL_CLIENT(scc));
|
||||
smartcard_channel_client_set_char_device(scc, NULL);
|
||||
smartcard->priv->scc = NULL;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user