static void smartcard_remove_reader(SmartCardChannel *smartcard_channel, reader_id_t reader_id) { SpiceCharDeviceInstance *char_device = smartcard_readers_get(reader_id); SmartCardDeviceState *state; if (char_device == NULL) { smartcard_push_error(smartcard_channel, reader_id, VSC_GENERAL_ERROR); return; } state = SPICE_CONTAINEROF(char_device->st, SmartCardDeviceState, base); if (state->attached == FALSE) { smartcard_push_error(smartcard_channel, reader_id, VSC_GENERAL_ERROR); return; } smartcard_char_device_detach(char_device, smartcard_channel); }
static void smartcard_remove_reader(SmartCardChannelClient *scc, uint32_t reader_id) { SpiceCharDeviceInstance *char_device = smartcard_readers_get(reader_id); SmartCardDeviceState *state; if (char_device == NULL) { smartcard_push_error(&scc->base, reader_id, VSC_GENERAL_ERROR); return; } state = spice_char_device_state_opaque_get(char_device->st); if (state->reader_added == FALSE) { smartcard_push_error(&scc->base, reader_id, VSC_GENERAL_ERROR); return; } spice_assert(scc->smartcard_state == state); smartcard_char_device_notify_reader_remove(state); }