smart

package
v1.4.6 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2021 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// INQ_REPLY_LEN = 96
	INQ_REPLY_LEN = 20

	SGInfoOk     = 0x0 //no sense, host nor driver "noise" or error
	SGInfoOkMask = 0x1 //indicates whether some error or status field is non-zero

	SG_IO             = 0x2285 //scsi generic ioctl command
	SCSI_INQUIRY      = 0x12   // inquiry command
	SG_DXFER_FROM_DEV = -3
)
View Source
const (
	NVME_ADMIN_IDENTIFY = 0x06
)

Variables

View Source
var (
	NVME_IOCTL_ADMIN_CMD = ioctl.Iowr('N', 0x41, unsafe.Sizeof(nvmePassthruCommand{}))
)
View Source
var (
	NativeEndian binary.ByteOrder
)

A ByteOrder specifies how to convert byte sequences into 16-, 32-, or 64-bit unsigned integers.

View Source
var (
	SERIALINQUIRY = []byte{0x12, 0x01, 0x80, 0x00, 0x60, 0x00}
)

Functions

func GetSerialNumber

func GetSerialNumber(devicePath string) (string, error)

func Ioctl

func Ioctl(fd, cmd, ptr uintptr) error

func IsNVMEDevice

func IsNVMEDevice(devPath string) bool

Types

type CDB6

type CDB6 [6]byte

type InquiryResponse

type InquiryResponse [20]byte

type NVMeDevice

type NVMeDevice struct {
	Name string
}

func NewNVMeDevice

func NewNVMeDevice(name string) *NVMeDevice

func (*NVMeDevice) SerialNumber

func (d *NVMeDevice) SerialNumber() (string, error)

type SCSIDevice

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

func NewSCSIDevice

func NewSCSIDevice(devName string) *SCSIDevice

func (*SCSIDevice) SerialNumber

func (d *SCSIDevice) SerialNumber() (string, error)

type SmartDevice

type SmartDevice interface {
	SerialNumber() (string, error)
}

Jump to

Keyboard shortcuts

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