devicemapper

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDevice

func CreateDevice(name string, flags CreateFlags, targets []Target) (_ string, err error)

CreateDevice creates a device-mapper device with the given target spec. It returns the path of the new device node.

func CreateVerityTarget

func CreateVerityTarget(ctx context.Context, devPath, devName string, verityInfo *prot.DeviceVerityInfo) (_ string, err error)

CreateVerityTarget creates a dm-verity target for a given device and returns created virtual block device path.

Example verity target table: 0 417792 verity 1 /dev/sdb /dev/sdc 4096 4096 52224 1 sha256 2aa4f7b7b6...f4952060e8 762307f4bc8...d2a6b7595d8.. | | | | | | | | | | | | | start| | | data_dev | data_block | #blocks | hash_alg root_digest salt

size   |  version    hash_dev         |     hash_offset
     target                       hash_block

func CreateZeroSectorLinearTarget

func CreateZeroSectorLinearTarget(ctx context.Context, devPath, devName string, mappingInfo *prot.DeviceMappingInfo) (_ string, err error)

CreateZeroSectorLinearTarget creates dm-linear target for a device at `devPath` and `mappingInfo`, returns virtual block device path.

func RemoveDevice

func RemoveDevice(name string) error

RemoveDevice removes a device-mapper device and its associated device node.

Types

type CreateFlags

type CreateFlags int

CreateFlags modify the operation of CreateDevice

const (
	// CreateReadOnly specifies that the device is not writable
	CreateReadOnly CreateFlags = 1 << iota
)

type Target

type Target struct {
	Type           string
	SectorStart    int64
	LengthInBlocks int64
	Params         string
}

Target specifies a single entry in a device's target specification.

func LinearTarget

func LinearTarget(sectorStart, lengthBlocks int64, path string, deviceStart int64) Target

LinearTarget constructs a device-mapper target that maps a portion of a block device at the specified offset.

Example linear target table: 0 20971520 linear /dev/hda 384 | | | | | start | target data_dev |

size                 offset

Jump to

Keyboard shortcuts

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