losetup

package
v0.0.0-...-21b9e53 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// DiskType is a disk type
	DiskType = "disk"
	// SSDType is an sdd type
	SSDType = "ssd"
	// PartType is a partition type
	PartType = "part"
	// CryptType is an encrypted type
	CryptType = "crypt"
	// LVMType is an LVM type
	LVMType = "lvm"
	// MultiPath is for multipath devices
	MultiPath = "mpath"
	// LinearType is a linear type
	LinearType = "linear"
	// LoopType is a loop device type
	LoopType = "loop"

	// CephLVPrefix is the prefix of a LV owned by ceph-volume
	CephLVPrefix = "ceph--"
	// DeviceMapperPrefix is the prefix of a LV from the device mapper interface
	DeviceMapperPrefix = "dm-"
)
View Source
const (
	LOSETUP_COMMAND = "losetup"
)

Variables

This section is empty.

Functions

func DetachDevice

func DetachDevice(devPath string) error

func DetachDeviceByFile

func DetachDeviceByFile(filePath string) error

func ResizeLoopDevice

func ResizeLoopDevice(loopDev string) error

Types

type Command

type Command struct {
	Path string
	Args []string
	// contains filtered or unexported fields
}

func NewCommand

func NewCommand(path string, args ...string) *Command

func (*Command) AddArgs

func (cmd *Command) AddArgs(args ...string) *Command

func (*Command) Output

func (cmd *Command) Output() string

func (*Command) Run

func (cmd *Command) Run() (*Command, error)

type Device

type Device struct {
	Name      string `json:"name"`
	BackFile  string `json:"back-file"`
	SizeLimit bool   `json:"sizelimit"`
	//Offset    string `json:"offset"`
	//AutoClear string `json:"autoclear"`
	ReadOnly bool `json:"ro"`
}

func AttachDevice

func AttachDevice(filePath string, partScan bool) (*Device, error)

type Devices

type Devices struct {
	LoopDevs []Device `json:"loopdevices"`
}

func ListDevices

func ListDevices() (*Devices, error)

func (Devices) GetDeviceByFile

func (devs Devices) GetDeviceByFile(filePath string) *Device

func (Devices) GetDeviceByName

func (devs Devices) GetDeviceByName(name string) *Device

type LosetupCommand

type LosetupCommand struct {
	*Command
}

func NewLosetupCommand

func NewLosetupCommand() *LosetupCommand

type Partition

type Partition struct {
	Name       string
	Size       uint64
	Label      string
	Filesystem string
}

Partition represents a partition metadata

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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