From: Nicholas Bellinger <n...@linux-iscsi.org> This patch updates hw/scsi-bus.c:scsi_bus_legacy_add_drive() to check for the scsi-bsg backstore.
It also updates hw/scsi-disk.c:scsi_disk_initfn() to check for when bdrv_is_bsg() is present and we need to fail for the fileio backed scsi-disk code. Signed-off-by: Nicholas A. Bellinger <n...@linux-iscsi.org> --- hw/scsi-bus.c | 3 ++- hw/scsi-disk.c | 5 +++++ 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c index 0f8fd57..502d3f3 100644 --- a/hw/scsi-bus.c +++ b/hw/scsi-bus.c @@ -89,7 +89,8 @@ SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockDriverState *bdrv, int const char *driver; DeviceState *dev; - driver = bdrv_is_sg(bdrv) ? "scsi-generic" : "scsi-disk"; + driver = bdrv_is_bsg(bdrv) ? "scsi-bsg" : + bdrv_is_sg(bdrv) ? "scsi-generic" : "scsi-disk"; dev = qdev_create(&bus->qbus, driver); qdev_prop_set_uint32(dev, "scsi-id", unit); if (qdev_prop_set_drive(dev, "drive", bdrv) < 0) { diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index 88a2f74..5a5aa8f 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -1201,6 +1201,11 @@ static int scsi_disk_initfn(SCSIDevice *dev) return -1; } + if (bdrv_is_bsg(s->bs)) { + error_report("scsi-disk: unwanted BSG"); + return -1; + } + if (is_cd) { s->qdev.blocksize = 2048; } else { -- 1.5.6.5