diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2011-10-13 10:39:50 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2011-10-28 19:25:52 +0200 |
commit | 7877903aa0ef318017441c32605bc64650e6a326 (patch) | |
tree | 174952301a7a18059bb93ea32d7a93e4d6765beb /hw/scsi-generic.c | |
parent | e39be4823215e511d0e85aa33b2a5ade71064c72 (diff) | |
download | hqemu-7877903aa0ef318017441c32605bc64650e6a326.zip hqemu-7877903aa0ef318017441c32605bc64650e6a326.tar.gz |
scsi: move max_lba to SCSIDevice
The field is only in scsi-disk for now. Moving it up to SCSIDevice makes
it easier to reuse the scsi-generic reqops elsewhere.
At the same time, make scsi-generic get max_lba from snooped READ CAPACITY
commands as well.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/scsi-generic.c')
-rw-r--r-- | hw/scsi-generic.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c index 4d7ad82..fcf23cd 100644 --- a/hw/scsi-generic.c +++ b/hw/scsi-generic.c @@ -174,9 +174,11 @@ static void scsi_read_complete(void * opaque, int ret) /* Snoop READ CAPACITY output to set the blocksize. */ if (r->req.cmd.buf[0] == READ_CAPACITY_10) { s->blocksize = ldl_be_p(&r->buf[4]); + s->max_lba = ldl_be_p(&r->buf[0]); } else if (r->req.cmd.buf[0] == SERVICE_ACTION_IN_16 && (r->req.cmd.buf[1] & 31) == SAI_READ_CAPACITY_16) { s->blocksize = ldl_be_p(&r->buf[8]); + s->max_lba = ldq_be_p(&r->buf[0]); } bdrv_set_buffer_alignment(s->conf.bs, s->blocksize); |