Documentation
¶
Index ¶
- Constants
- type API
- type AdditionalParameters
- type DeviceType
- type Disk
- type DiskAPI
- func (imp DiskAPI) BasicPartitionsExist(diskNumber uint32) (bool, error)
- func (imp DiskAPI) CreateBasicPartition(diskNumber uint32) error
- func (imp DiskAPI) GetDiskNumber(disk syscall.Handle) (uint32, error)
- func (imp DiskAPI) GetDiskNumberAndPage83ID(path string) (uint32, string, error)
- func (imp DiskAPI) GetDiskNumberByName(page83ID string) (uint32, error)
- func (imp DiskAPI) GetDiskNumberWithID(page83ID string) (uint32, error)
- func (imp DiskAPI) GetDiskPage83ID(disk syscall.Handle) (string, error)
- func (imp DiskAPI) GetDiskState(diskNumber uint32) (bool, error)
- func (imp DiskAPI) GetDiskStats(diskNumber uint32) (int64, error)
- func (imp DiskAPI) InitializeDisk(diskNumber uint32) error
- func (imp DiskAPI) IsDiskInitialized(diskNumber uint32) (bool, error)
- func (imp DiskAPI) ListDiskIDs() (map[uint32]shared.DiskIDs, error)
- func (imp DiskAPI) ListDiskLocations() (map[uint32]shared.DiskLocation, error)
- func (imp DiskAPI) Rescan() error
- func (imp DiskAPI) SetDiskState(diskNumber uint32, isOnline bool) error
- type StorageAssociationType
- type StorageDeviceIDDescriptor
- type StorageDeviceNumber
- type StorageIdentifier
- type StorageIdentifierCodeSet
- type StorageIdentifierType
- type StoragePropertyID
- type StoragePropertyQuery
- type StorageQueryType
Constants ¶
const ( IOCTL_STORAGE_GET_DEVICE_NUMBER = 0x2D1080 IOCTL_STORAGE_QUERY_PROPERTY = 0x002d1400 )
const ( StorageDeviceProperty StoragePropertyID = 0 StorageAdapterProperty = 1 StorageDeviceIDProperty = 2 StorageDeviceUniqueIDProperty = 3 StorageDeviceWriteCacheProperty = 4 StorageMiniportProperty = 5 StorageAccessAlignmentProperty = 6 StorageDeviceSeekPenaltyProperty = 7 StorageDeviceTrimProperty = 8 StorageDeviceWriteAggregationProperty = 9 StorageDeviceDeviceTelemetryProperty = 10 StorageDeviceLBProvisioningProperty = 11 StorageDevicePowerProperty = 12 StorageDeviceCopyOffloadProperty = 13 StorageDeviceResiliencyProperty = 14 StorageDeviceMediumProductType = 15 StorageAdapterRpmbProperty = 16 StorageAdapterCryptoProperty = 17 StorageDeviceIoCapabilityProperty = 18 StorageAdapterProtocolSpecificProperty = 19 StorageDeviceProtocolSpecificProperty = 20 StorageAdapterTemperatureProperty = 21 StorageDeviceTemperatureProperty = 22 StorageAdapterPhysicalTopologyProperty = 23 StorageDevicePhysicalTopologyProperty = 24 StorageDeviceAttributesProperty = 25 StorageDeviceManagementStatus = 26 StorageAdapterSerialNumberProperty = 27 StorageDeviceLocationProperty = 28 StorageDeviceNumaProperty = 29 StorageDeviceZonedDeviceProperty = 30 StorageDeviceUnsafeShutdownCount = 31 StorageDeviceEnduranceProperty = 32 )
const ( StorageIDCodeSetReserved StorageIdentifierCodeSet = 0 StorageIDCodeSetBinary = 1 StorageIDCodeSetASCII = 2 StorageIDCodeSetUtf8 = 3 )
const ( StorageIdTypeVendorSpecific StorageIdentifierType = 0 StorageIDTypeVendorID = 1 StorageIDTypeEUI64 = 2 StorageIDTypeFCPHName = 3 StorageIDTypePortRelative = 4 StorageIDTypeTargetPortGroup = 5 StorageIDTypeLogicalUnitGroup = 6 StorageIDTypeMD5LogicalUnitIdentifier = 7 StorageIDTypeScsiNameString = 8 )
const ( StorageIDAssocDevice StorageAssociationType = 0 StorageIDAssocPort = 1 StorageIDAssocTarget = 2 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface {
// ListDiskLocations - constructs a map with the disk number as the key and the DiskLocation structure
// as the value. The DiskLocation struct has various fields like the Adapter, Bus, Target and LUNID.
ListDiskLocations() (map[uint32]shared.DiskLocation, error)
// IsDiskInitialized returns true if the disk identified by `diskNumber` is initialized.
IsDiskInitialized(diskNumber uint32) (bool, error)
// InitializeDisk initializes the disk `diskNumber`
InitializeDisk(diskNumber uint32) error
// BasicPartitionsExist checks if the disk `diskNumber` has any basic partitions.
BasicPartitionsExist(diskNumber uint32) (bool, error)
// CreateBasicPartition creates a partition in disk `diskNumber`
CreateBasicPartition(diskNumber uint32) error
// Rescan updates the host storage cache (re-enumerates disk, partition and volume objects)
Rescan() error
// GetDiskNumberByName gets a disk number by page83 ID (disk name)
GetDiskNumberByName(page83ID string) (uint32, error)
// ListDiskIDs list all disks by disk number.
ListDiskIDs() (map[uint32]shared.DiskIDs, error)
// GetDiskStats gets the disk stats of the disk `diskNumber`.
GetDiskStats(diskNumber uint32) (int64, error)
// SetDiskState sets the offline/online state of the disk `diskNumber`.
SetDiskState(diskNumber uint32, isOnline bool) error
// GetDiskState gets the offline/online state of the disk `diskNumber`.
GetDiskState(diskNumber uint32) (bool, error)
}
API declares the interface exposed by the internal API
type AdditionalParameters ¶
type AdditionalParameters byte
type DeviceType ¶
type DeviceType uint32
type DiskAPI ¶
type DiskAPI struct{}
DiskAPI implements the OS API calls related to Disk Devices. All code here should be very simple pass-through to the OS APIs or cmdlets. Any logic around the APIs/cmdlet invocation should go in internal/server/filesystem/disk.go so that logic can be easily unit-tested without requiring specific OS environments.
func (DiskAPI) BasicPartitionsExist ¶
func (DiskAPI) CreateBasicPartition ¶
func (DiskAPI) GetDiskNumber ¶
func (DiskAPI) GetDiskNumberAndPage83ID ¶
func (DiskAPI) GetDiskNumberByName ¶
func (DiskAPI) GetDiskNumberWithID ¶
func (DiskAPI) GetDiskPage83ID ¶
func (DiskAPI) InitializeDisk ¶
func (DiskAPI) IsDiskInitialized ¶
func (DiskAPI) ListDiskIDs ¶
ListDiskIDs - constructs a map with the disk number as the key and the DiskID structure as the value. The DiskID struct has a field for the page83 ID.
func (DiskAPI) ListDiskLocations ¶
func (imp DiskAPI) ListDiskLocations() (map[uint32]shared.DiskLocation, error)
ListDiskLocations - constructs a map with the disk number as the key and the DiskLocation structure as the value. The DiskLocation struct has various fields like the Adapter, Bus, Target and LUNID.
type StorageAssociationType ¶
type StorageAssociationType uint32
type StorageDeviceNumber ¶
type StorageDeviceNumber struct {
DeviceType DeviceType
DeviceNumber uint32
PartitionNumber uint32
}
type StorageIdentifier ¶
type StorageIdentifier struct {
CodeSet StorageIdentifierCodeSet
Type StorageIdentifierType
IdentifierSize uint16
NextOffset uint16
Association StorageAssociationType
Identifier [1]byte
}
type StorageIdentifierCodeSet ¶
type StorageIdentifierCodeSet uint32
type StorageIdentifierType ¶
type StorageIdentifierType uint32
type StoragePropertyID ¶
type StoragePropertyID uint32
type StoragePropertyQuery ¶
type StoragePropertyQuery struct {
PropertyID StoragePropertyID
QueryType StorageQueryType
Byte []AdditionalParameters
}
type StorageQueryType ¶
type StorageQueryType uint32
const ( PropertyStandardQuery StorageQueryType = iota PropertyExistsQuery PropertyMaskQuery PropertyQueryMaxDefined )