udev

package
v0.7.7 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UdevSystem is used to filter devices other than disk which udev tracks (eg. CD ROM)
	UdevSystem = "disk"
	// UDevPartition is used to filter out partitions
	UdevPartition = "partition"
	// LinkNameIndex is used to get link index from dev link
	LinkNameIndex = 2

	UdevDevname       = "DEVNAME"
	UdevDevtype       = "DEVTYPE"
	UdevFsUUID        = "ID_FS_UUID"
	UdevIDPath        = "ID_PATH"
	UdevModel         = "ID_MODEL"
	UdevPartEntryType = "ID_PART_ENTRY_TYPE"
	UdevPartEntryUUID = "ID_PART_ENTRY_UUID"
	UdevPartTableType = "ID_PART_TABLE_TYPE"
	UdevPartTableUUID = "ID_PART_TABLE_UUID"
	UdevSerialNumber  = "ID_SERIAL"
	UdevSerialShort   = "ID_SERIAL_SHORT"
	UdevType          = "ID_TYPE"
	UdevVendor        = "ID_VENDOR"
	UdevWWN           = "ID_WWN"
)

key and env of udev uevent.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device map[string]string

func InitUdevDevice

func InitUdevDevice(udev map[string]string) Device

func (Device) GetDevName

func (device Device) GetDevName() string

GetDevName returns the path of device in /dev directory

func (Device) GetDevType

func (device Device) GetDevType() string

func (Device) GetIDPath

func (device Device) GetIDPath() string

GetIDPath returns the device id path

func (Device) GetIDType

func (device Device) GetIDType() string

func (Device) GetShortName

func (device Device) GetShortName() string

GetShortName returns the short device name of the /dev directory, e.g /dev/sda will return the name sda

func (Device) IsDisk

func (device Device) IsDisk() bool

IsDisk check if device is a disk

func (Device) IsPartition

func (device Device) IsPartition() bool

IsPartition check if device is a partition

func (Device) UpdateDiskFromUdev added in v0.6.4

func (device Device) UpdateDiskFromUdev(disk *block.Disk)

type Udev

type Udev struct {
	// contains filtered or unexported fields
}

func NewUdev

func NewUdev(opt *option.Option, scanner *blockdevice.Scanner) *Udev

func (*Udev) ActionHandler

func (u *Udev) ActionHandler(uevent netlink.UEvent)

func (*Udev) Monitor

func (u *Udev) Monitor(ctx context.Context)

Jump to

Keyboard shortcuts

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