probe

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package probe provides functions for probing block devices for things such as filesystems, and partions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DevForPartitionLabel

func DevForPartitionLabel(devname, label string) (*blockdevice.BlockDevice, error)

DevForPartitionLabel finds and opens partition as a blockdevice.

func GetPartitionWithName

func GetPartitionWithName(name string) (*gpt.Partition, error)

GetPartitionWithName probes all known block device's partition table for a parition with the specified name.

Types

type ProbedBlockDevice

type ProbedBlockDevice struct {
	*blockdevice.BlockDevice

	SuperBlock filesystem.SuperBlocker
	Path       string
}

ProbedBlockDevice represents a probed block device.

func All

func All(options ...SelectOption) ([]*ProbedBlockDevice, error)

All probes a block device's file system for the given label.

func GetDevWithFileSystemLabel

func GetDevWithFileSystemLabel(value string) (*ProbedBlockDevice, error)

GetDevWithFileSystemLabel probes all known block device's file systems for the given label.

func GetDevWithPartitionName

func GetDevWithPartitionName(name string) (*ProbedBlockDevice, error)

GetDevWithPartitionName probes all known block device's partition table for a parition with the specified name.

type SelectOption

type SelectOption func(device *ProbedBlockDevice) (bool, error)

SelectOption is a callback matcher for All block devices probes.

func WithFileSystemLabel

func WithFileSystemLabel(label string) SelectOption

WithFileSystemLabel searches for a block device which has filesystem labeled with the provided label.

func WithPartitionLabel

func WithPartitionLabel(label string) SelectOption

WithPartitionLabel search for a block device which has partitions with some specific label.

func WithSingleResult

func WithSingleResult() SelectOption

WithSingleResult enforces a single result from All function.

Jump to

Keyboard shortcuts

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