sysfs

package
v0.0.0-...-5fb8a3f Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Implementation included in this file was written with the aim of easing integration with the interface exposed at /sys/class/block. It assumes sysfs is already mounted at /sys.

Index

Constants

This section is empty.

Variables

View Source
var ErrDevNotFound = errors.New("device not found")

Functions

func DeviceByPartUUID

func DeviceByPartUUID(id uuid.UUID) (string, error)

DeviceByPartUUID returns a block device name, given its corresponding partition UUID.

func ParentBlockDevice

func ParentBlockDevice(dev string) (string, error)

ParentBlockDevice transforms the block device name of a partition, eg "sda1", to the name of the block device hosting it, eg "sda".

func PartUUIDMap

func PartUUIDMap() (map[string]string, error)

PartUUIDMap returns a mapping between partition UUIDs and block device names based on information exposed by uevent. UUID keys of the returned map are represented as lowercase strings.

func PartitionBlockDevice

func PartitionBlockDevice(dev string, index int) (string, error)

PartitionBlockDevice returns the name of a block device associated with the partition at index in the containing block device dev, eg "nvme0n1pN" for "nvme0n1" or "sdaN" for "sda".

func ReadUevents

func ReadUevents(filename string) (map[string]string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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