Documentation
¶
Index ¶
- Constants
- func Create(name string, uuid string) error
- func CreateAndLoad(name string, uuid string, flags uint32, tables ...Table) error
- func GetVersion() (major, minor, patch uint32, err error)
- func Load(name string, flags uint32, tables ...Table) error
- func Message(name string, sector int, message string) error
- func Remove(name string) error
- func Rename(old, new string) error
- func Resume(name string) error
- func SetUUID(name, uuid string) error
- func Suspend(name string) error
- type CryptTable
- type DeviceInfo
- type LinearTable
- type ListItem
- type Table
- type VerityTable
- type Volume
- type ZeroTable
Constants ¶
const ( // CryptFlagAllowDiscards is an equivalent of 'allow_discards' crypt option CryptFlagAllowDiscards = "allow_discards" // CryptFlagSameCPUCrypt is an equivalent of 'same_cpu_crypt' crypt option CryptFlagSameCPUCrypt = "same_cpu_crypt" // CryptFlagSubmitFromCryptCPUs is an equivalent of 'submit_from_crypt_cpus' crypt option CryptFlagSubmitFromCryptCPUs = "submit_from_crypt_cpus" // CryptFlagNoReadWorkqueue is an equivalent of 'no_read_workqueue' crypt option CryptFlagNoReadWorkqueue = "no_read_workqueue" // CryptFlagNoWriteWorkqueue is an equivalent of 'no_write_workqueue' crypt option CryptFlagNoWriteWorkqueue = "no_write_workqueue" )
const ( // ReadOnlyFlag is a devmapper readonly flag value ReadOnlyFlag = unix.DM_READONLY_FLAG )
const SectorSize = 512
SectorSize is a device size used for devmapper calculations. Currently this value hardcoded to 512.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
Create creates a new device. No table will be loaded. The device will be in suspended state. Any IO to this device will fail.
func CreateAndLoad ¶
CreateAndLoad creates, loads the provided tables and resumes the device.
func GetVersion ¶
GetVersion returns version for the dm-mapper kernel interface
Types ¶
type CryptTable ¶
type CryptTable struct { Start uint64 Length uint64 BackendDevice string // device that stores the encrypted data BackendOffset uint64 Encryption string Key []byte KeyID string // key id in the keystore e.g. ":32:logon:foobarkey" IVTweak uint64 Flags []string // TODO: maybe convert it to bitflag instead? SectorSize uint64 // size of the sector the crypto device operates with }
CryptTable represents information needed for 'crypt' target creation
type DeviceInfo ¶
type DeviceInfo struct { Name string UUID string DevNo uint64 OpenCount int32 TargetsNum uint32 Flags uint32 // combination of unix.DM_*_FLAG }
DeviceInfo is a type that holds devmapper device information
func InfoByDevno ¶
func InfoByDevno(devno uint64) (*DeviceInfo, error)
InfoByDevno returns device mapper information by its block device number (major/minor)
func InfoByName ¶
func InfoByName(name string) (*DeviceInfo, error)
InfoByName returns device information by its name
type LinearTable ¶
LinearTable represents information needed for 'linear' target creation
type Table ¶
type Table interface {
// contains filtered or unexported methods
}
Table is a type to represent different devmapper targets like 'zero', 'crypt', ...
type VerityTable ¶
type VerityTable struct { Start uint64 Length uint64 HashType uint64 DataDevice string // the device containing data, the integrity of which needs to be checked HashDevice string // device that supplies the hash tree data DataBlockSize, HashBlockSize uint64 NumDataBlocks, HashStartBlock uint64 Algorithm, Digest, Salt string Params []string }
VerityTable represents information needed for 'verity' target creation
type Volume ¶
Volume represents reader/writer for the data handled by the device mapper table. Due to constrains the reader and writer operate at SectorSize size. Some targets may put further restrictions on the buffer alignment, e.g. CryptTarget operates at CryptTarget.SectorSize instead
func OpenUserspaceVolume ¶
OpenUserspaceVolume opens a volume that allows to read/write data. It performs the data processing at user-space level without using device-mapper kernel framework. flag and perm parameters are applied to os.OpenFile() when opening the underlying files