- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Want to know more about SG_IO
Operating System - Linux
1752577
Members
4588
Online
108788
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2007 10:10 PM
03-07-2007 10:10 PM
Want to know more about SG_IO
Hi All,
Please let me know what all information we can get by using SG_IO inquiry ioctl.
By using SCSI_IOCTL_SEND_COMMAND inquiry ioctl will get the folloing info.
1) vendor ID 2) Product ID 3)device type (disk,tape..) 4)firmware version 5)ISO version 6) ANSI Version 7)ECMA version 8) response format 9) device connectivity (whether device is removable or not).. Will get the following structure info with SCSI IOCTL SEND COMMAND inquiry ioctl.
typedef struct _inqd {
uchar type; /* byte 0 */
uchar rmvm; /* byte 1 */
uchar versions; /* byte 2 */
uchar rdf_etc; /* byte 3 */
uchar addlLen; /* byte 4 (n - 4) */
uchar rsvd1[3]; /* bytes 5-7 */
uchar vid[8]; /* bytes 8-15 */
uchar pid[16]; /* bytes 16-31 */
uchar rev[4]; /* bytes 32-35 */
uchar vndr1[20]; /* bytes 36-55 */
uchar rsvd2[40]; /* bytes 56-95*/ uchar vndr2[159]; /* bytes 96-n (pad out to 255) */
}
Like this what all info we can get by using SG_IO inquiry ioctl.
From my knowledge we can get Vendor ID and Product ID and firmware revison level..what about other info ?
Your help is appreciated
Please let me know what all information we can get by using SG_IO inquiry ioctl.
By using SCSI_IOCTL_SEND_COMMAND inquiry ioctl will get the folloing info.
1) vendor ID 2) Product ID 3)device type (disk,tape..) 4)firmware version 5)ISO version 6) ANSI Version 7)ECMA version 8) response format 9) device connectivity (whether device is removable or not).. Will get the following structure info with SCSI IOCTL SEND COMMAND inquiry ioctl.
typedef struct _inqd {
uchar type; /* byte 0 */
uchar rmvm; /* byte 1 */
uchar versions; /* byte 2 */
uchar rdf_etc; /* byte 3 */
uchar addlLen; /* byte 4 (n - 4) */
uchar rsvd1[3]; /* bytes 5-7 */
uchar vid[8]; /* bytes 8-15 */
uchar pid[16]; /* bytes 16-31 */
uchar rev[4]; /* bytes 32-35 */
uchar vndr1[20]; /* bytes 36-55 */
uchar rsvd2[40]; /* bytes 56-95*/ uchar vndr2[159]; /* bytes 96-n (pad out to 255) */
}
Like this what all info we can get by using SG_IO inquiry ioctl.
From my knowledge we can get Vendor ID and Product ID and firmware revison level..what about other info ?
Your help is appreciated
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2007 05:41 AM
03-08-2007 05:41 AM
Re: Want to know more about SG_IO
SG_IO is a generic IOCTL for sending "raw" SCSI commands and getting their responses back. "Inquiry" is a SCSI command that all SCSI devices should understand and respond to. So, your question is more about the SCSI standards family than about Linux.
Disclaimer: I'm not a SCSI guru. Everything below this is a result of some quick Web browsing. I may have misunderstood something.
The beginning of linux/include/scsi/sg.h (in the Linux kernel source tree) has some documentation and pointers for more:
Linux SG_IO ioctl in 2.6 kernel series:
http://sg.torque.net/sg/sg_io.html
SCSI standards drafts (drafts are free, but you must pay to get the final versions)
http://www.t10.org/
From there, you can find the most recent description of the INQUIRY command in the "SCSI Primary Commands - 4" (SPC-4) document:
http://www.t10.org/ftp/t10/drafts/spc4/spc4r09.pdf
See chapter 6.4.2 for a description of the INQUIRY response data. As far as I understand, when you use the SG_IO ioctl to send an inquiry command, this is what you'll get written into the memory location you specified in the sg_io_hdr structure.
Chapter 7.6 describes the Vital Product Data pages you can optionally request with an INQUIRY command. These will contain a lot of information, but all kinds of SCSI devices don't have the same pages available: you must first request the VPD page 00h to get a list of available VPD pages. Then your program must decide what pages to request, based on what's available and what's sensible to request given the generic type of the device.
Disclaimer: I'm not a SCSI guru. Everything below this is a result of some quick Web browsing. I may have misunderstood something.
The beginning of linux/include/scsi/sg.h (in the Linux kernel source tree) has some documentation and pointers for more:
Linux SG_IO ioctl in 2.6 kernel series:
http://sg.torque.net/sg/sg_io.html
SCSI standards drafts (drafts are free, but you must pay to get the final versions)
http://www.t10.org/
From there, you can find the most recent description of the INQUIRY command in the "SCSI Primary Commands - 4" (SPC-4) document:
http://www.t10.org/ftp/t10/drafts/spc4/spc4r09.pdf
See chapter 6.4.2 for a description of the INQUIRY response data. As far as I understand, when you use the SG_IO ioctl to send an inquiry command, this is what you'll get written into the memory location you specified in the sg_io_hdr structure.
Chapter 7.6 describes the Vital Product Data pages you can optionally request with an INQUIRY command. These will contain a lot of information, but all kinds of SCSI devices don't have the same pages available: you must first request the VPD page 00h to get a list of available VPD pages. Then your program must decide what pages to request, based on what's available and what's sensible to request given the generic type of the device.
MK
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP