Browse code

devicemapper: API for checking cookie support

Signed-off-by: Vincent Batts <vbatts@redhat.com>

Vincent Batts authored on 2015/01/20 05:31:54
Showing 2 changed files
... ...
@@ -339,6 +339,13 @@ func UdevSetSyncSupport(enable bool) bool {
339 339
 	return UdevSyncSupported()
340 340
 }
341 341
 
342
+// CookieSupported returns whether the version of device-mapper supports the
343
+// use of cookie's in the tasks.
344
+// This is largely a lower level call that other functions use.
345
+func CookieSupported() bool {
346
+	return DmCookieSupported() != 0
347
+}
348
+
342 349
 // Useful helper for cleanup
343 350
 func RemoveDevice(name string) error {
344 351
 	log.Debugf("[devmapper] RemoveDevice START")
... ...
@@ -109,6 +109,7 @@ var (
109 109
 	DmUdevWait             = dmUdevWaitFct
110 110
 	DmUdevSetSyncSupport   = dmUdevSetSyncSupportFct
111 111
 	DmUdevGetSyncSupport   = dmUdevGetSyncSupportFct
112
+	DmCookieSupported      = dmCookieSupportedFct
112 113
 	LogWithErrnoInit       = logWithErrnoInitFct
113 114
 )
114 115
 
... ...
@@ -245,6 +246,10 @@ func dmUdevWaitFct(cookie uint) int {
245 245
 	return int(C.dm_udev_wait(C.uint32_t(cookie)))
246 246
 }
247 247
 
248
+func dmCookieSupportedFct() int {
249
+	return int(C.dm_cookie_supported())
250
+}
251
+
248 252
 func dmLogInitVerboseFct(level int) {
249 253
 	C.dm_log_init_verbose(C.int(level))
250 254
 }