aboutsummaryrefslogtreecommitdiff
path: root/hw/usb/dev-storage.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2012-05-16 15:03:40 +0200
committerGerd Hoffmann <kraxel@redhat.com>2012-06-07 10:02:21 +0200
commit1dc903673aa3afee296aaa4664404fc5d373b79a (patch)
tree342285269ba3120c0c685e80954e077f74425209 /hw/usb/dev-storage.c
parent1e6ed80b90e3d9632532b4c496d26b0d101ced6b (diff)
usb-storage: add scsi_off, remove scsi_buf
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 <kraxel@redhat.com>
Diffstat (limited to 'hw/usb/dev-storage.c')
-rw-r--r--hw/usb/dev-storage.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c
index 924a86f964..5b9a286766 100644
--- a/hw/usb/dev-storage.c
+++ b/hw/usb/dev-storage.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 data_len;
struct usb_msd_csw csw;
SCSIRequest *req;
@@ -178,9 +178,9 @@ static void usb_msd_copy_data(MSDState *s, USBPacket *p)
len = p->iov.size - p->result;
if (len > s->scsi_len)
len = s->scsi_len;
- usb_packet_copy(p, s->scsi_buf, len);
+ usb_packet_copy(p, scsi_req_get_buf(s->req) + s->scsi_off, len);
s->scsi_len -= 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);
@@ -219,7 +219,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, p);
p = s->packet;