[PATCH 4/5] [scsi]: Add BSG support for scsi-bus and scsi-disk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx>

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 <nab@xxxxxxxxxxxxxxx>
---
 hw/scsi-bus.c  |    3 ++-
 hw/scsi-disk.c |    4 ++++
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
index 7d80405..b5f5fbb 100644
--- a/hw/scsi-bus.c
+++ b/hw/scsi-bus.c
@@ -90,7 +90,8 @@ SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, DriveInfo *dinfo, int unit)
     const char *driver;
     DeviceState *dev;
 
-    driver = bdrv_is_sg(dinfo->bdrv) ? "scsi-generic" : "scsi-disk";
+    driver = bdrv_is_bsg(dinfo->bdrv) ? "scsi-bsg" :
+             bdrv_is_sg(dinfo->bdrv) ? "scsi-generic" : "scsi-disk";
     dev = qdev_create(&bus->qbus, driver);
     qdev_prop_set_uint32(dev, "scsi-id", unit);
     qdev_prop_set_drive(dev, "drive", dinfo);
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index fb3c189..290a2e7 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -704,6 +704,10 @@ static int scsi_disk_initfn(SCSIDevice *dev)
         error_report("scsi-disk: unwanted /dev/sg*");
         return -1;
     }
+    if (bdrv_is_bsg(s->bs)) {
+        error_report("scsi-disk: unwanted BSG");
+        return -1;
+    } 
 
     if (bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM) {
         s->qdev.blocksize = 2048;
-- 
1.5.6.5

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux