aboutsummaryrefslogtreecommitdiffstats
path: root/hw/scsi-generic.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2011-08-03 10:49:12 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2011-08-12 08:29:01 -0500
commit87dcd1b2c27e88a47be5036e9cf4c2767054eb31 (patch)
treee0d478e3e96e3851442d3e1ebd3cd34f7ed6bb21 /hw/scsi-generic.c
parent2599aece1b222ad4f9714275b38bf1d3e9424b54 (diff)
scsi: push lun field to SCSIDevice
This will let SCSIBus detect requests sent to an invalid LUN, and handle them itself. However, there will be still support for only one LUN per target Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/scsi-generic.c')
-rw-r--r--hw/scsi-generic.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c
index c2bd39995..8046ea61e 100644
--- a/hw/scsi-generic.c
+++ b/hw/scsi-generic.c
@@ -60,7 +60,6 @@ struct SCSIGenericState
{
SCSIDevice qdev;
BlockDriverState *bs;
- int lun;
};
static void scsi_free_request(SCSIRequest *req)
@@ -292,7 +291,7 @@ static int32_t scsi_send_command(SCSIRequest *req, uint8_t *cmd)
SCSIGenericReq *r = DO_UPCAST(SCSIGenericReq, req, req);
int ret;
- if (cmd[0] != REQUEST_SENSE && req->lun != s->lun) {
+ if (cmd[0] != REQUEST_SENSE && req->lun != s->qdev.lun) {
DPRINTF("Unimplemented LUN %d\n", req->lun);
scsi_req_build_sense(&r->req, SENSE_CODE(LUN_NOT_SUPPORTED));
scsi_req_complete(&r->req, CHECK_CONDITION);
@@ -466,8 +465,6 @@ static int scsi_generic_initfn(SCSIDevice *dev)
}
/* define device state */
- s->lun = scsiid.lun;
- DPRINTF("LUN %d\n", s->lun);
s->qdev.type = scsiid.scsi_type;
DPRINTF("device type %d\n", s->qdev.type);
if (s->qdev.type == TYPE_TAPE) {