plat_linux

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IOC_NONE  = 0x0
	IOC_WRITE = 0x1
	IOC_READ  = 0x2

	IOC_NRBITS   = 8
	IOC_TYPEBITS = 8

	IOC_SIZEBITS = 14
	IOC_DIRBITS  = 2

	IOC_NRSHIFT   = 0
	IOC_TYPESHIFT = IOC_NRSHIFT + IOC_NRBITS
	IOC_SIZESHIFT = IOC_TYPESHIFT + IOC_TYPEBITS
	IOC_DIRSHIFT  = IOC_SIZESHIFT + IOC_SIZEBITS

	IOC_NRMASK   = ((1 << IOC_NRBITS) - 1)
	IOC_TYPEMASK = ((1 << IOC_TYPEBITS) - 1)
	IOC_SIZEMASK = ((1 << IOC_SIZEBITS) - 1)
	IOC_DIRMASK  = ((1 << IOC_DIRBITS) - 1)
)

Generic ioctl constants

View Source
const (
	IOC_IN        = IOC_WRITE << IOC_DIRSHIFT
	IOC_OUT       = IOC_READ << IOC_DIRSHIFT
	IOC_INOUT     = (IOC_WRITE | IOC_READ) << IOC_DIRSHIFT
	IOCSIZE_MASK  = IOC_SIZEMASK << IOC_SIZESHIFT
	IOCSIZE_SHIFT = IOC_SIZESHIFT
)

Additional ioctl constant

View Source
const (
	SG_DXFER_NONE        = -1
	SG_DXFER_TO_DEV      = -2
	SG_DXFER_FROM_DEV    = -3
	SG_DXFER_TO_FROM_DEV = -4

	SG_READ  = 0
	SG_WRITE = 1

	SG_PIO = 0
	SG_DMA = 1

	SG_CHECK_CONDITION = 0x02
	SG_DRIVER_SENSE    = 0x08

	SG_ATA_16     = 0x85
	SG_ATA_16_LEN = 16

	SG_ATA_12     = 0xa1
	SG_ATA_12_LEN = 12

	SG_ATA_LBA48          = 1
	SG_ATA_PROTO_NON_DATA = 3
	SG_ATA_PROTO_PIO_IN   = 4
	SG_ATA_PROTO_PIO_OUT  = 5
	SG_ATA_PROTO_DMA      = 6
	SG_ATA_PROTO_UDMA_IN  = 11 /* not yet supported in libata */
	SG_ATA_PROTO_UDMA_OUT = 12 /* not yet supported in libata */
)
View Source
const (
	SG_CDB2_TLEN_NODATA = 0
	SG_CDB2_TLEN_FEAT   = 1
	SG_CDB2_TLEN_NSECT  = 2

	SG_CDB2_TLEN_BYTES   = 0
	SG_CDB2_TLEN_SECTORS = 1

	SG_CDB2_TDIR_TO_DEV   = 0
	SG_CDB2_TDIR_FROM_DEV = 1

	SG_CDB2_CHECK_COND = 1
)
View Source
const (
	CDB6GENERIC_LENGTH  = 6
	CDB10GENERIC_LENGTH = 10
	CDB12GENERIC_LENGTH = 12
)
View Source
const (
	MODE_PAGE_VENDOR_SPECIFIC               = 0x00
	MODE_PAGE_ERROR_RECOVERY                = 0x01
	MODE_PAGE_DISCONNECT                    = 0x02
	MODE_PAGE_FORMAT_DEVICE                 = 0x03 // disk
	MODE_PAGE_MRW                           = 0x03 // cdrom
	MODE_PAGE_RIGID_GEOMETRY                = 0x04
	MODE_PAGE_FLEXIBILE                     = 0x05 // disk
	MODE_PAGE_WRITE_PARAMETERS              = 0x05 // cdrom
	MODE_PAGE_VERIFY_ERROR                  = 0x07
	MODE_PAGE_CACHING                       = 0x08
	MODE_PAGE_PERIPHERAL                    = 0x09
	MODE_PAGE_CONTROL                       = 0x0A
	MODE_PAGE_MEDIUM_TYPES                  = 0x0B
	MODE_PAGE_NOTCH_PARTITION               = 0x0C
	MODE_PAGE_CD_AUDIO_CONTROL              = 0x0E
	MODE_PAGE_DATA_COMPRESS                 = 0x0F
	MODE_PAGE_DEVICE_CONFIG                 = 0x10
	MODE_PAGE_XOR_CONTROL                   = 0x10 // disk
	MODE_PAGE_MEDIUM_PARTITION              = 0x11
	MODE_PAGE_ENCLOSURE_SERVICES_MANAGEMENT = 0x14
	MODE_PAGE_EXTENDED                      = 0x15
	MODE_PAGE_EXTENDED_DEVICE_SPECIFIC      = 0x16
	MODE_PAGE_CDVD_FEATURE_SET              = 0x18
	MODE_PAGE_PROTOCOL_SPECIFIC_LUN         = 0x18
	MODE_PAGE_PROTOCOL_SPECIFIC_PORT        = 0x19
	MODE_PAGE_POWER_CONDITION               = 0x1A
	MODE_PAGE_LUN_MAPPING                   = 0x1B
	MODE_PAGE_FAULT_REPORTING               = 0x1C
	MODE_PAGE_CDVD_INACTIVITY               = 0x1D // cdrom
	MODE_PAGE_ELEMENT_ADDRESS               = 0x1D
	MODE_PAGE_TRANSPORT_GEOMETRY            = 0x1E
	MODE_PAGE_DEVICE_CAPABILITIES           = 0x1F
	MODE_PAGE_CAPABILITIES                  = 0x2A // cdrom

	MODE_SENSE_RETURN_ALL = 0x3f

	MODE_SENSE_CURRENT_VALUES    = 0x00
	MODE_SENSE_CHANGEABLE_VALUES = 0x40
	MODE_SENSE_DEFAULT_VAULES    = 0x80
	MODE_SENSE_SAVED_VALUES      = 0xc0
)
View Source
const (
	// 6-byte commands:
	SCSIOP_TEST_UNIT_READY     = 0x00
	SCSIOP_REZERO_UNIT         = 0x01
	SCSIOP_REWIND              = 0x01
	SCSIOP_REQUEST_BLOCK_ADDR  = 0x02
	SCSIOP_REQUEST_SENSE       = 0x03
	SCSIOP_FORMAT_UNIT         = 0x04
	SCSIOP_READ_BLOCK_LIMITS   = 0x05
	SCSIOP_REASSIGN_BLOCKS     = 0x07
	SCSIOP_INIT_ELEMENT_STATUS = 0x07
	SCSIOP_READ6               = 0x08
	SCSIOP_RECEIVE             = 0x08
	SCSIOP_WRITE6              = 0x0A
	SCSIOP_PRINT               = 0x0A
	SCSIOP_SEND                = 0x0A
	SCSIOP_SEEK6               = 0x0B
	SCSIOP_TRACK_SELECT        = 0x0B
	SCSIOP_SLEW_PRINT          = 0x0B
	SCSIOP_SET_CAPACITY        = 0x0B // tape
	SCSIOP_SEEK_BLOCK          = 0x0C
	SCSIOP_PARTITION           = 0x0D
	SCSIOP_READ_REVERSE        = 0x0F
	SCSIOP_WRITE_FILEMARKS     = 0x10
	SCSIOP_FLUSH_BUFFER        = 0x10
	SCSIOP_SPACE               = 0x11
	SCSIOP_INQUIRY             = 0x12
	SCSIOP_VERIFY6             = 0x13
	SCSIOP_RECOVER_BUF_DATA    = 0x14
	SCSIOP_MODE_SELECT         = 0x15
	SCSIOP_RESERVE_UNIT        = 0x16
	SCSIOP_RELEASE_UNIT        = 0x17
	SCSIOP_COPY                = 0x18
	SCSIOP_ERASE               = 0x19
	SCSIOP_MODE_SENSE          = 0x1A
	SCSIOP_START_STOP_UNIT     = 0x1B
	SCSIOP_STOP_PRINT          = 0x1B
	SCSIOP_LOAD_UNLOAD         = 0x1B
	SCSIOP_RECEIVE_DIAGNOSTIC  = 0x1C
	SCSIOP_SEND_DIAGNOSTIC     = 0x1D
	SCSIOP_MEDIUM_REMOVAL      = 0x1E

	// 10-byte commands
	SCSIOP_READ_FORMATTED_CAPACITY = 0x23
	SCSIOP_READ_CAPACITY           = 0x25
	SCSIOP_READ                    = 0x28
	SCSIOP_WRITE                   = 0x2A
	SCSIOP_SEEK                    = 0x2B
	SCSIOP_LOCATE                  = 0x2B
	SCSIOP_POSITION_TO_ELEMENT     = 0x2B
	SCSIOP_WRITE_VERIFY            = 0x2E
	SCSIOP_VERIFY                  = 0x2F
	SCSIOP_SEARCH_DATA_HIGH        = 0x30
	SCSIOP_SEARCH_DATA_EQUAL       = 0x31
	SCSIOP_SEARCH_DATA_LOW         = 0x32
	SCSIOP_SET_LIMITS              = 0x33
	SCSIOP_READ_POSITION           = 0x34
	SCSIOP_SYNCHRONIZE_CACHE       = 0x35
	SCSIOP_COMPARE                 = 0x39
	SCSIOP_COPY_COMPARE            = 0x3A
	SCSIOP_WRITE_DATA_BUFF         = 0x3B
	SCSIOP_READ_DATA_BUFF          = 0x3C
	SCSIOP_WRITE_LONG              = 0x3F
	SCSIOP_CHANGE_DEFINITION       = 0x40
	SCSIOP_WRITE_SAME              = 0x41
	SCSIOP_READ_SUB_CHANNEL        = 0x42
	SCSIOP_UNMAP                   = 0x42 // block device
	SCSIOP_READ_TOC                = 0x43
	SCSIOP_READ_HEADER             = 0x44
	SCSIOP_REPORT_DENSITY_SUPPORT  = 0x44 // tape
	SCSIOP_PLAY_AUDIO              = 0x45
	SCSIOP_GET_CONFIGURATION       = 0x46
	SCSIOP_PLAY_AUDIO_MSF          = 0x47
	SCSIOP_PLAY_TRACK_INDEX        = 0x48
	SCSIOP_SANITIZE                = 0x48 // block device
	SCSIOP_PLAY_TRACK_RELATIVE     = 0x49
	SCSIOP_GET_EVENT_STATUS        = 0x4A
	SCSIOP_PAUSE_RESUME            = 0x4B
	SCSIOP_LOG_SELECT              = 0x4C
	SCSIOP_LOG_SENSE               = 0x4D
	SCSIOP_STOP_PLAY_SCAN          = 0x4E
	SCSIOP_XDWRITE                 = 0x50
	SCSIOP_XPWRITE                 = 0x51
	SCSIOP_READ_DISK_INFORMATION   = 0x51
	SCSIOP_READ_DISC_INFORMATION   = 0x51 // proper use of disc over disk
	SCSIOP_READ_TRACK_INFORMATION  = 0x52
	SCSIOP_XDWRITE_READ            = 0x53
	SCSIOP_RESERVE_TRACK_RZONE     = 0x53
	SCSIOP_SEND_OPC_INFORMATION    = 0x54 // optimum power calibration
	SCSIOP_MODE_SELECT10           = 0x55
	SCSIOP_RESERVE_UNIT10          = 0x56
	SCSIOP_RESERVE_ELEMENT         = 0x56
	SCSIOP_RELEASE_UNIT10          = 0x57
	SCSIOP_RELEASE_ELEMENT         = 0x57
	SCSIOP_REPAIR_TRACK            = 0x58
	SCSIOP_MODE_SENSE10            = 0x5A
	SCSIOP_CLOSE_TRACK_SESSION     = 0x5B
	SCSIOP_READ_BUFFER_CAPACITY    = 0x5C
	SCSIOP_SEND_CUE_SHEET          = 0x5D
	SCSIOP_PERSISTENT_RESERVE_IN   = 0x5E
	SCSIOP_PERSISTENT_RESERVE_OUT  = 0x5F

	// 12-byte commands
	SCSIOP_REPORT_LUNS                  = 0xA0
	SCSIOP_BLANK                        = 0xA1
	SCSIOP_ATA_PASSTHROUGH12            = 0xA1
	SCSIOP_SEND_EVENT                   = 0xA2
	SCSIOP_SECURITY_PROTOCOL_IN         = 0xA2
	SCSIOP_SEND_KEY                     = 0xA3
	SCSIOP_MAINTENANCE_IN               = 0xA3
	SCSIOP_REPORT_KEY                   = 0xA4
	SCSIOP_MAINTENANCE_OUT              = 0xA4
	SCSIOP_MOVE_MEDIUM                  = 0xA5
	SCSIOP_LOAD_UNLOAD_SLOT             = 0xA6
	SCSIOP_EXCHANGE_MEDIUM              = 0xA6
	SCSIOP_SET_READ_AHEAD               = 0xA7
	SCSIOP_MOVE_MEDIUM_ATTACHED         = 0xA7
	SCSIOP_READ12                       = 0xA8
	SCSIOP_GET_MESSAGE                  = 0xA8
	SCSIOP_SERVICE_ACTION_OUT12         = 0xA9
	SCSIOP_WRITE12                      = 0xAA
	SCSIOP_SEND_MESSAGE                 = 0xAB
	SCSIOP_SERVICE_ACTION_IN12          = 0xAB
	SCSIOP_GET_PERFORMANCE              = 0xAC
	SCSIOP_READ_DVD_STRUCTURE           = 0xAD
	SCSIOP_WRITE_VERIFY12               = 0xAE
	SCSIOP_VERIFY12                     = 0xAF
	SCSIOP_SEARCH_DATA_HIGH12           = 0xB0
	SCSIOP_SEARCH_DATA_EQUAL12          = 0xB1
	SCSIOP_SEARCH_DATA_LOW12            = 0xB2
	SCSIOP_SET_LIMITS12                 = 0xB3
	SCSIOP_READ_ELEMENT_STATUS_ATTACHED = 0xB4
	SCSIOP_REQUEST_VOL_ELEMENT          = 0xB5
	SCSIOP_SECURITY_PROTOCOL_OUT        = 0xB5
	SCSIOP_SEND_VOLUME_TAG              = 0xB6
	SCSIOP_SET_STREAMING                = 0xB6 // C/DVD
	SCSIOP_READ_DEFECT_DATA             = 0xB7
	SCSIOP_READ_ELEMENT_STATUS          = 0xB8
	SCSIOP_READ_CD_MSF                  = 0xB9
	SCSIOP_SCAN_CD                      = 0xBA
	SCSIOP_REDUNDANCY_GROUP_IN          = 0xBA
	SCSIOP_SET_CD_SPEED                 = 0xBB
	SCSIOP_REDUNDANCY_GROUP_OUT         = 0xBB
	SCSIOP_PLAY_CD                      = 0xBC
	SCSIOP_SPARE_IN                     = 0xBC
	SCSIOP_MECHANISM_STATUS             = 0xBD
	SCSIOP_SPARE_OUT                    = 0xBD
	SCSIOP_READ_CD                      = 0xBE
	SCSIOP_VOLUME_SET_IN                = 0xBE
	SCSIOP_SEND_DVD_STRUCTURE           = 0xBF
	SCSIOP_VOLUME_SET_OUT               = 0xBF
	SCSIOP_INIT_ELEMENT_RANGE           = 0xE7

	// 16-byte commands
	SCSIOP_XDWRITE_EXTENDED16            = 0x80 // disk
	SCSIOP_WRITE_FILEMARKS16             = 0x80 // tape
	SCSIOP_REBUILD16                     = 0x81 // disk
	SCSIOP_READ_REVERSE16                = 0x81 // tape
	SCSIOP_REGENERATE16                  = 0x82 // disk
	SCSIOP_EXTENDED_COPY                 = 0x83
	SCSIOP_POPULATE_TOKEN                = 0x83 // disk
	SCSIOP_WRITE_USING_TOKEN             = 0x83 // disk
	SCSIOP_RECEIVE_COPY_RESULTS          = 0x84
	SCSIOP_RECEIVE_ROD_TOKEN_INFORMATION = 0x84 //disk
	SCSIOP_ATA_PASSTHROUGH16             = 0x85
	SCSIOP_ACCESS_CONTROL_IN             = 0x86
	SCSIOP_ACCESS_CONTROL_OUT            = 0x87
	SCSIOP_READ16                        = 0x88
	SCSIOP_COMPARE_AND_WRITE             = 0x89
	SCSIOP_WRITE16                       = 0x8A
	SCSIOP_READ_ATTRIBUTES               = 0x8C
	SCSIOP_WRITE_ATTRIBUTES              = 0x8D
	SCSIOP_WRITE_VERIFY16                = 0x8E
	SCSIOP_VERIFY16                      = 0x8F
	SCSIOP_PREFETCH16                    = 0x90
	SCSIOP_SYNCHRONIZE_CACHE16           = 0x91
	SCSIOP_SPACE16                       = 0x91 // tape
	SCSIOP_LOCK_UNLOCK_CACHE16           = 0x92
	SCSIOP_LOCATE16                      = 0x92 // tape
	SCSIOP_WRITE_SAME16                  = 0x93
	SCSIOP_ERASE16                       = 0x93 // tape
	SCSIOP_READ_CAPACITY16               = 0x9E
	SCSIOP_GET_LBA_STATUS                = 0x9E
	SCSIOP_SERVICE_ACTION_IN16           = 0x9E
	SCSIOP_SERVICE_ACTION_OUT16          = 0x9F

	// 32-byte commands
	SCSIOP_OPERATION32 = 0x7F
)
View Source
const (
	// Service Action for 32 bit write commands
	SERVICE_ACTION_XDWRITE      = 0x0004
	SERVICE_ACTION_XPWRITE      = 0x0006
	SERVICE_ACTION_XDWRITEREAD  = 0x0007
	SERVICE_ACTION_WRITE        = 0x000B
	SERVICE_ACTION_WRITE_VERIFY = 0x000C
	SERVICE_ACTION_WRITE_SAME   = 0x000D
	SERVICE_ACTION_ORWRITE      = 0x000E

	// Service actions for 0x48
	SERVICE_ACTION_OVERWRITE    = 0x01
	SERVICE_ACTION_BLOCK_ERASE  = 0x02
	SERVICE_ACTION_CRYPTO_ERASE = 0x03
	SERVICE_ACTION_EXIT_FAILURE = 0x1f

	// Service actions for 0x83
	SERVICE_ACTION_POPULATE_TOKEN    = 0x10
	SERVICE_ACTION_WRITE_USING_TOKEN = 0x11

	// Service actions for 0x84
	SERVICE_ACTION_RECEIVE_TOKEN_INFORMATION = 0x07

	// Service actions for 0x9E
	SERVICE_ACTION_READ_CAPACITY16 = 0x10
	SERVICE_ACTION_GET_LBA_STATUS  = 0x12
)
View Source
const (
	CDB_RETURN_ON_COMPLETION = 0
	CDB_RETURN_IMMEDIATE     = 1
)
View Source
const (
	SCSIOP_DENON_EJECT_DISC   = 0xE6
	SCSIOP_DENON_STOP_AUDIO   = 0xE7
	SCSIOP_DENON_PLAY_AUDIO   = 0xE8
	SCSIOP_DENON_READ_TOC     = 0xE9
	SCSIOP_DENON_READ_SUBCODE = 0xEB
)

Denon CD ROM operation codes

View Source
const (
	SCSIMESS_ABORT                = 0x06
	SCSIMESS_ABORT_WITH_TAG       = 0x0D
	SCSIMESS_BUS_DEVICE_RESET     = 0x0C
	SCSIMESS_CLEAR_QUEUE          = 0x0E
	SCSIMESS_COMMAND_COMPLETE     = 0x00
	SCSIMESS_DISCONNECT           = 0x04
	SCSIMESS_EXTENDED_MESSAGE     = 0x01
	SCSIMESS_IDENTIFY             = 0x80
	SCSIMESS_IDENTIFY_WITH_DISCON = 0xC0
	SCSIMESS_IGNORE_WIDE_RESIDUE  = 0x23
	SCSIMESS_INITIATE_RECOVERY    = 0x0F
	SCSIMESS_INIT_DETECTED_ERROR  = 0x05
	SCSIMESS_LINK_CMD_COMP        = 0x0A
	SCSIMESS_LINK_CMD_COMP_W_FLAG = 0x0B
	SCSIMESS_MESS_PARITY_ERROR    = 0x09
	SCSIMESS_MESSAGE_REJECT       = 0x07
	SCSIMESS_NO_OPERATION         = 0x08
	SCSIMESS_HEAD_OF_QUEUE_TAG    = 0x21
	SCSIMESS_ORDERED_QUEUE_TAG    = 0x22
	SCSIMESS_SIMPLE_QUEUE_TAG     = 0x20
	SCSIMESS_RELEASE_RECOVERY     = 0x10
	SCSIMESS_RESTORE_POINTERS     = 0x03
	SCSIMESS_SAVE_DATA_POINTER    = 0x02
	SCSIMESS_TERMINATE_IO_PROCESS = 0x11
)

SCSI Bus Messages

View Source
const (
	SCSIMESS_MODIFY_DATA_POINTER  = 0x00
	SCSIMESS_SYNCHRONOUS_DATA_REQ = 0x01
	SCSIMESS_WIDE_DATA_REQUEST    = 0x03
)
View Source
const (
	SCSIMESS_MODIFY_DATA_LENGTH = 5
	SCSIMESS_SYNCH_DATA_LENGTH  = 3
	SCSIMESS_WIDE_DATA_LENGTH   = 2
)
View Source
const (
	NO_DEV    = 0xffff
	ATA_DEV   = 0x0000
	ATAPI_DEV = 0x0001
)
View Source
const (
	VALID     = 0xc000
	VALID_VAL = 0x4000
)
View Source
const (
	NOT_ATA             = 0x8000
	NOT_ATAPI           = 0x4000 // (check only if bit 15 == 1)
	MEDIA_REMOVABLE     = 0x0080
	DRIVE_NOT_REMOVABLE = 0x0040 // bit obsoleted in ATA 6
	INCOMPLETE          = 0x0004
	DRQ_RESPONSE_TIME   = 0x0060
	DRQ_3MS_VAL         = 0x0000
	DRQ_INTR_VAL        = 0x0020
	DRQ_50US_VAL        = 0x0040
	PKT_SIZE_SUPPORTED  = 0x0003
	PKT_SIZE_12_VAL     = 0x0000
	PKT_SIZE_16_VAL     = 0x0001
	EQPT_TYPE           = 0x1f00
	SHIFT_EQPT          = 8
)
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 (
	HARD_RESET                  = 0
	SRST                        = 1
	NON_DATA                    = 3
	PIO_DATA_IN                 = 4
	PIO_DATA_OUT                = 5
	DMA                         = 6
	DMA_QUEUED                  = 7
	DEVICE_DIAGNOSTIC           = 8
	DEVICE_RESET                = 9
	UDMA_DATA_IN                = 10
	UDMA_DATA_OUT               = 11
	FPDMA                       = 12
	RETURN_RESPONSE_INFORMATION = 15
)
View Source
const (
	CDB_FORCE_MEDIA_ACCESS = 0x08
)
View Source
const (
	CDROM = 0x0005
)
View Source
const (
	MAX_PARTITIONS = 64
)
View Source
const (
	SG_IO = 0x2285
)

Variables

View Source
var (
	NVME_IOCTL_ID           = IO('N', 0x40)
	NVME_IOCTL_ADMIN_CMD    = IOWR('N', 0x41, unsafe.Sizeof(NvmeAdminCmd{}))
	NVME_IOCTL_SUBMIT_IO    = IOW('N', 0x42, unsafe.Sizeof(UserIo{}))
	NVME_IOCTL_IO_CMD       = IOWR('N', 0x43, unsafe.Sizeof(PassthruCmd{}))
	NVME_IOCTL_RESET        = IO('N', 0x44)
	NVME_IOCTL_SUBSYS_RESET = IO('N', 0x45)
	NVME_RESCAN             = IO('N', 0x46)
	NVME_IOCTL_ADMIN64_CMD  = IOWR('N', 0x47, unsafe.Sizeof(PassthruCmd64{}))
	NVME_IOCTL_IO64_CMD     = IOWR('N', 0x48, unsafe.Sizeof(PassthruCmd64{}))
)

NVMe ioctl values

Functions

func IO

func IO(t, nr uintptr) uintptr

IO generate IO

func IOC

func IOC(dir, t, nr, size uintptr) uintptr

IOC generate IOC

func IOR

func IOR(t, nr, size uintptr) uintptr

IOR generate IOR

func IOW

func IOW(t, nr, size uintptr) uintptr

IOW generate IOW

func IOWR

func IOWR(t, nr, size uintptr) uintptr

IOWR generate IOWR

func NewSystemDriveFactory added in v0.0.2

func NewSystemDriveFactory() common.DriveFactory

func OpenDevice

func OpenDevice(path string) (int, error)

Types

type ATA_PASSTHROUGH12

type ATA_PASSTHROUGH12 struct {
	OperationCode uint8
	B01           uint8
	B02           uint8
	Features      uint8
	SectorCount   uint8
	LbaLow        uint8
	LbaMid        uint8
	LbaHigh       uint8
	Device        uint8
	Command       uint8
	Reserved3     uint8
	Control       uint8
}

func (*ATA_PASSTHROUGH12) GetMultipleCount

func (c *ATA_PASSTHROUGH12) GetMultipleCount() uint8

func (*ATA_PASSTHROUGH12) GetOffline

func (c *ATA_PASSTHROUGH12) GetOffline() uint8

func (*ATA_PASSTHROUGH12) GetProtocol

func (c *ATA_PASSTHROUGH12) GetProtocol() uint8

func (*ATA_PASSTHROUGH12) GetTLength

func (c *ATA_PASSTHROUGH12) GetTLength() uint8

func (*ATA_PASSTHROUGH12) IsByteBlock

func (c *ATA_PASSTHROUGH12) IsByteBlock() bool

func (*ATA_PASSTHROUGH12) IsCkCond

func (c *ATA_PASSTHROUGH12) IsCkCond() bool

func (*ATA_PASSTHROUGH12) IsTDir

func (c *ATA_PASSTHROUGH12) IsTDir() bool

func (*ATA_PASSTHROUGH12) SetByteBlock

func (c *ATA_PASSTHROUGH12) SetByteBlock(v bool)

func (*ATA_PASSTHROUGH12) SetCkCond

func (c *ATA_PASSTHROUGH12) SetCkCond(v bool)

func (*ATA_PASSTHROUGH12) SetMultipleCount

func (c *ATA_PASSTHROUGH12) SetMultipleCount(v uint8)

func (*ATA_PASSTHROUGH12) SetOffline

func (c *ATA_PASSTHROUGH12) SetOffline(v uint8)

func (*ATA_PASSTHROUGH12) SetProtocol

func (c *ATA_PASSTHROUGH12) SetProtocol(v uint8)

func (*ATA_PASSTHROUGH12) SetTDir

func (c *ATA_PASSTHROUGH12) SetTDir(v bool)

func (*ATA_PASSTHROUGH12) SetTLength

func (c *ATA_PASSTHROUGH12) SetTLength(v uint8)

type ATA_PASSTHROUGH16

type ATA_PASSTHROUGH16 struct {
	OperationCode   uint8 // 0x85 - SCSIOP_ATA_PASSTHROUGH16
	B01             uint8
	B02             uint8
	Features15_8    uint8
	Features7_0     uint8
	SectorCount15_8 uint8
	SectorCount7_0  uint8
	LbaLow15_8      uint8
	LbaLow7_0       uint8
	LbaMid15_8      uint8
	LbaMid7_0       uint8
	LbaHigh15_8     uint8
	LbaHigh7_0      uint8
	Device          uint8
	Command         uint8
	Control         uint8
}

func (*ATA_PASSTHROUGH16) GetMultipleCount

func (c *ATA_PASSTHROUGH16) GetMultipleCount() uint8

func (*ATA_PASSTHROUGH16) GetOffline

func (c *ATA_PASSTHROUGH16) GetOffline() uint8

func (*ATA_PASSTHROUGH16) GetProtocol

func (c *ATA_PASSTHROUGH16) GetProtocol() uint8

func (*ATA_PASSTHROUGH16) GetTLength

func (c *ATA_PASSTHROUGH16) GetTLength() uint8

func (*ATA_PASSTHROUGH16) IsByteBlock

func (c *ATA_PASSTHROUGH16) IsByteBlock() bool

func (*ATA_PASSTHROUGH16) IsCkCond

func (c *ATA_PASSTHROUGH16) IsCkCond() bool

func (*ATA_PASSTHROUGH16) IsExtend

func (c *ATA_PASSTHROUGH16) IsExtend() bool

func (*ATA_PASSTHROUGH16) IsTDir

func (c *ATA_PASSTHROUGH16) IsTDir() bool

func (*ATA_PASSTHROUGH16) SetByteBlock

func (c *ATA_PASSTHROUGH16) SetByteBlock(v bool)

func (*ATA_PASSTHROUGH16) SetCkCond

func (c *ATA_PASSTHROUGH16) SetCkCond(v bool)

func (*ATA_PASSTHROUGH16) SetExtend

func (c *ATA_PASSTHROUGH16) SetExtend(v bool)

func (*ATA_PASSTHROUGH16) SetMultipleCount

func (c *ATA_PASSTHROUGH16) SetMultipleCount(v uint8)

func (*ATA_PASSTHROUGH16) SetOffline

func (c *ATA_PASSTHROUGH16) SetOffline(v uint8)

func (*ATA_PASSTHROUGH16) SetProtocol

func (c *ATA_PASSTHROUGH16) SetProtocol(v uint8)

func (*ATA_PASSTHROUGH16) SetTDir

func (c *ATA_PASSTHROUGH16) SetTDir(v bool)

func (*ATA_PASSTHROUGH16) SetTLength

func (c *ATA_PASSTHROUGH16) SetTLength(v uint8)

type CDB10

type CDB10 struct {
	OperationCode     uint8
	B01               uint8
	LogicalBlockByte  [4]uint8
	Reserved2         uint8
	TransferBlocksMsb uint8
	TransferBlocksLsb uint8
	Control           uint8
}

func (*CDB10) GetLogicalUnitNumber

func (c *CDB10) GetLogicalUnitNumber() uint8

func (*CDB10) IsDisablePageOut

func (c *CDB10) IsDisablePageOut() bool

func (*CDB10) IsForceUnitAccess

func (c *CDB10) IsForceUnitAccess() bool

func (*CDB10) IsRelativeAddress

func (c *CDB10) IsRelativeAddress() bool

func (*CDB10) SetDisablePageOut

func (c *CDB10) SetDisablePageOut(v bool)

func (*CDB10) SetForceUnitAccess

func (c *CDB10) SetForceUnitAccess(v bool)

func (*CDB10) SetLogicalUnitNumber

func (c *CDB10) SetLogicalUnitNumber(v uint8)

func (*CDB10) SetRelativeAddress

func (c *CDB10) SetRelativeAddress(v bool)

type CDB16

type CDB16 struct {
	OperationCode  uint8
	B01            uint8
	LogicalBlock   [8]uint8
	TransferLength [4]uint8
	Reserved2      uint8
	Control        uint8
}

func (*CDB16) GetProtection

func (c *CDB16) GetProtection() uint8

func (*CDB16) IsDisablePageOut

func (c *CDB16) IsDisablePageOut() bool

func (*CDB16) IsForceUnitAccess

func (c *CDB16) IsForceUnitAccess() bool

func (*CDB16) SetDisablePageOut

func (c *CDB16) SetDisablePageOut(v bool)

func (*CDB16) SetForceUnitAccess

func (c *CDB16) SetForceUnitAccess(v bool)

func (*CDB16) SetProtection

func (c *CDB16) SetProtection(v uint8)

type EnumVolumeContextImpl

type EnumVolumeContextImpl struct {
	// contains filtered or unexported fields
}

func EnumVolumes

func EnumVolumes(factory common.DriveFactory) (*EnumVolumeContextImpl, error)

func (*EnumVolumeContextImpl) FindVolumesByDrive

func (ctx *EnumVolumeContextImpl) FindVolumesByDrive(driveInfo *common.DriveInfo) []common.VolumeInfo

func (*EnumVolumeContextImpl) GetList

func (ctx *EnumVolumeContextImpl) GetList() []common.VolumeInfo

func (*EnumVolumeContextImpl) OpenDriveByPartition added in v0.0.2

func (ctx *EnumVolumeContextImpl) OpenDriveByPartition(partition common.Partition) (common.DriveHandle, error)

func (*EnumVolumeContextImpl) OpenDriveByVolumePath

func (ctx *EnumVolumeContextImpl) OpenDriveByVolumePath(volumePath string) (common.DriveHandle, error)

type LinuxBasicInfo

type LinuxBasicInfo struct {
	PartitionStyle common.PartitionStyle
	PartitionTable partition.Table
	DiskGeometry   unix.HDGeometry
	MbrSignature   uint32
	GptDiskId      string
}

func ReadBasicInfo

func ReadBasicInfo(fd int, path string) (*LinuxBasicInfo, error)

type LinuxDriveFactory added in v0.0.2

type LinuxDriveFactory struct {
	// contains filtered or unexported fields
}

func NewLinuxDriveFactory added in v0.0.2

func NewLinuxDriveFactory() *LinuxDriveFactory

func (*LinuxDriveFactory) EnumDrives added in v0.0.2

func (f *LinuxDriveFactory) EnumDrives() ([]common.DriveInfo, error)

func (*LinuxDriveFactory) EnumVolumes added in v0.0.2

func (f *LinuxDriveFactory) EnumVolumes() (common.EnumVolumeContext, error)

func (*LinuxDriveFactory) OpenByFd added in v0.0.2

func (f *LinuxDriveFactory) OpenByFd(fd int, path string) (common.DriveHandle, error)

func (*LinuxDriveFactory) OpenByPath added in v0.0.2

func (f *LinuxDriveFactory) OpenByPath(path string) (common.DriveHandle, error)

type LinuxDriver

type LinuxDriver interface {
	OpenByFd(fd int) (common.DriverHandle, error)
}

type LinuxNvmeDriver

type LinuxNvmeDriver struct {
	LinuxDriver
}

func NewLinuxNvmeDriver

func NewLinuxNvmeDriver() *LinuxNvmeDriver

func (*LinuxNvmeDriver) OpenByFd

func (d *LinuxNvmeDriver) OpenByFd(fd int) (common.DriverHandle, error)

type LinuxNvmeDriverHandle

type LinuxNvmeDriverHandle struct {
	common.NvmeDriverHandle
	// contains filtered or unexported fields
}

func (*LinuxNvmeDriverHandle) Close

func (s *LinuxNvmeDriverHandle) Close()

func (*LinuxNvmeDriverHandle) DoNvmeAdminPassthru

func (s *LinuxNvmeDriverHandle) DoNvmeAdminPassthru(cmd *nvme.NvmeAdminCmd) error

func (*LinuxNvmeDriverHandle) DoNvmeIo

func (s *LinuxNvmeDriverHandle) DoNvmeIo(io *nvme.UserIo) error

func (*LinuxNvmeDriverHandle) DoNvmeIoPassthru

func (s *LinuxNvmeDriverHandle) DoNvmeIoPassthru(cmd *nvme.PassthruCmd) error

func (*LinuxNvmeDriverHandle) GetDriverName

func (s *LinuxNvmeDriverHandle) GetDriverName() string

func (*LinuxNvmeDriverHandle) GetDrivingType

func (s *LinuxNvmeDriverHandle) GetDrivingType() common.DrivingType

func (*LinuxNvmeDriverHandle) GetIdentity

func (s *LinuxNvmeDriverHandle) GetIdentity() []byte

func (*LinuxNvmeDriverHandle) NvmeGetLogPage

func (s *LinuxNvmeDriverHandle) NvmeGetLogPage(nsid uint32, logId uint32, rae bool, dataSize int) ([]byte, error)

func (*LinuxNvmeDriverHandle) ReadIdentify

func (s *LinuxNvmeDriverHandle) ReadIdentify(fd int) ([]byte, error)

func (*LinuxNvmeDriverHandle) ReopenWritable

func (s *LinuxNvmeDriverHandle) ReopenWritable() error

func (*LinuxNvmeDriverHandle) SecurityCommand

func (s *LinuxNvmeDriverHandle) SecurityCommand(rw bool, dma bool, protocol uint8, comId uint16, buffer []byte, timeoutSecs int) error

type NvmeAdminCmd

type NvmeAdminCmd PassthruCmd

type NvmeAdminCmdWithBuffer

type NvmeAdminCmdWithBuffer struct {
	Cmd    NvmeAdminCmd
	Buffer [4096]byte
}

type PartitionImpl added in v0.0.2

type PartitionImpl struct {
	// contains filtered or unexported fields
}

func (*PartitionImpl) GetGptInfo added in v0.0.2

func (p *PartitionImpl) GetGptInfo() *common.GptPartitionInfo

func (*PartitionImpl) GetMbrInfo added in v0.0.2

func (p *PartitionImpl) GetMbrInfo() *common.MbrPartitionInfo

func (*PartitionImpl) GetPartitionStyle added in v0.0.2

func (p *PartitionImpl) GetPartitionStyle() common.PartitionStyle

func (*PartitionImpl) GetSize added in v0.0.2

func (p *PartitionImpl) GetSize() uint64

func (*PartitionImpl) GetStart added in v0.0.2

func (p *PartitionImpl) GetStart() uint64

type PassthruCmd

type PassthruCmd struct {
	Opcode      uint8
	Flags       uint8
	Rsvd1       uint16
	Nsid        uint32
	Cdw2        uint32
	Cdw3        uint32
	Metadata    uint64
	Addr        uint64
	MetadataLen uint32
	DataLen     uint32
	Cdw10       uint32
	Cdw11       uint32
	Cdw12       uint32
	Cdw13       uint32
	Cdw14       uint32
	Cdw15       uint32
	TimeoutMs   uint32
	Result      uint32
}

type PassthruCmd64

type PassthruCmd64 struct {
	Opcode      uint8
	Flags       uint8
	Rsvd1       uint16
	Nsid        uint32
	Cdw2        uint32
	Cdw3        uint32
	Metadata    uint64
	Addr        uint64
	MetadataLen uint32
	DataLen     uint32
	Cdw10       uint32
	Cdw11       uint32
	Cdw12       uint32
	Cdw13       uint32
	Cdw14       uint32
	Cdw15       uint32
	TimeoutMs   uint32
	Rsvd2       uint32
	Result      uint64
}

type SCSI_ADDRESS

type SCSI_ADDRESS struct {
	Length     uint32
	PortNumber uint8
	PathId     uint8
	TargetId   uint8
	Lun        uint8
}

type SCSI_SECURITY_PROTOCOL

type SCSI_SECURITY_PROTOCOL struct {
	OperationCode uint8  `struc:"uint8"`
	Protocol      uint8  `struc:"uint8"`
	ProtocolSp    uint16 `struc:"uint16,big"`
	B04           uint8  `struc:"uint8"`
	B05           uint8  `struc:"uint8"`
	Length        uint32 `struc:"uint32,big"`
	B10           uint8  `struc:"uint8"`
	Control       uint8  `struc:"uint8"`
}

func (*SCSI_SECURITY_PROTOCOL) IsInc512

func (p *SCSI_SECURITY_PROTOCOL) IsInc512() bool

func (*SCSI_SECURITY_PROTOCOL) SetInc512

func (p *SCSI_SECURITY_PROTOCOL) SetInc512(v bool)

type SG_IO_HDR

type SG_IO_HDR struct {
	InterfaceID    int32   `struc: "int32"`   /* [i] 'S' for SCSI generic (required) */
	DxferDirection int32   `struc: "int32"`   /* [i] data transfer direction  */
	CmdLen         uint8   `struc: "uint8"`   /* [i] SCSI command length (<=16 bytes) */
	MxSbLen        uint8   `struc: "uint8"`   /* [i] max length to write to/from (<=65535) */
	IovecCount     uint16  `struc: "uint16"`  /* [i] 0 implies no scatter gather */
	DxferLen       uint32  `struc: "uint32"`  /* [i] byte count of data transfer */
	Dxferp         uintptr `struc: "uintptr"` /* [i], [*io] points to data transfer memory or scatter gather list */
	Cmdp           *byte   `struc: "*byte"`   /* [i], [*i] points to SCSI command to perform */
	Sbp            *byte   `struc: "*byte"`   /* [i], [*o] points to sense buffer memory */
	Timeout        uint32  `struc: "uint32"`  /* [i] MAX_UINT->no timeout (unit: millisec) */
	Flags          uint32  `struc: "uint32"`  /* [i] 0 -> default, see SG_FLAG... */
	PackID         int32   `struc: "int32"`   /* [i->o] unused internally (normally) */
	UsrPtr         uintptr `struc: "uintptr"` /* [i->o] unused internally */
	Status         uint8   `struc: "uint8"`   /* [o] scsi status */
	MaskedStatus   uint8   `struc: "uint8"`   /* [o] shifted, masked scsi status */
	MsgStatus      uint8   `struc: "uint8"`   /* [o] messaging level data (optional) */
	SbLenWr        uint8   `struc: "uint8"`   /* [o] byte count actually written to sbp */
	HostStatus     uint16  `struc: "uint32"`  /* [o] errors from host adapter */
	DriverStatus   uint16  `struc: "uint16"`  /* [o] errors from software driver */
	Resid          int32   `struc: "int32"`   /* [o] dxfer_len - actual_transferred */
	Duration       uint32  `struc: "uint32"`  /* [o] time taken (unit: millisec) */
	Info           uint32  `struc: "uint32"`  /* [o] auxiliary information */
}

type SG_IO_HDR_WITH_SENSE_BUF

type SG_IO_HDR_WITH_SENSE_BUF struct {
	SG_IO_HDR
	Filter    uint32 // realign buffers to double word boundary
	SenseData [32]byte
}

type SamsungNvmeDriver

type SamsungNvmeDriver struct {
	LinuxDriver
}

func NewSamsungNvmeDriver

func NewSamsungNvmeDriver() *SamsungNvmeDriver

func (*SamsungNvmeDriver) OpenByHandle

func (d *SamsungNvmeDriver) OpenByHandle(handle int) (common.DriveHandle, error)

type SgDriver

type SgDriver struct {
	LinuxDriver
}

func NewSgDriver

func NewSgDriver() *SgDriver

func (*SgDriver) OpenByFd

func (d *SgDriver) OpenByFd(fd int) (common.DriverHandle, error)

type SgDriverHandle

type SgDriverHandle struct {
	common.AtaDriverHandle
	// contains filtered or unexported fields
}

func (*SgDriverHandle) Close

func (s *SgDriverHandle) Close()

func (*SgDriverHandle) DoTaskFileCmd

func (s *SgDriverHandle) DoTaskFileCmd(rw bool, dma bool, tf *ata.Tf, data []byte, timeoutSecs int) error

func (*SgDriverHandle) GetDriverName

func (s *SgDriverHandle) GetDriverName() string

func (*SgDriverHandle) GetDrivingType

func (s *SgDriverHandle) GetDrivingType() common.DrivingType

func (*SgDriverHandle) GetIdentity

func (s *SgDriverHandle) GetIdentity() []byte

func (*SgDriverHandle) ReopenWritable

func (s *SgDriverHandle) ReopenWritable() error

func (*SgDriverHandle) SecurityCommand

func (s *SgDriverHandle) SecurityCommand(rw bool, dma bool, protocol uint8, comId uint16, buffer []byte, timeoutSecs int) error

type UserIo

type UserIo struct {
	Opcode   uint8
	Flags    uint8
	Control  uint16
	Nblocks  uint16
	Rsvd     uint16
	Metadata uint64
	Addr     uint64
	Slba     uint64
	Dsmgmt   uint32
	Reftag   uint32
	Apptag   uint16
	Appmask  uint16
}

type VolumeInfoImpl

type VolumeInfoImpl struct {
	Path        string
	Filesystem  string
	MountPoints []string
	Partition   *PartitionImpl
}

func (*VolumeInfoImpl) ToVolumeInfo

func (item *VolumeInfoImpl) ToVolumeInfo() common.VolumeInfo

Jump to

Keyboard shortcuts

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