Documentation ¶
Index ¶
- Constants
- func ActivateDevice(poolName string, deviceName string, deviceID uint32, size uint64, ...) error
- func BlockDeviceSize(path string) (int64, error)
- func CreateDevice(poolName string, deviceID uint32) error
- func CreatePool(poolName, dataFile, metaFile string, blockSizeSectors uint32) error
- func CreateSnapshot(poolName string, deviceID uint32, baseDeviceID uint32) error
- func DeleteDevice(poolName string, deviceID uint32) error
- func GetFullDevicePath(deviceName string) string
- func ReloadPool(deviceName, dataFile, metaFile string, blockSizeSectors uint32) error
- func RemoveDevice(deviceName string, opts ...RemoveDeviceOpt) error
- func ResumeDevice(deviceName string) error
- func SuspendDevice(deviceName string) error
- func Table(deviceName string) (string, error)
- func Version() (string, error)
- type DeviceInfo
- type DeviceStatus
- type RemoveDeviceOpt
Constants ¶
const ( // DevMapperDir represents devmapper devices location DevMapperDir = "/dev/mapper/" // SectorSize represents the number of bytes in one sector on devmapper devices SectorSize = 512 )
Variables ¶
This section is empty.
Functions ¶
func ActivateDevice ¶
func ActivateDevice(poolName string, deviceName string, deviceID uint32, size uint64, external string) error
ActivateDevice activates the given thin-device using the 'thin' target
func BlockDeviceSize ¶
BlockDeviceSize returns size of block device in bytes
func CreateDevice ¶
CreateDevice sends "create_thin <deviceID>" message to the given thin-pool
func CreatePool ¶
CreatePool creates a device with the given name, data and metadata file and block size (see "dmsetup create")
func CreateSnapshot ¶
CreateSnapshot sends "create_snap" message to the given thin-pool. Caller needs to suspend and resume device if it is active.
func DeleteDevice ¶
DeleteDevice sends "delete <deviceID>" message to the given thin-pool
func GetFullDevicePath ¶
GetFullDevicePath returns full path for the given device name (like "/dev/mapper/name")
func ReloadPool ¶
ReloadPool reloads existing thin-pool (see "dmsetup reload")
func RemoveDevice ¶
func RemoveDevice(deviceName string, opts ...RemoveDeviceOpt) error
RemoveDevice removes a device (see "dmsetup remove")
func ResumeDevice ¶
ResumeDevice resumes the given device (see "dmsetup resume")
func SuspendDevice ¶
SuspendDevice suspends the given device (see "dmsetup suspend")
Types ¶
type DeviceInfo ¶
type DeviceInfo struct { Name string BlockDeviceName string TableLive bool TableInactive bool Suspended bool ReadOnly bool Major uint32 Minor uint32 OpenCount uint32 // Open reference count TargetCount uint32 // Number of targets in the live table EventNumber uint32 // Last event sequence number (used by wait) }
DeviceInfo represents device info returned by "dmsetup info". dmsetup(8) provides more information on each of these fields.
func Info ¶
func Info(deviceName string) ([]*DeviceInfo, error)
Info outputs device information (see "dmsetup info"). If device name is empty, all device infos will be returned.
type DeviceStatus ¶
type DeviceStatus struct { RawOutput string Offset int64 Length int64 Target string Params []string }
DeviceStatus represents devmapper device status information
func Status ¶
func Status(deviceName string) (*DeviceStatus, error)
Status provides status information for devmapper device
type RemoveDeviceOpt ¶
type RemoveDeviceOpt string
RemoveDeviceOpt represents command line arguments for "dmsetup remove" command
const ( // RemoveWithForce flag replaces the table with one that fails all I/O if // open device can't be removed RemoveWithForce RemoveDeviceOpt = "--force" // RemoveWithRetries option will cause the operation to be retried // for a few seconds before failing RemoveWithRetries RemoveDeviceOpt = "--retry" // RemoveDeferred flag will enable deferred removal of open devices, // the device will be removed when the last user closes it RemoveDeferred RemoveDeviceOpt = "--deferred" )