aboutsummaryrefslogtreecommitdiff
path: root/hw/usb/ccid-card-passthru.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2016-10-22 12:52:51 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2016-10-24 15:27:20 +0200
commitbecdfa00cfa2995e859ccefa4b7d72a72eb96581 (patch)
tree8973236c181dcde0dbcd9fd36d122fc7a4bac6d7 /hw/usb/ccid-card-passthru.c
parentecb672d14f092f481000ac9cd9d7dc0500692eba (diff)
downloadqemu-becdfa00cfa2995e859ccefa4b7d72a72eb96581.zip
qemu-becdfa00cfa2995e859ccefa4b7d72a72eb96581.tar.gz
qemu-becdfa00cfa2995e859ccefa4b7d72a72eb96581.tar.bz2
char: replace PROP_CHR with CharBackend
Store the property in a CharBackend instead of CharDriverState*. This also replace systematically chr by chr.chr to access the CharDriverState*. The following patches will replace it with calls to qemu_chr_fe CharBackend functions. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20161022095318.17775-12-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/usb/ccid-card-passthru.c')
-rw-r--r--hw/usb/ccid-card-passthru.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c
index 2eacea7..ebe3942 100644
--- a/hw/usb/ccid-card-passthru.c
+++ b/hw/usb/ccid-card-passthru.c
@@ -48,7 +48,7 @@ typedef struct PassthruState PassthruState;
struct PassthruState {
CCIDCardState base;
- CharDriverState *cs;
+ CharBackend cs;
uint8_t vscard_in_data[VSCARD_IN_SIZE];
uint32_t vscard_in_pos;
uint32_t vscard_in_hdr;
@@ -77,9 +77,9 @@ static void ccid_card_vscard_send_msg(PassthruState *s,
scr_msg_header.length = htonl(length);
/* XXX this blocks entire thread. Rewrite to use
* qemu_chr_fe_write and background I/O callbacks */
- qemu_chr_fe_write_all(s->cs, (uint8_t *)&scr_msg_header,
+ qemu_chr_fe_write_all(s->cs.chr, (uint8_t *)&scr_msg_header,
sizeof(VSCMsgHeader));
- qemu_chr_fe_write_all(s->cs, payload, length);
+ qemu_chr_fe_write_all(s->cs.chr, payload, length);
}
static void ccid_card_vscard_send_apdu(PassthruState *s,
@@ -264,7 +264,7 @@ static void ccid_card_vscard_handle_message(PassthruState *card,
static void ccid_card_vscard_drop_connection(PassthruState *card)
{
- qemu_chr_delete(card->cs);
+ qemu_chr_delete(card->cs.chr);
card->vscard_in_pos = card->vscard_in_hdr = 0;
}
@@ -324,7 +324,7 @@ static void passthru_apdu_from_guest(
{
PassthruState *card = PASSTHRU_CCID_CARD(base);
- if (!card->cs) {
+ if (!card->cs.chr) {
printf("ccid-passthru: no chardev, discarding apdu length %d\n", len);
return;
}
@@ -345,9 +345,9 @@ static int passthru_initfn(CCIDCardState *base)
card->vscard_in_pos = 0;
card->vscard_in_hdr = 0;
- if (card->cs) {
+ if (card->cs.chr) {
DPRINTF(card, D_INFO, "initing chardev\n");
- qemu_chr_add_handlers(card->cs,
+ qemu_chr_add_handlers(card->cs.chr,
ccid_card_vscard_can_read,
ccid_card_vscard_read,
ccid_card_vscard_event, card);