• Douglas Gilbert's avatar
    scsi_debug 1.64 , remove detect(), "hotplug" hosts · 2eca25e4
    Douglas Gilbert authored
    This patch is against lk 2.5.46-bk3 which includes
    Christoph's work removing the requirement for
    detect() functions in LLDDs. He sent me an example
    for scsi_debug which I have built on with this patch.
    
    As threatened, this version includes a "scsi_debug_add_host"
    parameter. At kernel or module load time this is an absolute
    number (0..127 are allowable and 1 is the default). So:
         modprobe scsi_debug scsi_debug_num_devs=20 scsi_debug_add_host=0
    will result in no scsi_debug hosts (thus no devices) but
    the driver has 20 slots available for devices.
    
    Then a host can be introduced (simulated hotplug) by
         echo 1 > /sysfs/bus/scsi/drivers/scsi_debug/add_host
    This causes a scsi_debug host to appear and devices get
    found on it [14 in my system: 7 targets (0..6) each with
    2 luns (0..1)]. Another host hotplug can be simulated by
         echo 1 > /sysfs/bus/scsi/drivers/scsi_debug/add_host
    which results in another 6 devices being attached (for a
    total of 20 scsi_debug devices as dictated by the original
    scsi_debug_num_devs).
    
    That last (second) scsi_debug host can be removed by
         echo -1 > /sysfs/bus/scsi/drivers/scsi_debug/add_host
    and its 6 devices go. Another application of this "echo"
    removes the first host and all remaining devices.
    
    Seems to work fine.
    2eca25e4
scsi_debug.c 44.9 KB