devicemapper

package
v0.0.0-...-785df0d Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

package devicemapper is a thin wrapper for the devicemapper ioctl API. See: https://github.com/torvalds/linux/blob/master/include/uapi/linux/dm-ioctl.h

Index

Constants

View Source
const (
	/* Top level cmds */
	DM_VERSION_CMD uintptr = (0xc138fd << 8) + iota
	DM_REMOVE_ALL_CMD
	DM_LIST_DEVICES_CMD

	/* device level cmds */
	DM_DEV_CREATE_CMD
	DM_DEV_REMOVE_CMD
	DM_DEV_RENAME_CMD
	DM_DEV_SUSPEND_CMD
	DM_DEV_STATUS_CMD
	DM_DEV_WAIT_CMD

	/* Table level cmds */
	DM_TABLE_LOAD_CMD
	DM_TABLE_CLEAR_CMD
	DM_TABLE_DEPS_CMD
	DM_TABLE_STATUS_CMD

	/* Added later */
	DM_LIST_VERSIONS_CMD
	DM_TARGET_MSG_CMD
	DM_DEV_SET_GEOMETRY_CMD
	DM_DEV_ARM_POLL_CMD
)
View Source
const (
	DM_READONLY_FLAG       = 1 << 0 /* In/Out */
	DM_SUSPEND_FLAG        = 1 << 1 /* In/Out */
	DM_PERSISTENT_DEV_FLAG = 1 << 3 /* In */
)

Variables

This section is empty.

Functions

func CreateActiveDevice

func CreateActiveDevice(name string, readOnly bool, targets []Target) (uint64, error)

func CreateDevice

func CreateDevice(name string) (uint64, error)

func LoadTable

func LoadTable(name string, readOnly bool, targets []Target) error

func RemoveDevice

func RemoveDevice(name string) error

func Resume

func Resume(name string) error

func Suspend

func Suspend(name string) error

Types

type DMIoctl

type DMIoctl struct {
	Version     Version
	DataSize    uint32
	DataStart   uint32
	TargetCount uint32
	OpenCount   int32
	Flags       uint32
	EventNumber uint32

	Dev  uint64
	Name [128]byte
	UUID [129]byte

	Data [16384]byte
	// contains filtered or unexported fields
}

type DMNameList

type DMNameList struct {
	Dev  uint64
	Next uint32
	Name []byte
}

type DMTargetDeps

type DMTargetDeps struct {
	Count   uint32
	Padding uint32
	Dev     []uint64
}

type DMTargetMessage

type DMTargetMessage struct {
	Sector  uint64
	Message []byte
}

type DMTargetSpec

type DMTargetSpec struct {
	SectorStart uint64
	Length      uint64
	Status      int32
	Next        uint32
	TargetType  [16]byte
}

type DMTargetVersions

type DMTargetVersions struct {
	Next    uint32
	Version [3]uint32
}

type Target

type Target struct {
	// StartSector is the first sector (defined as being 512 bytes long) this
	// target covers.
	StartSector uint64
	// Length is the number of sectors (defined as being 512 bytes long) this
	// target covers, starting from StartSector.
	Length uint64
	// Type is the type of target handling this byte region.
	// Types implemented by the Linux kernel can be found at
	// @linux//drivers/md/... by looking for dm_register_target() calls.
	Type string
	// Parameters are additional parameters specific to the target type.
	// Note that null bytes and parameters consisting only of whitespace
	// characters cannot be encoded and will return an error.
	Parameters []string
}

Target represents a byte region inside a devicemapper table for a given device provided by a given target implementation.

type Version

type Version [3]uint32

func GetVersion

func GetVersion() (Version, error)

Jump to

Keyboard shortcuts

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