mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
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>
This commit is contained in:
parent
ab9adc88c8
commit
cfdc1bb06e
7 changed files with 34 additions and 17 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue