Help us shape the future of Go! Take the 2026 Go Developer Survey

udev

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: Apache-2.0 Imports: 12 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
	// mount point if any
	MountPoints []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) CreateFileSystem added in v1.6.0

func (di *Disk) CreateFileSystem() error

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

func (*Disk) Mount added in v1.6.0

func (disk *Disk) Mount(path string) error

func (*Disk) Resize added in v1.7.0

func (disk *Disk) Resize(size int64) error

func (*Disk) Unmount added in v1.6.0

func (disk *Disk) Unmount() error

Jump to

Keyboard shortcuts

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