sgio

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 25, 2021 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ATA_PASSTHROUGH     = 0xa1
	ATA_TRUSTED_RCV     = 0x5c
	ATA_TRUSTED_SND     = 0x5e
	ATA_IDENTIFY_DEVICE = 0xec

	SCSI_INQUIRY          = 0x12
	SCSI_MODE_SENSE_6     = 0x1a
	SCSI_READ_CAPACITY_10 = 0x25
	SCSI_ATA_PASSTHRU_16  = 0x85
	SCSI_SECURITY_IN      = 0xa2
	SCSI_SECURITY_OUT     = 0xb5
)
View Source
const (
	CDBToDevice     CDBDirection = -2
	CDBFromDevice   CDBDirection = -3
	CDBToFromDevice CDBDirection = -4

	SG_INFO_OK_MASK = 0x1
	SG_INFO_OK      = 0x0

	SG_IO = 0x2285

	// Timeout in milliseconds
	DEFAULT_TIMEOUT = 20000

	PIO_DATA_IN  = 4
	PIO_DATA_OUT = 5

	SENSE_ILLEGAL_REQUEST = 0x5

	DRIVER_SENSE = 0x8
)

Variables

View Source
var (
	ErrIllegalRequest = errors.New("illegal SCSI request")
)

Functions

func ATAString

func ATAString(b []byte) string

func ATATrustedReceive

func ATATrustedReceive(fd uintptr, proto uint8, comID uint16, resp *[]byte) error

ATA TRUSTED RECEIVE

func ATATrustedSend

func ATATrustedSend(fd uintptr, proto uint8, comID uint16, in []byte) error

ATA TRUSTED SEND

func SCSIModeSense

func SCSIModeSense(fd uintptr, pageNum, subPageNum, pageControl uint8) ([]byte, error)

SCSI MODE SENSE(6) - Returns the raw response

func SCSIReadCapacity

func SCSIReadCapacity(fd uintptr) (uint64, error)

SCSI READ CAPACITY(10) - Returns the capacity in bytes

func SCSISecurityIn

func SCSISecurityIn(fd uintptr, proto uint8, sps uint16, resp *[]byte) error

SCSI SECURITY IN

func SCSISecurityOut

func SCSISecurityOut(fd uintptr, proto uint8, sps uint16, in []byte) error

SCSI SECURITY OUT

func SendCDB

func SendCDB(fd uintptr, cdb []byte, dir CDBDirection, buf *[]byte) error

Types

type CDB10

type CDB10 [10]byte

type CDB12

type CDB12 [12]byte

type CDB16

type CDB16 [16]byte

type CDB6

type CDB6 [6]byte

SCSI CDB types

type CDBDirection

type CDBDirection int32

type IdentifyDeviceResponse

type IdentifyDeviceResponse struct {
	Serial [20]byte

	Firmware [8]byte
	Model    [40]byte
	// contains filtered or unexported fields
}

ATA IDENTFY DEVICE response

func ATAIdentify

func ATAIdentify(fd uintptr) (IdentifyDeviceResponse, error)

ATA Passthrough via SCSI (which is what Linux uses for all ATA these days)

func (IdentifyDeviceResponse) String

func (id IdentifyDeviceResponse) String() string

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 SCSIInquiry

func SCSIInquiry(fd uintptr) (InquiryResponse, error)

INQUIRY - Returns parsed inquiry data.

func (InquiryResponse) String

func (inq InquiryResponse) String() string

Jump to

Keyboard shortcuts

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