diff --git a/pkg/devicemapper/devmapper.go b/pkg/devicemapper/devmapper.go index 486ec15db7..764971c1ce 100644 --- a/pkg/devicemapper/devmapper.go +++ b/pkg/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") diff --git a/pkg/devicemapper/devmapper_wrapper.go b/pkg/devicemapper/devmapper_wrapper.go index aff8446528..6427968d6f 100644 --- a/pkg/devicemapper/devmapper_wrapper.go +++ b/pkg/devicemapper/devmapper_wrapper.go @@ -109,6 +109,7 @@ var ( DmUdevWait = dmUdevWaitFct DmUdevSetSyncSupport = dmUdevSetSyncSupportFct DmUdevGetSyncSupport = dmUdevGetSyncSupportFct + DmCookieSupported = dmCookieSupportedFct LogWithErrnoInit = logWithErrnoInitFct ) @@ -245,6 +246,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)) }