udev

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UdevEventAdd    = "add"
	UdevEventRemove = "remove"
)

UDEV events available in the system

Variables

This section is empty.

Functions

func TriggerEvent

func TriggerEvent(event, syspath, devicePath string) error

TriggerEvent triggers a udev event for the device with syspath. The event is generated by writing the event action into syspath/devicename/uevent file. This write will cause UDEV to trigger the corresponding event. It is same as using `udevadm trigger`

Types

type Disk

type Disk struct {
	// Size in bytes
	Size int64

	// the disk name
	// eg: /dev/loop9002
	Name string
	// contains filtered or unexported fields
}

Disk has the attributes of a virtual disk which is emulated for integration testing.

func NewDisk

func NewDisk(size int64) Disk

NewDisk creates a Disk struct, with a specified size. Also the random disk image name is generated. The actual image is generated only when we try to attach the disk

func (*Disk) AttachDisk

func (disk *Disk) AttachDisk() error

AttachDisk triggers a udev add event for the disk. If the disk is not present, the loop device is created and event is triggered

func (*Disk) DetachAndDeleteDisk

func (disk *Disk) DetachAndDeleteDisk() error

DetachAndDeleteDisk triggers a udev remove event. It detaches the loop device from the backing image. Also deletes the backing image and block device file in /dev

func (*Disk) DetachDisk

func (disk *Disk) DetachDisk() error

DetachDisk triggers a udev remove event for the disk

Jump to

Keyboard shortcuts

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