udev

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: Apache-2.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenRuleForBlock

func GenRuleForBlock() netlink.Matcher

GenRuleForBlock

func ListAllBlockDevices added in v0.12.3

func ListAllBlockDevices() ([]manager.Attribute, error)

ListAllBlockDevices list all block devices by udev

Types

type Device

type Device struct {
	// DevPath represents the disk hardware path.
	// The general format is like /sys/devices/pci0000:ae/0000:ae:02.0/0000:b1:00.0/host2/target2:1:0/2:1:0:0/block/sdc/sdc
	DevPath string `json:"devPath,omitempty"`

	// DevName the general format is /dev/sda
	DevName string `json:"devName,omitempty"`

	// DevType such as disk, partition
	DevType string `json:"devType,omitempty"`

	// Major represents drive used by the device
	Major string `json:"major,omitempty"`

	// Minor is used to distinguish different devices
	Minor string `json:"minor,omitempty"`

	// SubSystem identifies the device's system type, such as block
	SubSystem string `json:"subSystem,omitempty"`

	// Bus represents the bus type of the device, such as USB, SATA
	Bus string `json:"id_bus,omitempty"`

	// FSType represents the filesystem type such as ext4, ntfs
	FSType string `json:"id_fs_type,omitempty"`

	// Model represents the specific model of the storage device, usually specified by the manufacturer
	Model string `json:"id_model,omitempty"`

	// WWN represents the World Wide Name(WWN) of the device.
	// The general format is like 5001b444a89e5acd.
	WWN string `json:"id_wwn,omitempty"`

	// PartTableType represents the partition table type, such as gpt or mbr
	PartTableType string `json:"id_part_table_type,omitempty"`

	// Serial represents the Serial Number(SN) of the device.
	// The general format is like 162061400553
	Serial string `json:"id_serial,omitempty"`

	// Vendor represents the manufacturer of the device
	Vendor string `json:"id_vendor,omitempty"`

	// IDType specifies the detailed type of the device according to udev rules, such as 'cd', 'disk', or 'partition',
	// providing a finer classification than DevType, usually the values of IDType and DevType are the same
	IDType string `json:"id_type"`

	// PartName such as EFI System Partition
	PartName string `json:"partName"`

	// Name is the name of the device node sda, sdb, dm-0 etc
	Name string `json:"name"`

	// DevLinks is a symbolic link array for the device, containing all symbolic links for the device
	DevLinks []string `json:"devLinks"`
}

func NewDevice

func NewDevice(devPath string) *Device

func NewDeviceWithName

func NewDeviceWithName(devPath, devName string) *Device

func (*Device) FilterDisk added in v0.12.3

func (d *Device) FilterDisk() bool

FilterDisk filter out disks that are virtual or can't identify themselves

func (*Device) Info

func (d *Device) Info() (map[string]interface{}, error)

Info gets detailed information about the device using udevadm

func (*Device) ParseDeviceInfo

func (d *Device) ParseDeviceInfo() error

func (*Device) ParseDiskAttribute added in v0.13.1

func (d *Device) ParseDiskAttribute(info map[string]interface{}) error

type DiskManager

type DiskManager struct {
}

DiskManager monitor disk by udev

func NewDiskManager

func NewDiskManager() DiskManager

func (DiskManager) ListExist

func (dm DiskManager) ListExist() []manager.Event

ListExist

func (DiskManager) Monitor

func (dm DiskManager) Monitor(c chan manager.Event)

Monitor

func (DiskManager) StartTimerTrigger added in v0.8.0

func (dm DiskManager) StartTimerTrigger(c chan manager.Event)

StartTimerTrigger trigger disk event

Jump to

Keyboard shortcuts

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