From 09e2cbc7c0cf90b3279df9cdcc42c331c1a43004 Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Fri, 20 Feb 2015 17:00:51 +0100 Subject: smartcard: Port to RedsState Calls to red_channel_create and reds_register_channel need an additional RedsState argument. This fixes compilation when building with --enable-smartcard --- server/smartcard.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/server/smartcard.c b/server/smartcard.c index 8927fb1e..4333cd4a 100644 --- a/server/smartcard.c +++ b/server/smartcard.c @@ -24,7 +24,7 @@ #include "reds.h" #include "char-device.h" -#include "red_channel.h" +#include "red-channel.h" #include "smartcard.h" #include "migration-protocol.h" @@ -101,7 +101,7 @@ static struct Readers { static SpiceCharDeviceInstance* smartcard_readers_get_unattached(void); static SpiceCharDeviceInstance* smartcard_readers_get(uint32_t reader_id); -static int smartcard_char_device_add_to_readers(SpiceCharDeviceInstance *sin); +static int smartcard_char_device_add_to_readers(RedsState *reds, SpiceCharDeviceInstance *sin); static void smartcard_char_device_attach_client( SpiceCharDeviceInstance *char_device, SmartCardChannelClient *scc); static void smartcard_channel_write_to_reader(SpiceCharDeviceWriteBuffer *write_buf); @@ -110,7 +110,7 @@ static MsgItem *smartcard_char_device_on_message_from_device( SmartCardDeviceState *state, VSCMsgHeader *header); static SmartCardDeviceState *smartcard_device_state_new(RedsState *reds, SpiceCharDeviceInstance *sin); static void smartcard_device_state_free(SmartCardDeviceState* st); -static void smartcard_init(void); +static void smartcard_init(RedsState *reds); static void smartcard_read_buf_prepare(SmartCardDeviceState *state, VSCMsgHeader *vheader) { @@ -225,7 +225,8 @@ MsgItem *smartcard_char_device_on_message_from_device(SmartCardDeviceState *stat return NULL; } -static int smartcard_char_device_add_to_readers(SpiceCharDeviceInstance *char_device) +static int smartcard_char_device_add_to_readers(RedsState *reds, + SpiceCharDeviceInstance *char_device) { SmartCardDeviceState *state = spice_char_device_state_opaque_get(char_device->st); @@ -234,7 +235,7 @@ static int smartcard_char_device_add_to_readers(SpiceCharDeviceInstance *char_de } state->reader_id = g_smartcard_readers.num; g_smartcard_readers.sin[g_smartcard_readers.num++] = char_device; - smartcard_init(); + smartcard_init(reds); return 0; } @@ -311,7 +312,7 @@ SpiceCharDeviceState *smartcard_device_connect(RedsState *reds, SpiceCharDeviceI SmartCardDeviceState *st; st = smartcard_device_state_new(reds, char_device); - if (smartcard_char_device_add_to_readers(char_device) == -1) { + if (smartcard_char_device_add_to_readers(reds, char_device) == -1) { smartcard_device_state_free(st); return NULL; } @@ -824,7 +825,7 @@ static void smartcard_connect_client(RedChannel *channel, RedClient *client, SmartCardChannel *g_smartcard_channel; -static void smartcard_init(void) +static void smartcard_init(RedsState *reds) { ChannelCbs channel_cbs = { NULL, }; ClientCbs client_cbs = { NULL, }; @@ -843,7 +844,8 @@ static void smartcard_init(void) channel_cbs.handle_migrate_data = smartcard_channel_client_handle_migrate_data; g_smartcard_channel = (SmartCardChannel*)red_channel_create(sizeof(SmartCardChannel), - core, SPICE_CHANNEL_SMARTCARD, 0, + reds, reds_get_core_interface(reds), + SPICE_CHANNEL_SMARTCARD, 0, FALSE /* handle_acks */, smartcard_channel_handle_message, &channel_cbs, @@ -856,5 +858,5 @@ static void smartcard_init(void) client_cbs.connect = smartcard_connect_client; red_channel_register_client_cbs(&g_smartcard_channel->base, &client_cbs); - reds_register_channel(&g_smartcard_channel->base); + reds_register_channel(reds, &g_smartcard_channel->base); } -- cgit