|
@@ -4,12 +4,23 @@ package devmapper
|
|
|
|
|
|
import "C"
|
|
import "C"
|
|
|
|
|
|
|
|
+import (
|
|
|
|
+ "strings"
|
|
|
|
+)
|
|
|
|
+
|
|
// Due to the way cgo works this has to be in a separate file, as devmapper.go has
|
|
// 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"
|
|
// definitions in the cgo block, which is incompatible with using "//export"
|
|
|
|
|
|
//export DevmapperLogCallback
|
|
//export DevmapperLogCallback
|
|
func DevmapperLogCallback(level C.int, file *C.char, line C.int, dm_errno_or_class C.int, message *C.char) {
|
|
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 dmLogger != nil {
|
|
if dmLogger != nil {
|
|
- dmLogger.log(int(level), C.GoString(file), int(line), int(dm_errno_or_class), C.GoString(message))
|
|
|
|
|
|
+ dmLogger.log(int(level), C.GoString(file), int(line), int(dm_errno_or_class), msg)
|
|
}
|
|
}
|
|
}
|
|
}
|