Documentation ¶
Overview ¶
Package scsi provices a library for working with version 3 SCSI generic drivers.
Index ¶
Constants ¶
const ( // S represents the SG_IO V3 interface variant identifier. S = int32('S') // SGIO is the SG_IO ioctl command. SGIO = 0x2285 // SenseBufLen is the length of the sense buffer. SenseBufLen = 32 // SGDxferNone is the SCSI test unit ready command. SGDxferNone = -1 // SGDxferToDev is the SCSI write command. SGDxferToDev = -2 // SGDxferFromDev is the SCSI read command. SGDxferFromDev = -3 // SGGetVersionNum is the SCSI get version command. SGGetVersionNum = 0x2282 // DefaultTimeout is time in milliseconds for SCSI commands. DefaultTimeout = 5 * 1000 // InquiryCmd is the SCSI INQUIRY command. InquiryCmd = 0x12 // InguiryBufLen is the length of the inquiry buffer. InguiryBufLen = 252 // Page0 is VPD page 0. Page0 = 0x00 // Page80 is VPD page 80. Page80 = 0x80 // Page83 is VPD page 83. Page83 = 0x83 // Page83PreSPC3 is VPD page pre-spc3-83. Page83PreSPC3 = -0x83 // VendorLength is the vendor length. VendorLength = 8 // ModelLength is the model length. ModelLength = 16 // MaxSerialLen is the maximum length of the serial number, including // added prefixes such as vendor and product (model) strings. MaxSerialLen = 256 // DescriptorTypeVendorSpecific is the vendor specific descriptor type. DescriptorTypeVendorSpecific = 0 // DescriptorTypeT10Vendor is the t10vendor descriptor type. DescriptorTypeT10Vendor = 1 // DescriptorTypeEUI64 is the eui64 descriptor type. DescriptorTypeEUI64 = 2 // DescriptorTypeNAA is the naa descriptor type. DescriptorTypeNAA = 3 // DescriptorTypeRelport is the relport descriptor type. DescriptorTypeRelport = 4 // DescriptorTypeTgtGroup is the tgtgroup descriptor type. DescriptorTypeTgtGroup = 5 // DescriptorTypeLungroup is the lungroup descriptor type. DescriptorTypeLungroup = 6 // DescriptorTypeMD5 is the md5 descriptor type. DescriptorTypeMD5 = 7 // DescriptorTypeName is the name descriptor type. DescriptorTypeName = 8 // CodeSetBinary is the binary code set. CodeSetBinary = 1 // CodeSetASCII is the ASCII code set. CodeSetASCII = 2 )
const ( // TypeDisk represents the disk device type. TypeDisk = iota // TypeTape represents the tape device type. TypeTape // TypeOptical represents the optical device type. TypeOptical // TypeCD represents the cd device type. TypeCD )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandDescriptorBlock ¶
type CommandDescriptorBlock = [InguiryBufLen]byte
CommandDescriptorBlock represents the command descriptor block.
type Device ¶
type Device struct { *ID // contains filtered or unexported fields }
Device represents a SCSI device.
func NewDevice ¶
NewDevice returns a SCSI device. See https://www.tldp.org/HOWTO/SCSI-Generic-HOWTO/iddriver.html.
func (*Device) Identify ¶
Identify queries a SCSI device via the SCSI INQUIRY vital product data (VPD) page 0x80 and 0x83.
func (*Device) Page0Inquiry ¶
Page0Inquiry returns a list of Vital Product Data (VPD) pages. TODO(andrewrynhard): Should pages by an iota?
func (*Device) Page80Inquiry ¶
Page80Inquiry gets unit serial number VPD page.
func (*Device) Page83Inquiry ¶
Page83Inquiry sends a page 83 INQUIRY to the device.
func (*Device) StandardInquiry ¶
StandardInquiry performs a basic inquiry on the device. nolint: gocyclo
type GenericIOHeader ¶
type GenericIOHeader struct { InterfaceID int32 DxferDirection int32 CmdLen uint8 MxSbLen uint8 IovecCount uint16 DxferLen uint32 Dxferp *byte Cmdp *uint8 Sbp *uint8 Timeout uint32 Flags uint32 PackID int32 UsrPtr *byte Status uint8 MaskedStatus uint8 MsgStatus uint8 SbLenWr uint8 HostStatus uint16 DriverStatus uint16 Resid int32 Duration uint32 Info uint32 // contains filtered or unexported fields }
GenericIOHeader is the control structure for the version 3 SCSI generic driver.