The Linux SCSI Programming HOWTO the Linux SCSI Programming HOWTO
Total Page:16
File Type:pdf, Size:1020Kb
The Linux SCSI programming HOWTO The Linux SCSI programming HOWTO Table of Contents The Linux SCSI programming HOWTO.........................................................................................................1 Heiko Eißfeldt heiko@colossus.escape.de..............................................................................................1 1.What's New?.........................................................................................................................................1 2.Introduction...........................................................................................................................................1 3.What Is The Generic SCSI Interface?...................................................................................................1 4.What Are The Requirements To Use It?...............................................................................................1 5.Programmers Guide .............................................................................................................................1 6.Overview Of Device Programming......................................................................................................1 7.Opening The Device.............................................................................................................................1 8.The Header Structure............................................................................................................................2 9.Inquiry Command Example..................................................................................................................2 10.The Sense Buffer.................................................................................................................................2 11.Example Using Sense Buffer..............................................................................................................2 12.Ioctl Functions....................................................................................................................................2 13.Driver Defaults....................................................................................................................................2 14.Obtaining The Scsi Specifications......................................................................................................2 15.Related Information Sources...............................................................................................................2 16.Other useful stuff................................................................................................................................2 17.Other SCSI Access Interfaces.............................................................................................................3 18.Final Comments..................................................................................................................................3 19.Acknowledgments...............................................................................................................................3 Appendix..................................................................................................................................................3 20.Appendix.............................................................................................................................................3 21.Error handling.....................................................................................................................................3 22.Additional sense codes and additional sense code qualifiers..............................................................3 23.A SCSI command code quick reference.............................................................................................3 24.Example programs..............................................................................................................................3 1. What's New?........................................................................................................................................4 10. The Sense Buffer................................................................................................................................4 11. Example Using Sense Buffer.............................................................................................................5 12. Ioctl Functions...................................................................................................................................7 13. Driver Defaults...................................................................................................................................7 13.1 Transfer Lengths..............................................................................................................................7 13.2 Timeout And Retry Values..............................................................................................................7 14. Obtaining The Scsi Specifications.....................................................................................................8 15. Related Information Sources..............................................................................................................9 15.1 HOWTOs and FAQs........................................................................................................................9 15.2 Mailing list.......................................................................................................................................9 15.3 Example code...................................................................................................................................9 16. Other useful stuff.............................................................................................................................10 16.1 Device driver writer helpers...........................................................................................................10 16.2 Utilities...........................................................................................................................................10 17. Other SCSI Access Interfaces..........................................................................................................11 18. Final Comments...............................................................................................................................11 19. Acknowledgments............................................................................................................................12 2. Introduction........................................................................................................................................12 20. Appendix..........................................................................................................................................12 i The Linux SCSI programming HOWTO Table of Contents 21. Error handling..................................................................................................................................12 21.1 Error status decoding.....................................................................................................................13 21.2 Status codes....................................................................................................................................14 21.3 SCSI Sense Keys...........................................................................................................................15 21.4 Host codes......................................................................................................................................17 21.5 Driver codes...................................................................................................................................18 22. Additional sense codes and additional sense code qualifiers...........................................................18 22.1 ASC and ASCQ in lexical order....................................................................................................19 22.2 ASC and ASCQ in numerical order...............................................................................................23 23. A SCSI command code quick reference..........................................................................................29 24. Example programs...........................................................................................................................33 3. What Is The Generic SCSI Interface?................................................................................................36 4. What Are The Requirements To Use It?............................................................................................37 4.1 Kernel Configuration.......................................................................................................................37 4.2 Device Files.....................................................................................................................................37 4.3 Device Mapping...............................................................................................................................38 Dynamically insert and remove SCSI devices..........................................................................38 5. Programmers Guide ..........................................................................................................................39 6. Overview Of Device Programming...................................................................................................40