[Spice-devel] [PATCH 02/17] Add RedsState arg to smartcard_device_connect()
Frediano Ziglio
fziglio at redhat.com
Thu Feb 11 19:24:01 UTC 2016
From: Jonathon Jongsma <jjongsma at redhat.com>
---
server/reds.c | 3 +--
server/smartcard.c | 8 ++++----
server/smartcard.h | 2 +-
3 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/server/reds.c b/server/reds.c
index c33aded..8f26d83 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3097,7 +3097,7 @@ static int spice_server_char_device_add_interface(SpiceServer *s,
}
#ifdef USE_SMARTCARD
else if (strcmp(char_device->subtype, SUBTYPE_SMARTCARD) == 0) {
- if (!(dev_state = smartcard_device_connect(char_device))) {
+ if (!(dev_state = smartcard_device_connect(reds, char_device))) {
return -1;
}
}
@@ -3120,7 +3120,6 @@ static int spice_server_char_device_add_interface(SpiceServer *s,
if (reds->vm_running) {
spice_char_device_start(char_device->st);
}
- spice_char_device_set_server(char_device->st, reds);
reds_char_device_add_state(reds, char_device->st);
} else {
spice_warning("failed to create device state for %s", char_device->subtype);
diff --git a/server/smartcard.c b/server/smartcard.c
index 0d6ba7b..e9e58a8 100644
--- a/server/smartcard.c
+++ b/server/smartcard.c
@@ -114,7 +114,7 @@ static void smartcard_channel_write_to_reader(SpiceCharDeviceWriteBuffer *write_
static MsgItem *smartcard_char_device_on_message_from_device(
SmartCardDeviceState *state, VSCMsgHeader *header);
-static SmartCardDeviceState *smartcard_device_state_new(SpiceCharDeviceInstance *sin);
+static SmartCardDeviceState *smartcard_device_state_new(RedsState *reds, SpiceCharDeviceInstance *sin);
static void smartcard_device_state_free(SmartCardDeviceState* st);
static void smartcard_init(void);
@@ -266,7 +266,7 @@ static SpiceCharDeviceInstance *smartcard_readers_get_unattached(void)
return NULL;
}
-static SmartCardDeviceState *smartcard_device_state_new(SpiceCharDeviceInstance *sin)
+static SmartCardDeviceState *smartcard_device_state_new(RedsState *reds, SpiceCharDeviceInstance *sin)
{
SmartCardDeviceState *st;
SpiceCharDeviceCallbacks chardev_cbs = { NULL, };
@@ -312,11 +312,11 @@ void smartcard_device_disconnect(SpiceCharDeviceInstance *char_device)
smartcard_device_state_free(st);
}
-SpiceCharDeviceState *smartcard_device_connect(SpiceCharDeviceInstance *char_device)
+SpiceCharDeviceState *smartcard_device_connect(RedsState *reds, SpiceCharDeviceInstance *char_device)
{
SmartCardDeviceState *st;
- st = smartcard_device_state_new(char_device);
+ st = smartcard_device_state_new(reds, char_device);
if (smartcard_char_device_add_to_readers(char_device) == -1) {
smartcard_device_state_free(st);
return NULL;
diff --git a/server/smartcard.h b/server/smartcard.h
index f9cbbfc..cf9d49b 100644
--- a/server/smartcard.h
+++ b/server/smartcard.h
@@ -24,7 +24,7 @@
/*
* connect to smartcard interface, used by smartcard channel
*/
-SpiceCharDeviceState *smartcard_device_connect(SpiceCharDeviceInstance *char_device);
+SpiceCharDeviceState *smartcard_device_connect(RedsState *reds, SpiceCharDeviceInstance *char_device);
void smartcard_device_disconnect(SpiceCharDeviceInstance *char_device);
#endif // __SMART_CARD_H__
--
2.5.0
More information about the Spice-devel
mailing list