Documentation ¶
Index ¶
- func CreateDevice(name string, flags CreateFlags, targets []Target) (_ string, err error)
- func CreateDeviceWithRetryErrors(ctx context.Context, name string, flags CreateFlags, targets []Target, ...) (string, error)
- func CreateVerityTarget(ctx context.Context, devPath, devName string, ...) (_ string, err error)
- func CreateZeroSectorLinearTarget(ctx context.Context, devPath, devName string, ...) (_ string, err error)
- func RemoveDevice(name string) (err error)
- type CreateFlags
- type Target
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 CreateDeviceWithRetryErrors ¶
func CreateDeviceWithRetryErrors( ctx context.Context, name string, flags CreateFlags, targets []Target, errs ...error, ) (string, error)
CreateDeviceWithRetryErrors keeps retrying to create device mapper target
func CreateVerityTarget ¶
func CreateVerityTarget(ctx context.Context, devPath, devName string, verityInfo *guestresource.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 | | | #blocks | hash_alg root_digest salt size | version hash_dev | hash_block_sz | target data_block_sz hash_offset
See dm-verity for more information
func CreateZeroSectorLinearTarget ¶
func CreateZeroSectorLinearTarget(ctx context.Context, devPath, devName string, mappingInfo *guestresource.LCOWVPMemMappingInfo) (_ string, err error)
CreateZeroSectorLinearTarget creates dm-linear target for a device at `devPath` and `mappingInfo`, returns virtual block device path.
func RemoveDevice ¶
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 ¶
Target specifies a single entry in a device's target specification.
func LinearTarget ¶
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