devmapper

package
v0.7.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2013 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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")
	ErrGetDriverVersion     = errors.New("dm_task_get_driver_version failed")
	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")
)

Functions

func AttachLoopDevice

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

func GetBlockDeviceSize

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

func GetLibraryVersion

func GetLibraryVersion() (string, error)

func LogInitVerbose

func LogInitVerbose(level int)

func RemoveDevice

func RemoveDevice(name string) error

Useful helper for cleanup

func SetDevDir

func SetDevDir(dir string) error

func UdevWait

func UdevWait(cookie uint32) error

Types

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 DeviceSetDM

type DeviceSetDM struct {
	MetaData
	sync.Mutex

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

func NewDeviceSetDM

func NewDeviceSetDM(root string) *DeviceSetDM

func (*DeviceSetDM) AddDevice

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

func (*DeviceSetDM) DeactivateDevice

func (devices *DeviceSetDM) DeactivateDevice(hash string) error

func (*DeviceSetDM) HasActivatedDevice

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

func (*DeviceSetDM) HasDevice

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

func (*DeviceSetDM) HasInitializedDevice

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

func (*DeviceSetDM) MountDevice

func (devices *DeviceSetDM) MountDevice(hash, path string) error

func (*DeviceSetDM) RemoveDevice

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

func (*DeviceSetDM) SetInitialized

func (devices *DeviceSetDM) SetInitialized(hash string) error

func (*DeviceSetDM) Shutdown

func (devices *DeviceSetDM) Shutdown() error

func (*DeviceSetDM) UnmountDevice

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

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 Task

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

func TaskCreate

func TaskCreate(tasktype TaskType) *Task

func (*Task) AddTarget

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

func (*Task) GetDriverVersion

func (t *Task) GetDriverVersion() (string, error)

func (*Task) GetInfo

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

func (*Task) GetNextTarget

func (t *Task) GetNextTarget(next uintptr) (uintptr, uint64, uint64, string, string)

func (*Task) Run

func (t *Task) Run() error

func (*Task) SetCookie

func (t *Task) SetCookie(cookie *uint32, 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