Documentation ¶
Index ¶
- Constants
- type Device
- func (s Device) GetCapacityInBytes() (int64, error)
- func (s Device) GetDependents() (blockdevice.DependentBlockDevices, error)
- func (s Device) GetDeviceType(devType string) (string, error)
- func (s Device) GetDriveType() (string, error)
- func (s Device) GetHardwareSectorSize() (int64, error)
- func (s Device) GetLogicalBlockSize() (int64, error)
- func (s Device) GetPhysicalBlockSize() (int64, error)
Constants ¶
const ( // BlockSubSystem is the key used to represent block subsystem in sysfs BlockSubSystem = "block" // NVMeSubSystem is the key used to represent nvme subsystem in sysfs NVMeSubSystem = "nvme" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
Device represents a blockdevice using its sysfs path.
func NewSysFsDeviceFromDevPath ¶
NewSysFsDeviceFromDevPath is used to get sysfs device struct from the device devpath The sysfs device struct contains the device name along with the syspath
func (Device) GetCapacityInBytes ¶
GetCapacityInBytes gets the capacity of the device in bytes
func (Device) GetDependents ¶
func (s Device) GetDependents() (blockdevice.DependentBlockDevices, error)
GetDependents gets all the dependent devices for a given Device
func (Device) GetDeviceType ¶
GetDeviceType gets the device type, as shown in lsblk devtype should be prefilled by udev probe (DEVTYPE) as disk/part for this to work
Ported from https://github.com/karelzak/util-linux/blob/master/misc-utils/lsblk.c
func (Device) GetDriveType ¶
GetDriveType gets the drive type of the device based on the rotational value. Can be HDD or SSD
func (Device) GetHardwareSectorSize ¶
GetHardwareSectorSize gets the hardware sector size of the device
func (Device) GetLogicalBlockSize ¶
GetLogicalBlockSize gets the logical block size, the caller should handle if 0 LB size is returned
func (Device) GetPhysicalBlockSize ¶
GetPhysicalBlockSize gets the physical block size of the device