From f9d4ad025e35723cb359d09da283b0ed2f71e71b Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Wed, 29 Feb 2012 12:39:17 +0100 Subject: [PATCH 02/35] usb-redir: rhel6 build fixups RH-Author: Gerd Hoffmann Message-id: <1330519171-24231-3-git-send-email-kraxel@redhat.com> Patchwork-id: 37759 O-Subject: [RHEL-6.3 qemu-kvm PATCH v2 02/16] usb-redir: rhel6 build fixups Bugzilla: 758104 RH-Acked-by: Paolo Bonzini RH-Acked-by: Markus Armbruster RH-Acked-by: Alex Williamson Changes needed to make usb-redir build on the rhel6 code base. Kept separate from the previous patch to simplify review. --- usb-redir.c | 19 ++++++++++++++----- 1 files changed, 14 insertions(+), 5 deletions(-) Signed-off-by: Michal Novotny --- usb-redir.c | 19 ++++++++++++++----- 1 files changed, 14 insertions(+), 5 deletions(-) diff --git a/usb-redir.c b/usb-redir.c index e212993..8d60db4 100644 --- a/usb-redir.c +++ b/usb-redir.c @@ -705,7 +705,10 @@ static void usbredir_open_close_bh(void *opaque) } if (dev->cs->opened) { - dev->parser = qemu_oom_check(usbredirparser_create()); + dev->parser = usbredirparser_create(); + if (dev->parser == NULL) { + abort(); + } dev->parser->priv = dev; dev->parser->log_func = usbredir_log; dev->parser->read_func = usbredir_read; @@ -786,6 +789,12 @@ static void usbredir_chardev_event(void *opaque, int event) * init + destroy */ +static QemuChrHandlers usbredir_handlers = { + .fd_can_read = usbredir_chardev_can_read, + .fd_read = usbredir_chardev_read, + .fd_event = usbredir_chardev_event, +}; + static int usbredir_initfn(USBDevice *udev) { USBRedirDevice *dev = DO_UPCAST(USBRedirDevice, dev, udev); @@ -797,7 +806,7 @@ static int usbredir_initfn(USBDevice *udev) } dev->open_close_bh = qemu_bh_new(usbredir_open_close_bh, dev); - dev->attach_timer = qemu_new_timer_ms(vm_clock, usbredir_do_attach, dev); + dev->attach_timer = qemu_new_timer(vm_clock, usbredir_do_attach, dev); QTAILQ_INIT(&dev->asyncq); for (i = 0; i < MAX_ENDPOINTS; i++) { @@ -807,8 +816,7 @@ static int usbredir_initfn(USBDevice *udev) /* We'll do the attach once we receive the speed from the usb-host */ udev->auto_attach = 0; - qemu_chr_add_handlers(dev->cs, usbredir_chardev_can_read, - usbredir_chardev_read, usbredir_chardev_event, dev); + qemu_chr_add_handlers(dev->cs, &usbredir_handlers, dev); return 0; } @@ -910,7 +918,8 @@ static void usbredir_device_disconnect(void *priv) * Delay next usb device attach to give the guest a chance to see * see the detach / attach in case of quick close / open succession */ - dev->next_attach_time = qemu_get_clock_ms(vm_clock) + 200; + dev->next_attach_time = qemu_get_clock(vm_clock) + + get_ticks_per_sec() * 200 / 1000; /* 200 ms */ } } -- 1.7.7.6