scsi

package
v0.0.0-...-6bd98cc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SCSI commands used by this package
	SCSI_INQUIRY          = 0x12
	SCSI_MODE_SENSE_6     = 0x1a
	SCSI_READ_CAPACITY_10 = 0x25
	SCSI_ATA_PASSTHRU_16  = 0x85

	// Minimum length of standard INQUIRY response
	INQ_REPLY_LEN = 36

	// SCSI-3 mode pages
	RIGID_DISK_DRIVE_GEOMETRY_PAGE = 0x04

	// Mode page control field
	MPAGE_CONTROL_DEFAULT = 2
)
View Source
const (
	SG_DXFER_NONE        = -1
	SG_DXFER_TO_DEV      = -2
	SG_DXFER_FROM_DEV    = -3
	SG_DXFER_TO_FROM_DEV = -4

	SG_INFO_OK_MASK = 0x1
	SG_INFO_OK      = 0x0

	SG_IO = 0x2285

	// Timeout in milliseconds
	DEFAULT_TIMEOUT = 20000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CDB10

type CDB10 [10]byte

type CDB16

type CDB16 [16]byte

type CDB6

type CDB6 [6]byte

SCSI CDB types

type Device

type Device interface {
	Open() error
	Close() error
	PrintSMART(*drivedb.DriveDb, io.Writer) error
}

Top-level device interface. All supported device types must implement these methods.

func OpenSCSIAutodetect

func OpenSCSIAutodetect(name string) (Device, error)

type InquiryResponse

type InquiryResponse struct {
	Peripheral byte // peripheral qualifier, device type

	Version byte

	VendorIdent  [8]byte
	ProductIdent [16]byte
	ProductRev   [4]byte
	// contains filtered or unexported fields
}

SCSI INQUIRY response

func (InquiryResponse) String

func (inq InquiryResponse) String() string

type SATDevice

type SATDevice struct {
	SCSIDevice
}

SATDevice is a simple wrapper around an embedded SCSIDevice type, which handles sending ATA commands via SCSI pass-through (SCSI-ATA Translation).

func (*SATDevice) PrintSMART

func (d *SATDevice) PrintSMART(db *drivedb.DriveDb, w io.Writer) error

type SCSIDevice

type SCSIDevice struct {
	Name string
	// contains filtered or unexported fields
}

TODO: Make a constructor function for this.

func (*SCSIDevice) Close

func (d *SCSIDevice) Close() error

func (*SCSIDevice) Open

func (d *SCSIDevice) Open() (err error)

func (*SCSIDevice) PrintSMART

func (d *SCSIDevice) PrintSMART(db *drivedb.DriveDb, w io.Writer) error

Regular SCSI (including SAS, but excluding SATA) SMART functions not yet fully implemented.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL