summaryrefslogtreecommitdiff
path: root/hw/usb-msd.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2011-04-18 17:11:14 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2011-05-26 12:14:14 +0200
commitcfdc1bb06ee4cd3a7e4aa0ebf14b00c0ce3a5e94 (patch)
tree3f7da29f2bb352933928902c461c33bde5026d85 /hw/usb-msd.c
parentab9adc88c80186cfef29bda076363e20aa675241 (diff)
downloadqemu-cfdc1bb06ee4cd3a7e4aa0ebf14b00c0ce3a5e94.tar.gz
scsi: introduce SCSIBusOps
There are more operations than a SCSI bus can handle, besides completing commands. One example, which this series will introduce, is cleaning up after a request is cancelled. More long term, a "SCSI bus" can represent the LUNs attached to a target; in this case, while all commands will ultimately reach a logical unit, it is the target who is in charge of answering REPORT LUNs. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Cc: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'hw/usb-msd.c')
-rw-r--r--hw/usb-msd.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/hw/usb-msd.c b/hw/usb-msd.c
index bd1c3a415f..c0a381abb3 100644
--- a/hw/usb-msd.c
+++ b/hw/usb-msd.c
@@ -487,6 +487,10 @@ static void usb_msd_password_cb(void *opaque, int err)
qdev_unplug(&s->dev.qdev);
}
+static const struct SCSIBusOps usb_msd_scsi_ops = {
+ .complete = usb_msd_command_complete
+};
+
static int usb_msd_initfn(USBDevice *dev)
{
MSDState *s = DO_UPCAST(MSDState, dev, dev);
@@ -516,7 +520,7 @@ static int usb_msd_initfn(USBDevice *dev)
}
usb_desc_init(dev);
- scsi_bus_new(&s->bus, &s->dev.qdev, 0, 1, usb_msd_command_complete);
+ scsi_bus_new(&s->bus, &s->dev.qdev, 0, 1, &usb_msd_scsi_ops);
s->scsi_dev = scsi_bus_legacy_add_drive(&s->bus, bs, 0, !!s->removable);
if (!s->scsi_dev) {
return -1;