Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoDevicePath = errors.New("cannot map device to a device path")
ErrNoDevicePath is returned from NewFileDevicePath if the device in which a file is stored cannot be mapped to a device path with the specified mode.
Functions ¶
func NewFileDevicePath ¶
func NewFileDevicePath(path string, mode FileDevicePathMode) (out efi.DevicePath, err error)
NewFileDevicePath creates an EFI device path from the supplied filepath.
If mode is FullPath, this will attempt to create a full device path which requires the use of sysfs. If the device in which the file is stored cannot be mapped to a device path, a ErrNoDevicePath error is returned. This could be because the device is not recognized by this package, or because the device genuinely cannot be mapped to a device path (eg, it is a device-mapper or loop device). In this case, one of the ShortForm modes can be used.
If mode is ShortFormPathHD, this will attempt to create a short-form device path beginning with a HD() component. If the file is stored inside an unpartitioned device, a ErrNoDevicePath error will be returned. In this case, ShortFormPathFile can be used.
When mode is ShortFormPathHD or FullPath and the file is stored inside a partitoned device, read access is required on the underlying block device in order to decode the partition table.
If mode is ShortFormPathFile, this will attempt to create a short-form device path consisting only of the file path relative to the device.
In all modes, read access to the file's directory is required.
func NewHardDriveDevicePathNodeFromDevice ¶
func NewHardDriveDevicePathNodeFromDevice(dev string, part int) (*efi.HardDriveDevicePathNode, error)
NewHardDriveDevicePathNodeFromDevice constructs a HardDriveDevicePathNode for the specified partition on the device or file at the supplied path.
Types ¶
type FileDevicePathMode ¶
type FileDevicePathMode int
FileDevicePathMode specifies the mode for NewFileDevicePath
const ( // FullPath indicates that only a full device path should be created. FullPath FileDevicePathMode = iota // ShortFormPathHD indicates that a short-form device path beginning // with a HD() node should be created. ShortFormPathHD // ShortFormPathFile indicates that a short-form device path consisting // of only the file path relative to the device should be created. ShortFormPathFile )