loopdev

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// https://github.com/util-linux/util-linux/blob/master/include/loopdev.h#L46
	LOOP_SET_FD       = 0x4C00
	LOOP_CLR_FD       = 0x4C01
	LOOP_SET_STATUS64 = 0x4C04
	LOOP_CTL_ADD      = 0x4C80
	LOOP_CTL_REMOVE   = 0x4C81
	LOOP_CTL_GET_FREE = 0x4C82
)

Variables

View Source
var (
	LOOP_DEVICE_PREFIX = env.Get("LOOP_DEVICE_PREFIX", "/dev/loop")
	LOOP_CONROL_PREFIX = LOOP_DEVICE_PREFIX + "-control"
)

Functions

This section is empty.

Types

type Config

type Config struct {
	No   int
	Path string
	Info *LoopInfo64
}

func FindFreeLoopDevice

func FindFreeLoopDevice() (Config, error)

find free loop device

func (Config) Attach

func (lc Config) Attach(imagePath string) error

func (Config) Detach

func (lc Config) Detach() error

type LoopInfo64

type LoopInfo64 struct {
	Device         uint64
	Inode          uint64
	RDeviceNumber  uint64
	Offset         uint64
	SizeLimit      uint64
	Number         uint32
	EncryptType    uint32
	EncryptKeySize uint32
	Flags          uint32
	FileName       [64]byte
	CryptName      [64]byte
	EncryptKey     [32]byte
	Init           [2]uint64
}

LoopInfo64 represents the loop device information structure

Jump to

Keyboard shortcuts

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