Documentation ¶
Index ¶
- Constants
- Variables
- func DevmapperLogCallback(level C.int, file *C.char, line C.int, dm_errno_or_class C.int, ...)
- func FindLoopDeviceFor(file *osFile) *osFile
- func GetBlockDeviceSize(file *osFile) (uint64, error)
- func GetLibraryVersion() (string, error)
- func LogInitVerbose(level int)
- func LoopbackSetCapacity(file *osFile) error
- func RemoveDevice(name string) error
- func SetDevDir(dir string) error
- func UdevWait(cookie uint) error
- type AddNodeType
- type CDmTask
- type CLoopInfo64
- type DevInfo
- type DevStatus
- type DeviceSet
- func (devices *DeviceSet) AddDevice(hash, baseHash string) error
- func (devices *DeviceSet) GetDeviceStatus(hash string) (*DevStatus, error)
- func (devices *DeviceSet) HasActivatedDevice(hash string) bool
- func (devices *DeviceSet) HasDevice(hash string) bool
- func (devices *DeviceSet) HasInitializedDevice(hash string) bool
- func (devices *DeviceSet) List() []string
- func (devices *DeviceSet) MountDevice(hash, path string, readOnly bool) error
- func (devices *DeviceSet) RemoveDevice(hash string) error
- func (devices *DeviceSet) ResizePool(size int64) error
- func (devices *DeviceSet) Shutdown() error
- func (devices *DeviceSet) Status() *Status
- func (devices *DeviceSet) UnmountDevice(hash, path string, deactivate bool) error
- type DevmapperLogger
- type DiskUsage
- type Driver
- type Info
- type LoopInfo64
- type MetaData
- type Status
- type Task
- func (t *Task) AddTarget(start, size uint64, ttype, params string) error
- func (t *Task) GetInfo() (*Info, error)
- func (t *Task) GetNextTarget(next uintptr) (nextPtr uintptr, start uint64, length uint64, targetType string, params string)
- func (t *Task) Run() error
- func (t *Task) SetAddNode(addNode AddNodeType) error
- func (t *Task) SetCookie(cookie *uint, flags uint16) error
- func (t *Task) SetMessage(message string) error
- func (t *Task) SetName(name string) error
- func (t *Task) SetRo() error
- func (t *Task) SetSector(sector uint64) error
- type TaskType
Constants ¶
View Source
const ( BlkGetSize64 = C.BLKGETSIZE64 LoopSetFd = C.LOOP_SET_FD LoopCtlGetFree = C.LOOP_CTL_GET_FREE LoopGetStatus64 = C.LOOP_GET_STATUS64 LoopSetStatus64 = C.LOOP_SET_STATUS64 LoopClrFd = C.LOOP_CLR_FD LoopSetCapacity = C.LOOP_SET_CAPACITY )
FIXME: Make sure the values are defined in C IOCTL consts
View Source
const ( LoFlagsAutoClear = C.LO_FLAGS_AUTOCLEAR LoFlagsReadOnly = C.LO_FLAGS_READ_ONLY LoFlagsPartScan = C.LO_FLAGS_PARTSCAN LoKeySize = C.LO_KEY_SIZE LoNameSize = C.LO_NAME_SIZE )
Variables ¶
View Source
var ( DefaultDataLoopbackSize int64 = 100 * 1024 * 1024 * 1024 DefaultMetaDataLoopbackSize int64 = 2 * 1024 * 1024 * 1024 DefaultBaseFsSize uint64 = 10 * 1024 * 1024 * 1024 )
View Source
var ( ErrTaskRun = errors.New("dm_task_run failed") ErrTaskSetName = errors.New("dm_task_set_name failed") ErrTaskSetMessage = errors.New("dm_task_set_message failed") ErrTaskSetAddNode = errors.New("dm_task_set_add_node failed") ErrTaskSetRo = errors.New("dm_task_set_ro failed") ErrTaskAddTarget = errors.New("dm_task_add_target failed") ErrTaskSetSector = errors.New("dm_task_set_sector failed") ErrTaskGetInfo = errors.New("dm_task_get_info failed") ErrTaskSetCookie = errors.New("dm_task_set_cookie failed") ErrNilCookie = errors.New("cookie ptr can't be nil") ErrAttachLoopbackDevice = errors.New("loopback mounting failed") ErrGetBlockSize = errors.New("Can't get block size") ErrUdevWait = errors.New("wait on udev cookie failed") ErrSetDevDir = errors.New("dm_set_dev_dir failed") ErrGetLibraryVersion = errors.New("dm_get_library_version failed") ErrCreateRemoveTask = errors.New("Can't create task of type DeviceRemove") ErrRunRemoveDevice = errors.New("running removeDevice failed") ErrInvalidAddNode = errors.New("Invalide AddNoce type") ErrGetLoopbackBackingFile = errors.New("Unable to get loopback backing file") ErrLoopbackSetCapacity = errors.New("Unable set loopback capacity") )
View Source
var ( DmGetLibraryVersion = dmGetLibraryVersionFct DmGetNextTarget = dmGetNextTargetFct DmLogInitVerbose = dmLogInitVerboseFct DmSetDevDir = dmSetDevDirFct DmTaskAddTarget = dmTaskAddTargetFct DmTaskCreate = dmTaskCreateFct DmTaskDestroy = dmTaskDestroyFct DmTaskGetInfo = dmTaskGetInfoFct DmTaskRun = dmTaskRunFct DmTaskSetAddNode = dmTaskSetAddNodeFct DmTaskSetCookie = dmTaskSetCookieFct DmTaskSetMessage = dmTaskSetMessageFct DmTaskSetName = dmTaskSetNameFct DmTaskSetRo = dmTaskSetRoFct DmTaskSetSector = dmTaskSetSectorFct DmUdevWait = dmUdevWaitFct LogWithErrnoInit = logWithErrnoInitFct )
View Source
var Init = func(home string) (graphdriver.Driver, error) { deviceSet, err := NewDeviceSet(home, true) if err != nil { return nil, err } d := &Driver{ DeviceSet: deviceSet, home: home, } return d, nil }
View Source
var Mounted = func(mountpoint string) (bool, error) { mntpoint, err := osStat(mountpoint) if err != nil { if osIsNotExist(err) { return false, nil } return false, err } parent, err := osStat(filepath.Join(mountpoint, "..")) if err != nil { return false, err } mntpointSt := toSysStatT(mntpoint.Sys()) parentSt := toSysStatT(parent.Sys()) return mntpointSt.Dev != parentSt.Dev, nil }
Functions ¶
func DevmapperLogCallback ¶
func FindLoopDeviceFor ¶
func FindLoopDeviceFor(file *osFile) *osFile
func GetBlockDeviceSize ¶
func GetLibraryVersion ¶
func LogInitVerbose ¶
func LogInitVerbose(level int)
func LoopbackSetCapacity ¶
func LoopbackSetCapacity(file *osFile) error
Types ¶
type AddNodeType ¶
type AddNodeType int
const ( AddNodeOnResume AddNodeType = iota AddNodeOnCreate )
type CDmTask ¶
type CDmTask C.struct_dm_task
type CLoopInfo64 ¶ added in v0.7.1
type CLoopInfo64 C.struct_loop_info64
type DevInfo ¶
type DeviceSet ¶
type DeviceSet struct { MetaData sync.Mutex TransactionId uint64 NewTransactionId uint64 // contains filtered or unexported fields }
func (*DeviceSet) GetDeviceStatus ¶
func (*DeviceSet) HasActivatedDevice ¶
func (*DeviceSet) HasInitializedDevice ¶
func (*DeviceSet) MountDevice ¶
func (*DeviceSet) RemoveDevice ¶
func (*DeviceSet) ResizePool ¶
type DevmapperLogger ¶
type DevmapperLogger interface {
// contains filtered or unexported methods
}
type LoopInfo64 ¶ added in v0.7.1
type LoopInfo64 struct {
// contains filtered or unexported fields
}
type Task ¶
type Task struct {
// contains filtered or unexported fields
}
func TaskCreate ¶
func (*Task) GetNextTarget ¶
func (*Task) SetAddNode ¶
func (t *Task) SetAddNode(addNode AddNodeType) error
func (*Task) SetMessage ¶
Click to show internal directories.
Click to hide internal directories.