diff options
author | Gerd Hoffmann | 2011-07-12 15:22:25 +0200 |
---|---|---|
committer | Gerd Hoffmann | 2011-08-04 15:51:22 +0200 |
commit | 4f4321c11ff6e98583846bfd6f0e81954924b003 (patch) | |
tree | 5b4c7f185539ed6a91b1c63c0841de7cff6a3ac5 /usb-bsd.c | |
parent | move QEMUSGList typedef (diff) | |
download | qemu-4f4321c11ff6e98583846bfd6f0e81954924b003.tar.gz qemu-4f4321c11ff6e98583846bfd6f0e81954924b003.tar.xz qemu-4f4321c11ff6e98583846bfd6f0e81954924b003.zip |
usb: use iovecs in USBPacket
Zap data pointer from USBPacket, add a QEMUIOVector instead.
Add a bunch of helper functions to manage USBPacket data.
Switch over users to the new interface.
Note that USBPacket->len was used for two purposes: First to
pass in the buffer size and second to return the number of
transfered bytes or the status code on async transfers. There
is a new result variable for the latter. A new status code
was added to catch uninitialized result.
Nobody creates iovecs with more than one element (yet).
Some users are (temporarely) limited to iovecs with a single
element to keep the patch size as small as possible.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'usb-bsd.c')
-rw-r--r-- | usb-bsd.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -253,9 +253,9 @@ static int usb_host_handle_data(USBDevice *dev, USBPacket *p) } if (p->pid == USB_TOKEN_IN) - ret = read(fd, p->data, p->len); + ret = readv(fd, p->iov.iov, p->iov.niov); else - ret = write(fd, p->data, p->len); + ret = writev(fd, p->iov.iov, p->iov.niov); sigprocmask(SIG_SETMASK, &old_mask, NULL); |