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:
parent
bf0a0e9ca7
commit
a5ad3ec0b7
5 changed files with 1158 additions and 0 deletions
30
devicemapper/devmapper_log.go
Normal file
30
devicemapper/devmapper_log.go
Normal file
|
@ -0,0 +1,30 @@
|
|||
// +build linux
|
||||
|
||||
package devicemapper
|
||||
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Due to the way cgo works this has to be in a separate file, as devmapper.go has
|
||||
// definitions in the cgo block, which is incompatible with using "//export"
|
||||
|
||||
//export DevmapperLogCallback
|
||||
func DevmapperLogCallback(level C.int, file *C.char, line C.int, dm_errno_or_class C.int, message *C.char) {
|
||||
msg := C.GoString(message)
|
||||
if level < 7 {
|
||||
if strings.Contains(msg, "busy") {
|
||||
dmSawBusy = true
|
||||
}
|
||||
|
||||
if strings.Contains(msg, "File exists") {
|
||||
dmSawExist = true
|
||||
}
|
||||
}
|
||||
|
||||
if dmLogger != nil {
|
||||
dmLogger.DMLog(int(level), C.GoString(file), int(line), int(dm_errno_or_class), msg)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue