From time to time I am asked how to pass a 32 byte SCSI command (cdb) through the sg driver. My stock answer is to refer people to the bsg driver for that purpose. Since the bsg driver and the sg driver now make essentially the same calls to the underlying block layer interface it seems about time to relax the 16 byte cdb restriction on the sg driver. Obviously the implementation to do this has been well tested already by the bsg driver so the same implementation is lifted by this patch into the sg driver. SPC-4 (draft rev 36i section 3.1.30) states the maximum cdb size in SCSI is 260 bytes. [Seems to me XCDBs could exceed that since they can contain multiple XCDB descriptors each of which is 140 bytes long.] Anyway the sg v3 interface (sg_io_hdr as used by the sg driver) restricts the cdb length by the type of its 'unsigned char cmd_len;' field, namely 255. So not quite 260 but better than 16. The bsg driver uses a uint32_t for its cdb length field and may want to consider putting an upper limit on that ... Documentation: This file in the kernel: Documentation/scsi/scsi-generic.txt does not describe the sg v3 interface but instead points to this page: http://sg.danny.cz/sg/p/sg_v3_ho.html which does describe the sg v3 interface. If this patch is accepted I will update the description of the cmd_len field in that web page. ChangeLog: - remove the 16 byte CDB (SCSI command) length limit from the sg driver by handling longer CDBs the same way as the bsg driver. Remove comment from sg.h public interface about the cmd_len field being limited to 16 bytes. Signed-off-by: Douglas Gilbert