loopdev

package
v1.10.1 Latest Latest
Warning

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

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

Documentation

Overview

Package loopdev provides a thin wrapper around Linux loop device ioctls, using golang.org/x/sys/unix instead of external dependencies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attacher

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

Attacher implements iface.LoopAttacher using Linux ioctls.

func NewAttacher

func NewAttacher() *Attacher

NewAttacher returns an Attacher using real system calls.

func (*Attacher) Attach

func (a *Attacher) Attach(backingFile string, offset uint64, readOnly bool) (iface.LoopDevice, error)

Attach opens the backing file, finds a free loop device, and attaches the file to that device with the given offset and read-only flag.

type Device

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

Device represents an attached loop device, implementing iface.LoopDevice.

func (*Device) Detach

func (d *Device) Detach() error

Detach removes the association between the loop device and its backing file.

func (*Device) Path

func (d *Device) Path() string

Path returns the path of the loop device (e.g., "/dev/loop0").

func (*Device) SetAutoclear

func (d *Device) SetAutoclear() error

SetAutoclear sets the LO_FLAGS_AUTOCLEAR flag on the loop device so the kernel automatically detaches when the last reference is dropped.

Jump to

Keyboard shortcuts

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