github.com/wlan0/docker@v1.5.0/pkg/devicemapper/devmapper_log.go (about) 1 // +build linux 2 3 package devicemapper 4 5 import "C" 6 7 import ( 8 "strings" 9 ) 10 11 // Due to the way cgo works this has to be in a separate file, as devmapper.go has 12 // definitions in the cgo block, which is incompatible with using "//export" 13 14 //export DevmapperLogCallback 15 func DevmapperLogCallback(level C.int, file *C.char, line C.int, dm_errno_or_class C.int, message *C.char) { 16 msg := C.GoString(message) 17 if level < 7 { 18 if strings.Contains(msg, "busy") { 19 dmSawBusy = true 20 } 21 22 if strings.Contains(msg, "File exists") { 23 dmSawExist = true 24 } 25 } 26 27 if dmLogger != nil { 28 dmLogger.DMLog(int(level), C.GoString(file), int(line), int(dm_errno_or_class), msg) 29 } 30 }