block

package
v3.0.0-alpha.20251212 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPartitionDeviceByLabel

func GetPartitionDeviceByLabel(s *sys.System, b Device, label string, attempts int) (string, error)

GetPartitionDeviceByLabel will try to return the device that matches the given label. attempts value sets the number of attempts to find the device, it waits a second between attempts.

Types

type Device

type Device interface {
	GetAllPartitions() (PartitionList, error)
	GetDevicePartitions(device string) (PartitionList, error)
	GetDeviceSectorSize(device string) (uint, error)
	GetPartitionFS(partition string) (string, error)
}

type Partition

type Partition struct {
	Name        string
	Label       string
	Size        uint
	FileSystem  string
	UUID        string
	Flags       []string
	MountPoints []string
	Path        string
	Disk        string
}

Partition struct represents a partition with its commonly configurable values, size in MiB

func GetPartitionByLabel

func GetPartitionByLabel(s *sys.System, b Device, label string, attempts int) (*Partition, error)

GetPartitionByLabel tries to return the partition that matches the given label. attempts value sets the number of attempts to find the device, it waits a second between attempts.

func GetPartitionByMountPoint

func GetPartitionByMountPoint(s *sys.System, b Device, mountpoint string, attempts int) (*Partition, error)

GetPartitionByMountPoint tries to return the partition that is mounted in the given mount point. attempts value sets the number of attempts to find the device, it waits a second between attempts.

func GetPartitionByUUID

func GetPartitionByUUID(s *sys.System, b Device, uuid string, attempts int) (*Partition, error)

GetPartitionByUUID tries to return the partition that matches the given filesystem UUID. attempts value sets the number of attempts to find the device, it waits a second between attempts.

type PartitionList

type PartitionList []*Partition

func (PartitionList) GetByLabel

func (pl PartitionList) GetByLabel(label string) *Partition

GetByLabel gets a partition by its label from the PartitionList

func (PartitionList) GetByMountPoint

func (pl PartitionList) GetByMountPoint(mountpoint string) *Partition

GetByMountPoint gets a partition by its mountpoint from the PartitionList.

func (PartitionList) GetByName

func (pl PartitionList) GetByName(name string) *Partition

GetByName gets a partitions by its name from the PartitionList

func (PartitionList) GetByUUID

func (pl PartitionList) GetByUUID(uuid string) *Partition

GetByUUID gets a partition by its filesystem UUID from the PartitionList

func (PartitionList) GetByUUIDNameOrLabel

func (pl PartitionList) GetByUUIDNameOrLabel(uuid, name, label string) *Partition

GetByNameOrLabel gets a partition by its uuid, name or label. It tries by uuid first and label as the option.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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