mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-23 19:49:43 +00:00
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>
This commit is contained in:
parent
1e6ed80b90
commit
1dc903673a
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user