devicemapper: split out devicemapper bindings

This is a first pass at splitting out devicemapper into separate, usable
bindings.

Signed-off-by: Vincent Batts <vbatts@redhat.com>
This commit is contained in:
Vincent Batts 2014-11-05 18:10:38 -05:00
parent a61c4dc959
commit e2f8fbfbcc
7 changed files with 87 additions and 82 deletions

View file

@ -20,6 +20,7 @@ import (
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/graphdriver"
"github.com/docker/docker/pkg/devicemapper"
"github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/units"
"github.com/docker/libcontainer/label"
@ -228,7 +229,7 @@ func (devices *DeviceSet) saveMetadata(info *DevInfo) error {
}
if devices.NewTransactionId != devices.TransactionId {
if err = setTransactionId(devices.getPoolDevName(), devices.TransactionId, devices.NewTransactionId); err != nil {
if err = devicemapper.SetTransactionId(devices.getPoolDevName(), devices.TransactionId, devices.NewTransactionId); err != nil {
return fmt.Errorf("Error setting devmapper transition ID: %s", err)
}
devices.TransactionId = devices.NewTransactionId
@ -280,11 +281,11 @@ func (devices *DeviceSet) registerDevice(id int, hash string, size uint64) (*Dev
func (devices *DeviceSet) activateDeviceIfNeeded(info *DevInfo) error {
log.Debugf("activateDeviceIfNeeded(%v)", info.Hash)
if devinfo, _ := getInfo(info.Name()); devinfo != nil && devinfo.Exists != 0 {
if devinfo, _ := devicemapper.GetInfo(info.Name()); devinfo != nil && devinfo.Exists != 0 {
return nil
}
return activateDevice(devices.getPoolDevName(), info.Name(), info.DeviceId, info.Size)
return devicemapper.ActivateDevice(devices.getPoolDevName(), info.Name(), info.DeviceId, info.Size)
}
func (devices *DeviceSet) createFilesystem(info *DevInfo) error {
@ -321,7 +322,7 @@ func (devices *DeviceSet) createFilesystem(info *DevInfo) error {
}
func (devices *DeviceSet) initMetaData() error {
_, _, _, params, err := getStatus(devices.getPoolName())
_, _, _, params, err := devicemapper.GetStatus(devices.getPoolName())
if err != nil {
return err
}
@ -400,7 +401,7 @@ func (devices *DeviceSet) setupBaseImage() error {
id := devices.nextDeviceId
// Create initial device
if err := createDevice(devices.getPoolDevName(), &id); err != nil {
if err := devicemapper.CreateDevice(devices.getPoolDevName(), &id); err != nil {
return err
}
@ -410,7 +411,7 @@ func (devices *DeviceSet) setupBaseImage() error {
log.Debugf("Registering base device (id %v) with FS size %v", id, devices.baseFsSize)
info, err := devices.registerDevice(id, "", devices.baseFsSize)
if err != nil {
_ = deleteDevice(devices.getPoolDevName(), id)
_ = devicemapper.DeleteDevice(devices.getPoolDevName(), id)
return err
}
@ -447,11 +448,12 @@ func setCloseOnExec(name string) {
}
}
func (devices *DeviceSet) log(level int, file string, line int, dmError int, message string) {
func (devices *DeviceSet) DMLog(level int, file string, line int, dmError int, message string) {
if level >= 7 {
return // Ignore _LOG_DEBUG
}
// FIXME(vbatts) push this back into ./pkg/devicemapper/
log.Debugf("libdevmapper(%d): %s:%d (%d) %s", level, file, line, dmError, message)
}
@ -489,7 +491,7 @@ func (devices *DeviceSet) ResizePool(size int64) error {
return fmt.Errorf("Can't shrink file")
}
dataloopback := FindLoopDeviceFor(datafile)
dataloopback := devicemapper.FindLoopDeviceFor(datafile)
if dataloopback == nil {
return fmt.Errorf("Unable to find loopback mount for: %s", datafilename)
}
@ -501,7 +503,7 @@ func (devices *DeviceSet) ResizePool(size int64) error {
}
defer metadatafile.Close()
metadataloopback := FindLoopDeviceFor(metadatafile)
metadataloopback := devicemapper.FindLoopDeviceFor(metadatafile)
if metadataloopback == nil {
return fmt.Errorf("Unable to find loopback mount for: %s", metadatafilename)
}
@ -513,22 +515,22 @@ func (devices *DeviceSet) ResizePool(size int64) error {
}
// Reload size for loopback device
if err := LoopbackSetCapacity(dataloopback); err != nil {
if err := devicemapper.LoopbackSetCapacity(dataloopback); err != nil {
return fmt.Errorf("Unable to update loopback capacity: %s", err)
}
// Suspend the pool
if err := suspendDevice(devices.getPoolName()); err != nil {
if err := devicemapper.SuspendDevice(devices.getPoolName()); err != nil {
return fmt.Errorf("Unable to suspend pool: %s", err)
}
// Reload with the new block sizes
if err := reloadPool(devices.getPoolName(), dataloopback, metadataloopback, devices.thinpBlockSize); err != nil {
if err := devicemapper.ReloadPool(devices.getPoolName(), dataloopback, metadataloopback, devices.thinpBlockSize); err != nil {
return fmt.Errorf("Unable to reload pool: %s", err)
}
// Resume the pool
if err := resumeDevice(devices.getPoolName()); err != nil {
if err := devicemapper.ResumeDevice(devices.getPoolName()); err != nil {
return fmt.Errorf("Unable to resume pool: %s", err)
}
@ -536,9 +538,10 @@ func (devices *DeviceSet) ResizePool(size int64) error {
}
func (devices *DeviceSet) initDevmapper(doInit bool) error {
logInit(devices)
// give ourselves to libdm as a log handler
devicemapper.LogInit(devices)
_, err := getDriverVersion()
_, err := devicemapper.GetDriverVersion()
if err != nil {
// Can't even get driver version, assume not supported
return graphdriver.ErrNotSupported
@ -566,9 +569,9 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
// Check for the existence of the device <prefix>-pool
log.Debugf("Checking for existence of the pool '%s'", devices.getPoolName())
info, err := getInfo(devices.getPoolName())
info, err := devicemapper.GetInfo(devices.getPoolName())
if info == nil {
log.Debugf("Error device getInfo: %s", err)
log.Debugf("Error device devicemapper.GetInfo: %s", err)
return err
}
@ -610,7 +613,7 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
return err
}
dataFile, err = attachLoopDevice(data)
dataFile, err = devicemapper.AttachLoopDevice(data)
if err != nil {
return err
}
@ -641,7 +644,7 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
return err
}
metadataFile, err = attachLoopDevice(metadata)
metadataFile, err = devicemapper.AttachLoopDevice(metadata)
if err != nil {
return err
}
@ -653,7 +656,7 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
}
defer metadataFile.Close()
if err := createPool(devices.getPoolName(), dataFile, metadataFile, devices.thinpBlockSize); err != nil {
if err := devicemapper.CreatePool(devices.getPoolName(), dataFile, metadataFile, devices.thinpBlockSize); err != nil {
return err
}
}
@ -695,7 +698,7 @@ func (devices *DeviceSet) AddDevice(hash, baseHash string) error {
deviceId := devices.nextDeviceId
if err := createSnapDevice(devices.getPoolDevName(), &deviceId, baseInfo.Name(), baseInfo.DeviceId); err != nil {
if err := devicemapper.CreateSnapDevice(devices.getPoolDevName(), &deviceId, baseInfo.Name(), baseInfo.DeviceId); err != nil {
log.Debugf("Error creating snap device: %s", err)
return err
}
@ -704,7 +707,7 @@ func (devices *DeviceSet) AddDevice(hash, baseHash string) error {
devices.nextDeviceId = (deviceId + 1) & 0xffffff
if _, err := devices.registerDevice(deviceId, hash, baseInfo.Size); err != nil {
deleteDevice(devices.getPoolDevName(), deviceId)
devicemapper.DeleteDevice(devices.getPoolDevName(), deviceId)
log.Debugf("Error registering device: %s", err)
return err
}
@ -717,13 +720,13 @@ func (devices *DeviceSet) deleteDevice(info *DevInfo) error {
// on the thin pool when we remove a thinp device, so we do it
// manually
if err := devices.activateDeviceIfNeeded(info); err == nil {
if err := BlockDeviceDiscard(info.DevName()); err != nil {
if err := devicemapper.BlockDeviceDiscard(info.DevName()); err != nil {
log.Debugf("Error discarding block on device: %s (ignoring)", err)
}
}
}
devinfo, _ := getInfo(info.Name())
devinfo, _ := devicemapper.GetInfo(info.Name())
if devinfo != nil && devinfo.Exists != 0 {
if err := devices.removeDeviceAndWait(info.Name()); err != nil {
log.Debugf("Error removing device: %s", err)
@ -731,7 +734,7 @@ func (devices *DeviceSet) deleteDevice(info *DevInfo) error {
}
}
if err := deleteDevice(devices.getPoolDevName(), info.DeviceId); err != nil {
if err := devicemapper.DeleteDevice(devices.getPoolDevName(), info.DeviceId); err != nil {
log.Debugf("Error deleting device: %s", err)
return err
}
@ -772,16 +775,16 @@ func (devices *DeviceSet) deactivatePool() error {
defer log.Debugf("[devmapper] deactivatePool END")
devname := devices.getPoolDevName()
devinfo, err := getInfo(devname)
devinfo, err := devicemapper.GetInfo(devname)
if err != nil {
return err
}
if d, err := getDeps(devname); err == nil {
if d, err := devicemapper.GetDeps(devname); err == nil {
// Access to more Debug output
log.Debugf("[devmapper] getDeps() %s: %#v", devname, d)
log.Debugf("[devmapper] devicemapper.GetDeps() %s: %#v", devname, d)
}
if devinfo.Exists != 0 {
return removeDevice(devname)
return devicemapper.RemoveDevice(devname)
}
return nil
@ -797,7 +800,7 @@ func (devices *DeviceSet) deactivateDevice(info *DevInfo) error {
log.Errorf("Warning: error waiting for device %s to close: %s", info.Hash, err)
}
devinfo, err := getInfo(info.Name())
devinfo, err := devicemapper.GetInfo(info.Name())
if err != nil {
return err
}
@ -816,11 +819,11 @@ func (devices *DeviceSet) removeDeviceAndWait(devname string) error {
var err error
for i := 0; i < 1000; i++ {
err = removeDevice(devname)
err = devicemapper.RemoveDevice(devname)
if err == nil {
break
}
if err != ErrBusy {
if err != devicemapper.ErrBusy {
return err
}
@ -848,7 +851,7 @@ func (devices *DeviceSet) waitRemove(devname string) error {
defer log.Debugf("[deviceset %s] waitRemove(%s) END", devices.devicePrefix, devname)
i := 0
for ; i < 1000; i++ {
devinfo, err := getInfo(devname)
devinfo, err := devicemapper.GetInfo(devname)
if err != nil {
// If there is an error we assume the device doesn't exist.
// The error might actually be something else, but we can't differentiate.
@ -877,7 +880,7 @@ func (devices *DeviceSet) waitRemove(devname string) error {
func (devices *DeviceSet) waitClose(info *DevInfo) error {
i := 0
for ; i < 1000; i++ {
devinfo, err := getInfo(info.Name())
devinfo, err := devicemapper.GetInfo(info.Name())
if err != nil {
return err
}
@ -898,7 +901,6 @@ func (devices *DeviceSet) waitClose(info *DevInfo) error {
}
func (devices *DeviceSet) Shutdown() error {
log.Debugf("[deviceset %s] shutdown()", devices.devicePrefix)
log.Debugf("[devmapper] Shutting down DeviceSet: %s", devices.root)
defer log.Debugf("[deviceset %s] shutdown END", devices.devicePrefix)
@ -1065,7 +1067,7 @@ func (devices *DeviceSet) HasActivatedDevice(hash string) bool {
devices.Lock()
defer devices.Unlock()
devinfo, _ := getInfo(info.Name())
devinfo, _ := devicemapper.GetInfo(info.Name())
return devinfo != nil && devinfo.Exists != 0
}
@ -1087,7 +1089,7 @@ func (devices *DeviceSet) List() []string {
func (devices *DeviceSet) deviceStatus(devName string) (sizeInSectors, mappedSectors, highestMappedSector uint64, err error) {
var params string
_, sizeInSectors, _, params, err = getStatus(devName)
_, sizeInSectors, _, params, err = devicemapper.GetStatus(devName)
if err != nil {
return
}
@ -1132,7 +1134,7 @@ func (devices *DeviceSet) GetDeviceStatus(hash string) (*DevStatus, error) {
func (devices *DeviceSet) poolStatus() (totalSizeInSectors, transactionId, dataUsed, dataTotal, metadataUsed, metadataTotal uint64, err error) {
var params string
if _, totalSizeInSectors, _, params, err = getStatus(devices.getPoolName()); err == nil {
if _, totalSizeInSectors, _, params, err = devicemapper.GetStatus(devices.getPoolName()); err == nil {
_, err = fmt.Sscanf(params, "%d %d/%d %d/%d", &transactionId, &metadataUsed, &metadataTotal, &dataUsed, &dataTotal)
}
return
@ -1175,7 +1177,7 @@ func (devices *DeviceSet) Status() *Status {
}
func NewDeviceSet(root string, doInit bool, options []string) (*DeviceSet, error) {
SetDevDir("/dev")
devicemapper.SetDevDir("/dev")
devices := &DeviceSet{
root: root,

View file

@ -10,6 +10,7 @@ import (
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/graphdriver"
"github.com/docker/docker/pkg/devicemapper"
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/units"
)
@ -63,7 +64,7 @@ func (d *Driver) Status() [][2]string {
{"Metadata Space Used", fmt.Sprintf("%s", units.HumanSize(int64(s.Metadata.Used)))},
{"Metadata Space Total", fmt.Sprintf("%s", units.HumanSize(int64(s.Metadata.Total)))},
}
if vStr, err := GetLibraryVersion(); err == nil {
if vStr, err := devicemapper.GetLibraryVersion(); err == nil {
status = append(status, [2]string{"Library Version", vStr})
}
return status

View file

@ -1,6 +1,6 @@
// +build linux
package devmapper
package devicemapper
import (
"fmt"
@ -84,7 +84,7 @@ func openNextAvailableLoopback(index int, sparseFile *os.File) (loopFile *os.Fil
// attachLoopDevice attaches the given sparse file to the next
// available loopback device. It returns an opened *os.File.
func attachLoopDevice(sparseName string) (loop *os.File, err error) {
func AttachLoopDevice(sparseName string) (loop *os.File, err error) {
// Try to retrieve the next available loopback device via syscall.
// If it fails, we discard error and start loopking for a

View file

@ -1,6 +1,6 @@
// +build linux
package devmapper
package devicemapper
import (
"errors"
@ -13,7 +13,7 @@ import (
)
type DevmapperLogger interface {
log(level int, file string, line int, dmError int, message string)
DMLog(level int, file string, line int, dmError int, message string)
}
const (
@ -272,7 +272,8 @@ func LogInitVerbose(level int) {
var dmLogger DevmapperLogger = nil
func logInit(logger DevmapperLogger) {
// initialize the logger for the device mapper library
func LogInit(logger DevmapperLogger) {
dmLogger = logger
LogWithErrnoInit()
}
@ -295,6 +296,7 @@ func GetLibraryVersion() (string, error) {
// Useful helper for cleanup
func RemoveDevice(name string) error {
// TODO(vbatts) just use the other removeDevice()
task := TaskCreate(DeviceRemove)
if task == nil {
return ErrCreateRemoveTask
@ -342,7 +344,7 @@ func BlockDeviceDiscard(path string) error {
}
// This is the programmatic example of "dmsetup create"
func createPool(poolName string, dataFile, metadataFile *os.File, poolBlockSize uint32) error {
func CreatePool(poolName string, dataFile, metadataFile *os.File, poolBlockSize uint32) error {
task, err := createTask(DeviceCreate, poolName)
if task == nil {
return err
@ -364,7 +366,7 @@ func createPool(poolName string, dataFile, metadataFile *os.File, poolBlockSize
}
if err := task.Run(); err != nil {
return fmt.Errorf("Error running DeviceCreate (createPool) %s", err)
return fmt.Errorf("Error running DeviceCreate (CreatePool) %s", err)
}
UdevWait(cookie)
@ -372,7 +374,7 @@ func createPool(poolName string, dataFile, metadataFile *os.File, poolBlockSize
return nil
}
func reloadPool(poolName string, dataFile, metadataFile *os.File, poolBlockSize uint32) error {
func ReloadPool(poolName string, dataFile, metadataFile *os.File, poolBlockSize uint32) error {
task, err := createTask(DeviceReload, poolName)
if task == nil {
return err
@ -406,7 +408,7 @@ func createTask(t TaskType, name string) (*Task, error) {
return task, nil
}
func getDeps(name string) (*Deps, error) {
func GetDeps(name string) (*Deps, error) {
task, err := createTask(DeviceDeps, name)
if task == nil {
return nil, err
@ -417,7 +419,7 @@ func getDeps(name string) (*Deps, error) {
return task.GetDeps()
}
func getInfo(name string) (*Info, error) {
func GetInfo(name string) (*Info, error) {
task, err := createTask(DeviceInfo, name)
if task == nil {
return nil, err
@ -428,7 +430,7 @@ func getInfo(name string) (*Info, error) {
return task.GetInfo()
}
func getDriverVersion() (string, error) {
func GetDriverVersion() (string, error) {
task := TaskCreate(DeviceVersion)
if task == nil {
return "", fmt.Errorf("Can't create DeviceVersion task")
@ -439,24 +441,24 @@ func getDriverVersion() (string, error) {
return task.GetDriverVersion()
}
func getStatus(name string) (uint64, uint64, string, string, error) {
func GetStatus(name string) (uint64, uint64, string, string, error) {
task, err := createTask(DeviceStatus, name)
if task == nil {
log.Debugf("getStatus: Error createTask: %s", err)
log.Debugf("GetStatus: Error createTask: %s", err)
return 0, 0, "", "", err
}
if err := task.Run(); err != nil {
log.Debugf("getStatus: Error Run: %s", err)
log.Debugf("GetStatus: Error Run: %s", err)
return 0, 0, "", "", err
}
devinfo, err := task.GetInfo()
if err != nil {
log.Debugf("getStatus: Error GetInfo: %s", err)
log.Debugf("GetStatus: Error GetInfo: %s", err)
return 0, 0, "", "", err
}
if devinfo.Exists == 0 {
log.Debugf("getStatus: Non existing device %s", name)
log.Debugf("GetStatus: Non existing device %s", name)
return 0, 0, "", "", fmt.Errorf("Non existing device %s", name)
}
@ -464,7 +466,7 @@ func getStatus(name string) (uint64, uint64, string, string, error) {
return start, length, targetType, params, nil
}
func setTransactionId(poolName string, oldId uint64, newId uint64) error {
func SetTransactionId(poolName string, oldId uint64, newId uint64) error {
task, err := createTask(DeviceTargetMsg, poolName)
if task == nil {
return err
@ -479,12 +481,12 @@ func setTransactionId(poolName string, oldId uint64, newId uint64) error {
}
if err := task.Run(); err != nil {
return fmt.Errorf("Error running setTransactionId %s", err)
return fmt.Errorf("Error running SetTransactionId %s", err)
}
return nil
}
func suspendDevice(name string) error {
func SuspendDevice(name string) error {
task, err := createTask(DeviceSuspend, name)
if task == nil {
return err
@ -495,7 +497,7 @@ func suspendDevice(name string) error {
return nil
}
func resumeDevice(name string) error {
func ResumeDevice(name string) error {
task, err := createTask(DeviceResume, name)
if task == nil {
return err
@ -515,8 +517,8 @@ func resumeDevice(name string) error {
return nil
}
func createDevice(poolName string, deviceId *int) error {
log.Debugf("[devmapper] createDevice(poolName=%v, deviceId=%v)", poolName, *deviceId)
func CreateDevice(poolName string, deviceId *int) error {
log.Debugf("[devmapper] CreateDevice(poolName=%v, deviceId=%v)", poolName, *deviceId)
for {
task, err := createTask(DeviceTargetMsg, poolName)
@ -539,14 +541,14 @@ func createDevice(poolName string, deviceId *int) error {
*deviceId++
continue
}
return fmt.Errorf("Error running createDevice %s", err)
return fmt.Errorf("Error running CreateDevice %s", err)
}
break
}
return nil
}
func deleteDevice(poolName string, deviceId int) error {
func DeleteDevice(poolName string, deviceId int) error {
task, err := createTask(DeviceTargetMsg, poolName)
if task == nil {
return err
@ -561,14 +563,14 @@ func deleteDevice(poolName string, deviceId int) error {
}
if err := task.Run(); err != nil {
return fmt.Errorf("Error running deleteDevice %s", err)
return fmt.Errorf("Error running DeleteDevice %s", err)
}
return nil
}
func removeDevice(name string) error {
log.Debugf("[devmapper] removeDevice START")
defer log.Debugf("[devmapper] removeDevice END")
log.Debugf("[devmapper] RemoveDevice START")
defer log.Debugf("[devmapper] RemoveDevice END")
task, err := createTask(DeviceRemove, name)
if task == nil {
return err
@ -578,12 +580,12 @@ func removeDevice(name string) error {
if dmSawBusy {
return ErrBusy
}
return fmt.Errorf("Error running removeDevice %s", err)
return fmt.Errorf("Error running RemoveDevice %s", err)
}
return nil
}
func activateDevice(poolName string, name string, deviceId int, size uint64) error {
func ActivateDevice(poolName string, name string, deviceId int, size uint64) error {
task, err := createTask(DeviceCreate, name)
if task == nil {
return err
@ -603,7 +605,7 @@ func activateDevice(poolName string, name string, deviceId int, size uint64) err
}
if err := task.Run(); err != nil {
return fmt.Errorf("Error running DeviceCreate (activateDevice) %s", err)
return fmt.Errorf("Error running DeviceCreate (ActivateDevice) %s", err)
}
UdevWait(cookie)
@ -611,12 +613,12 @@ func activateDevice(poolName string, name string, deviceId int, size uint64) err
return nil
}
func createSnapDevice(poolName string, deviceId *int, baseName string, baseDeviceId int) error {
devinfo, _ := getInfo(baseName)
func CreateSnapDevice(poolName string, deviceId *int, baseName string, baseDeviceId int) error {
devinfo, _ := GetInfo(baseName)
doSuspend := devinfo != nil && devinfo.Exists != 0
if doSuspend {
if err := suspendDevice(baseName); err != nil {
if err := SuspendDevice(baseName); err != nil {
return err
}
}
@ -625,21 +627,21 @@ func createSnapDevice(poolName string, deviceId *int, baseName string, baseDevic
task, err := createTask(DeviceTargetMsg, poolName)
if task == nil {
if doSuspend {
resumeDevice(baseName)
ResumeDevice(baseName)
}
return err
}
if err := task.SetSector(0); err != nil {
if doSuspend {
resumeDevice(baseName)
ResumeDevice(baseName)
}
return fmt.Errorf("Can't set sector %s", err)
}
if err := task.SetMessage(fmt.Sprintf("create_snap %d %d", *deviceId, baseDeviceId)); err != nil {
if doSuspend {
resumeDevice(baseName)
ResumeDevice(baseName)
}
return fmt.Errorf("Can't set message %s", err)
}
@ -653,7 +655,7 @@ func createSnapDevice(poolName string, deviceId *int, baseName string, baseDevic
}
if doSuspend {
resumeDevice(baseName)
ResumeDevice(baseName)
}
return fmt.Errorf("Error running DeviceCreate (createSnapDevice) %s", err)
}
@ -662,7 +664,7 @@ func createSnapDevice(poolName string, deviceId *int, baseName string, baseDevic
}
if doSuspend {
if err := resumeDevice(baseName); err != nil {
if err := ResumeDevice(baseName); err != nil {
return err
}
}

View file

@ -1,6 +1,6 @@
// +build linux
package devmapper
package devicemapper
import "C"
@ -25,6 +25,6 @@ func DevmapperLogCallback(level C.int, file *C.char, line C.int, dm_errno_or_cla
}
if dmLogger != nil {
dmLogger.log(int(level), C.GoString(file), int(line), int(dm_errno_or_class), msg)
dmLogger.DMLog(int(level), C.GoString(file), int(line), int(dm_errno_or_class), msg)
}
}

View file

@ -1,6 +1,6 @@
// +build linux
package devmapper
package devicemapper
/*
#cgo LDFLAGS: -L. -ldevmapper

View file

@ -1,6 +1,6 @@
// +build linux
package devmapper
package devicemapper
import (
"syscall"