• Douglas Gilbert's avatar
    2.5.53 SCSI_IOCTL_GET_IDLUN+GET_BUS_NUMBER revisited · 1f3e6f50
    Douglas Gilbert authored
    Currently for block devices both the SCSI_IOCTL_GET_IDLUN and 
    SCSI_IOCTL_GET_BUS_NUMBER ioctls yield the value 0 (type: int).
    
    Various applications that utilize the sg driver use these ioctls
    to work out the relationship between sg devices and their higher
    level counterparts in the sd, sr, st and osst drivers. Examples
    that spring to mind are cdrecord, cdparanoia, SANE and sg_utils.
    
    This has been discussed in an earlier threaded started by me:
    http://marc.theaimsgroup.com/?l=linux-scsi&m=103967899608891&w=2
    in which my patch removed the ioctls in question from the block
    level. This broke non-scsi block devices that used applications
    that thought they were talking to an sg device **.
    
    The attachment fine tunes the original patch: for scsi block
    devices (i.e. owned by the sd or sr drivers) these 2 ioctls
    are redirected to the scsi mid level; for non-scsi block
    devices they will yield the value as 0 as they do now in
    lk 2.5.53 .
    
    
    ** This "yield 0" strategy will come unstuck when 2 or more
    cd writers (for example) are connected to the same box.
    Hence to be well formed, these ioctls (together) should
    produce unique tuples for each device (be they ATA(PI) or
    SCSI).
    1f3e6f50
sd.c 40.8 KB