megaraid

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

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

Go to latest
Published: Jun 25, 2023 License: Apache-2.0 Imports: 16 Imported by: 3

Documentation

Index

Constants

View Source
const (
	SYSFS_SCSI_HOST_DIR = "/sys/class/scsi_host"

	MAX_IOCTL_SGE = 16

	MFI_CMD_PD_SCSI_IO = 0x04
	MFI_CMD_DCMD       = 0x05

	MR_DCMD_CTRL_GET_INFO = 0x01010000
	MR_DCMD_PD_GET_LIST   = 0x02010000 // Obsolete / deprecated command
	MR_DCMD_PD_LIST_QUERY = 0x02010100

	MFI_FRAME_DIR_NONE  = 0x0000
	MFI_FRAME_DIR_WRITE = 0x0008
	MFI_FRAME_DIR_READ  = 0x0010
	MFI_FRAME_DIR_BOTH  = 0x0018
)

Variables

View Source
var (
	// 0xc1944d01 - Beware: cannot use unsafe.Sizeof(megasas_iocpacket{}) due to Go struct padding!
	MEGASAS_IOC_FIRMWARE = ioctl.Iowr('M', 1, uintptr(binary.Size(megasas_iocpacket{})))
)

Functions

func MegaScan

func MegaScan()

Scan system for MegaRAID adapters and their devices

func OpenMegasasIoctl

func OpenMegasasIoctl(host uint16, diskNum uint8) error

Types

type Iovec

type Iovec struct {
	Base uint64 // FIXME: This is not portable to 32-bit platforms!
	Len  uint64
}

type MegasasDevice

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

type MegasasIoctl

type MegasasIoctl struct {
	DeviceMajor uint32
	// contains filtered or unexported fields
}

Holder for megaraid_sas ioctl device

func CreateMegasasIoctl

func CreateMegasasIoctl() (MegasasIoctl, error)

CreateMegasasIoctl determines the device ID for the MegaRAID SAS ioctl device, creates it if necessary, and returns a MegasasIoctl struct to interact with the megaraid_sas driver.

func (*MegasasIoctl) Close

func (m *MegasasIoctl) Close()

Close closes the file descriptor of the MegasasIoctl instance

func (*MegasasIoctl) GetPDList

func (m *MegasasIoctl) GetPDList(host uint16) ([]MegasasPDAddress, error)

GetPDList retrieves a list of physical devices attached to the specified host

func (*MegasasIoctl) MFI

func (m *MegasasIoctl) MFI(host uint16, opcode uint32, b []byte) error

MFI sends a MegaRAID Firmware Interface (MFI) command to the specified host

func (*MegasasIoctl) PassThru

func (m *MegasasIoctl) PassThru(host uint16, diskNum uint8, cdb []byte, buf []byte, dxfer_dir int) error

PassThru sends a SCSI command to a MegaRAID controller

func (*MegasasIoctl) ScanDevices

func (m *MegasasIoctl) ScanDevices() []MegasasDevice

ScanDevices scans systme for (presumably) SMART-capable devices on all available host adapters

func (*MegasasIoctl) ScanHosts

func (m *MegasasIoctl) ScanHosts() ([]uint16, error)

ScanHosts scans system for megaraid_sas controllers and returns a slice of host numbers

type MegasasPDAddress

type MegasasPDAddress struct {
	DeviceId          uint16
	EnclosureId       uint16
	EnclosureIndex    uint8
	SlotNumber        uint8
	SCSIDevType       uint8
	ConnectPortBitmap uint8
	SASAddr           [2]uint64
}

Megasas physical device address

Jump to

Keyboard shortcuts

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