common

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AtaDriverHandle

type AtaDriverHandle interface {
	DriverHandle
	GetIdentity() []byte
	DoTaskFileCmd(rw bool, dma bool, tf *ata.Tf, data []byte, timeoutSecs int) error
}

type DparmError

type DparmError struct {
	Message      string
	DriverStatus byte
	SenseData    *scsi.SENSE_DATA
	// contains filtered or unexported fields
}

func (DparmError) Error

func (e DparmError) Error() string

type DriveFactory

type DriveFactory interface {
	OpenByPath(path string) (DriveHandle, error)
	EnumDrives() ([]DriveInfo, error)
	EnumVolumes() (EnumVolumeContext, error)
}

type DriveHandle

type DriveHandle interface {
	GetDriverHandle() DriverHandle
	Close()
	GetDevicePath() string
	GetDrivingType() DrivingType
	GetDriverName() string

	GetDriveInfo() *DriveInfo

	// ATA
	AtaDoTaskFileCmd(rw bool, dma bool, tf *ata.Tf, data []byte, timeoutSecs int) error

	// NVME
	NvmeGetLogPage(nsid uint32, logId uint32, rae bool, size int) ([]byte, error)

	// COMMON
	SecurityCommand(rw bool, dma bool, protocol uint8, comId uint16, buffer []byte, timeoutSecs int) error

	TcgDiscovery0() error
}

type DriveInfo

type DriveInfo struct {
	DevicePath  string
	DrivingType DrivingType
	DriverName  string

	PartitionStyle   PartitionStyle
	GptDiskId        string // uuid format
	MbrDiskSignature uint32

	Model            string
	Serial           string
	FirmwareRevision string
	RawSerial        [20]byte

	VendorId        string
	ProductRevision string

	WindowsDevNum   int
	SmartEnabled    bool
	AtaIdentity     *ata.IdentityDeviceData
	AtaIdentityRaw  []byte
	NvmeIdentity    *nvme.IdentifyController
	NvmeIdentityRaw []byte

	IsSsd          bool
	SsdCheckWeight int
	TotalCapacity  int64

	TcgSupport           int
	TcgTper              bool
	TcgLocking           bool
	TcgGeometryReporting bool
	TcgOpalSscV100       bool
	TcgOpalSscV200       bool
	TcgEnterprise        bool
	TcgSingleUser        bool
	TcgDataStore         bool

	TcgRawFeatures map[uint16][]byte
}

type DriverHandle

type DriverHandle interface {
	GetDriverName() string
	GetDrivingType() DrivingType
	ReopenWritable() error
	Close()

	SecurityCommand(rw bool, dma bool, protocol uint8, comId uint16, buffer []byte, timeoutSecs int) error
}

type DrivingType

type DrivingType int
const (
	DrivingUnknown DrivingType = 0 + iota
	DrivingAtapi
	DrivingNvme
)

type EnumVolumeContext

type EnumVolumeContext interface {
	GetList() []VolumeInfo
	FindVolumesByDrive(driveInfo *DriveInfo) []VolumeInfo
	OpenDriveByVolumePath(volumePath string) (DriveHandle, error)
}

type NvmeDriverHandle

type NvmeDriverHandle interface {
	DriverHandle
	GetIdentity() []byte
	DoNvmeAdminPassthru(cmd *nvme.NvmeAdminCmd) error
	NvmeGetLogPage(nsid uint32, logId uint32, rae bool, size int) ([]byte, error)
}

type PartitionStyle

type PartitionStyle int
const (
	PartitionStyleRaw PartitionStyle = 0 + iota
	PartitionStyleMbr
	PartitionStyleGpt
)

type VolumeInfo

type VolumeInfo struct {
	Path        string
	Filesystem  string
	MountPoints []string
}

type WindowsPhysicalDrive

type WindowsPhysicalDrive struct {
	DeviceIndex        int
	PhysicalDiskPath   string
	SetupApiDevicePath string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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