From b8268774cc0274203f09d42efbfd775e2aafc67a Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Gerd Hoffmann Date: Thu, 16 Aug 2012 11:39:15 +0200 Subject: [PATCH 13/18] usb-storage: add scsi_off, remove scsi_buf RH-Author: Gerd Hoffmann Message-id: <1345117160-21046-14-git-send-email-kraxel@redhat.com> Patchwork-id: 40926 O-Subject: [RHEL-6.4 qemu-kvm PATCH 13/18] usb-storage: add scsi_off, remove scsi_buf Bugzilla: 805172 RH-Acked-by: Paolo Bonzini RH-Acked-by: Hans de Goede RH-Acked-by: Laszlo Ersek Repace the running buffer pointer (scsi_buf) with a buffer offset field (scsi_off). The later is alot easier to live-migrate. Signed-off-by: Gerd Hoffmann (cherry picked from commit 1dc903673aa3afee296aaa4664404fc5d373b79a) Conflicts: hw/usb-msd.c --- hw/usb-msd.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) Signed-off-by: Michal Novotny --- hw/usb-msd.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/usb-msd.c b/hw/usb-msd.c index 2f7316e..57afe14 100644 --- a/hw/usb-msd.c +++ b/hw/usb-msd.c @@ -48,8 +48,8 @@ struct usb_msd_csw { typedef struct { USBDevice dev; enum USBMSDMode mode; + uint32_t scsi_off; uint32_t scsi_len; - uint8_t *scsi_buf; uint32_t usb_len; uint8_t *usb_buf; uint32_t data_len; @@ -181,14 +181,14 @@ static void usb_msd_copy_data(MSDState *s) if (len > s->scsi_len) len = s->scsi_len; if (s->mode == USB_MSDM_DATAIN) { - memcpy(s->usb_buf, s->scsi_buf, len); + memcpy(s->usb_buf, scsi_req_get_buf(s->req) + s->scsi_off, len); } else { - memcpy(s->scsi_buf, s->usb_buf, len); + memcpy(scsi_req_get_buf(s->req) + s->scsi_off, s->usb_buf, len); } s->usb_len -= len; s->scsi_len -= len; s->usb_buf += len; - s->scsi_buf += len; + s->scsi_off += len; s->data_len -= len; if (s->scsi_len == 0 || s->data_len == 0) { scsi_req_continue(s->req); @@ -227,7 +227,7 @@ static void usb_msd_transfer_data(SCSIRequest *req, uint32_t len) assert((s->mode == USB_MSDM_DATAOUT) == (req->cmd.mode == SCSI_XFER_TO_DEV)); s->scsi_len = len; - s->scsi_buf = scsi_req_get_buf(req); + s->scsi_off = 0; if (p) { usb_msd_copy_data(s); if (s->packet && s->usb_len == 0) { -- 1.7.11.4