github.com/torfuzx/docker@v1.8.1/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 if strings.Contains(msg, "No such device or address") { 27 dmSawEnxio = true 28 } 29 } 30 31 if dmLogger != nil { 32 dmLogger.DMLog(int(level), C.GoString(file), int(line), int(dm_errno_or_class), msg) 33 } 34 }