devmapper

package
v0.7.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2013 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

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")
	ErrTaskGetDriverVersion = errors.New("dm_task_get_driver_version 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")
)
View Source
var (
	DmTaskDestory       = dmTaskDestroyFct
	DmTaskCreate        = dmTaskCreateFct
	DmTaskRun           = dmTaskRunFct
	DmTaskSetName       = dmTaskSetNameFct
	DmTaskSetMessage    = dmTaskSetMessageFct
	DmTaskSetSector     = dmTaskSetSectorFct
	DmTaskSetCookie     = dmTaskSetCookieFct
	DmTaskSetAddNode    = dmTaskSetAddNodeFct
	DmTaskSetRo         = dmTaskSetRoFct
	DmTaskAddTarget     = dmTaskAddTargetFct
	DmTaskGetInfo       = dmTaskGetInfoFct
	DmGetNextTarget     = dmGetNextTargetFct
	DmGetBlockSize      = dmGetBlockSizeFct
	DmAttachLoopDevice  = dmAttachLoopDeviceFct
	DmUdevWait          = dmUdevWaitFct
	DmLogInitVerbose    = dmLogInitVerboseFct
	DmSetDevDir         = dmSetDevDirFct
	DmGetLibraryVersion = dmGetLibraryVersionFct
	LogWithErrnoInit    = logWithErrnoInitFct
	GetBlockSize        = getBlockSizeFct
)

Functions

func AttachLoopDevice

func AttachLoopDevice(filename string) (*os.File, error)

func DevmapperLogCallback

func DevmapperLogCallback(level C.int, file *C.char, line C.int, dm_errno_or_class C.int, message *C.char)

func GetBlockDeviceSize

func GetBlockDeviceSize(file *os.File) (uint64, error)

func GetLibraryVersion

func GetLibraryVersion() (string, error)

func Init

func Init(home string) (graphdriver.Driver, error)

func LogInitVerbose

func LogInitVerbose(level int)

func Mounted

func Mounted(mountpoint string) (bool, error)

func RemoveDevice

func RemoveDevice(name string) error

Useful helper for cleanup

func SetDevDir

func SetDevDir(dir string) error

func UdevWait

func UdevWait(cookie uint) error

Types

type AddNodeType

type AddNodeType int
const (
	AddNodeOnResume AddNodeType = iota
	AddNodeOnCreate
)

type CDmTask

type CDmTask C.struct_dm_task

type DevInfo

type DevInfo struct {
	Hash          string `json:"-"`
	DeviceId      int    `json:"device_id"`
	Size          uint64 `json:"size"`
	TransactionId uint64 `json:"transaction_id"`
	Initialized   bool   `json:"initialized"`
	// contains filtered or unexported fields
}

func (*DevInfo) DevName

func (info *DevInfo) DevName() string

func (*DevInfo) Name

func (info *DevInfo) Name() string

type DeviceSet

type DeviceSet struct {
	MetaData
	sync.Mutex

	TransactionId    uint64
	NewTransactionId uint64
	// contains filtered or unexported fields
}

func NewDeviceSet

func NewDeviceSet(root string) (*DeviceSet, error)

func (*DeviceSet) AddDevice

func (devices *DeviceSet) AddDevice(hash, baseHash string) error

func (*DeviceSet) HasActivatedDevice

func (devices *DeviceSet) HasActivatedDevice(hash string) bool

func (*DeviceSet) HasDevice

func (devices *DeviceSet) HasDevice(hash string) bool

func (*DeviceSet) HasInitializedDevice

func (devices *DeviceSet) HasInitializedDevice(hash string) bool

func (*DeviceSet) MountDevice

func (devices *DeviceSet) MountDevice(hash, path string, readOnly bool) error

func (*DeviceSet) RemoveDevice

func (devices *DeviceSet) RemoveDevice(hash string) error

func (*DeviceSet) Shutdown

func (devices *DeviceSet) Shutdown() error

func (*DeviceSet) Status

func (devices *DeviceSet) Status() *Status

func (*DeviceSet) UnmountDevice

func (devices *DeviceSet) UnmountDevice(hash, path string, deactivate bool) error

type DevmapperLogger

type DevmapperLogger interface {
	// contains filtered or unexported methods
}

type DiskUsage

type DiskUsage struct {
	Used  uint64
	Total uint64
}

type Driver

type Driver struct {
	*DeviceSet
	// contains filtered or unexported fields
}

func (*Driver) Cleanup

func (d *Driver) Cleanup() error

func (*Driver) Create

func (d *Driver) Create(id string, parent string) error

func (*Driver) Get

func (d *Driver) Get(id string) (string, error)

func (*Driver) Remove

func (d *Driver) Remove(id string) error

func (*Driver) Size

func (d *Driver) Size(id string) (int64, error)

func (*Driver) String

func (d *Driver) String() string

type Info

type Info struct {
	Exists        int
	Suspended     int
	LiveTable     int
	InactiveTable int
	OpenCount     int32
	EventNr       uint32
	Major         uint32
	Minor         uint32
	ReadOnly      int
	TargetCount   int32
}

type MetaData

type MetaData struct {
	Devices map[string]*DevInfo `json:devices`
}

type Status

type Status struct {
	PoolName         string
	DataLoopback     string
	MetadataLoopback string
	Data             DiskUsage
	Metadata         DiskUsage
}

type Task

type Task struct {
	// contains filtered or unexported fields
}

func TaskCreate

func TaskCreate(tasktype TaskType) *Task

func (*Task) AddTarget

func (t *Task) AddTarget(start, size uint64, ttype, params string) error

func (*Task) GetInfo

func (t *Task) GetInfo() (*Info, error)

func (*Task) GetNextTarget

func (t *Task) GetNextTarget(next uintptr) (nextPtr uintptr, start uint64,
	length uint64, targetType string, params string)

func (*Task) Run

func (t *Task) Run() error

func (*Task) SetAddNode

func (t *Task) SetAddNode(addNode AddNodeType) error

func (*Task) SetCookie

func (t *Task) SetCookie(cookie *uint, flags uint16) error

func (*Task) SetMessage

func (t *Task) SetMessage(message string) error

func (*Task) SetName

func (t *Task) SetName(name string) error

func (*Task) SetRo

func (t *Task) SetRo() error

func (*Task) SetSector

func (t *Task) SetSector(sector uint64) error

type TaskType

type TaskType int
const (
	DeviceCreate TaskType = iota
	DeviceReload
	DeviceRemove
	DeviceRemoveAll
	DeviceSuspend
	DeviceResume
	DeviceInfo
	DeviceDeps
	DeviceRename
	DeviceVersion
	DeviceStatus
	DeviceTable
	DeviceWaitevent
	DeviceList
	DeviceClear
	DeviceMknodes
	DeviceListVersions
	DeviceTargetMsg
	DeviceSetGeometry
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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