diff --git a/devicemapper/devmapper.go b/devicemapper/devmapper.go index c0caec5..f3b55c8 100644 --- a/devicemapper/devmapper.go +++ b/devicemapper/devmapper.go @@ -339,6 +339,13 @@ func UdevSetSyncSupport(enable bool) bool { return UdevSyncSupported() } +// CookieSupported returns whether the version of device-mapper supports the +// use of cookie's in the tasks. +// This is largely a lower level call that other functions use. +func CookieSupported() bool { + return DmCookieSupported() != 0 +} + // Useful helper for cleanup func RemoveDevice(name string) error { log.Debugf("[devmapper] RemoveDevice START(%s)", name) diff --git a/devicemapper/devmapper_wrapper.go b/devicemapper/devmapper_wrapper.go index 63c55d9..ae4f30f 100644 --- a/devicemapper/devmapper_wrapper.go +++ b/devicemapper/devmapper_wrapper.go @@ -110,6 +110,7 @@ var ( DmUdevWait = dmUdevWaitFct DmUdevSetSyncSupport = dmUdevSetSyncSupportFct DmUdevGetSyncSupport = dmUdevGetSyncSupportFct + DmCookieSupported = dmCookieSupportedFct LogWithErrnoInit = logWithErrnoInitFct ) @@ -246,6 +247,10 @@ func dmUdevWaitFct(cookie uint) int { return int(C.dm_udev_wait(C.uint32_t(cookie))) } +func dmCookieSupportedFct() int { + return int(C.dm_cookie_supported()) +} + func dmLogInitVerboseFct(level int) { C.dm_log_init_verbose(C.int(level)) }