devicemapper: API for checking cookie support

Signed-off-by: Vincent Batts <vbatts@redhat.com>
This commit is contained in:
Vincent Batts 2015-01-19 15:31:54 -05:00
parent 13fc8f758d
commit 650ca7d915
2 changed files with 12 additions and 0 deletions

View file

@ -339,6 +339,13 @@ func UdevSetSyncSupport(enable bool) bool {
return UdevSyncSupported() 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 // Useful helper for cleanup
func RemoveDevice(name string) error { func RemoveDevice(name string) error {
log.Debugf("[devmapper] RemoveDevice START") log.Debugf("[devmapper] RemoveDevice START")

View file

@ -109,6 +109,7 @@ var (
DmUdevWait = dmUdevWaitFct DmUdevWait = dmUdevWaitFct
DmUdevSetSyncSupport = dmUdevSetSyncSupportFct DmUdevSetSyncSupport = dmUdevSetSyncSupportFct
DmUdevGetSyncSupport = dmUdevGetSyncSupportFct DmUdevGetSyncSupport = dmUdevGetSyncSupportFct
DmCookieSupported = dmCookieSupportedFct
LogWithErrnoInit = logWithErrnoInitFct LogWithErrnoInit = logWithErrnoInitFct
) )
@ -245,6 +246,10 @@ func dmUdevWaitFct(cookie uint) int {
return int(C.dm_udev_wait(C.uint32_t(cookie))) return int(C.dm_udev_wait(C.uint32_t(cookie)))
} }
func dmCookieSupportedFct() int {
return int(C.dm_cookie_supported())
}
func dmLogInitVerboseFct(level int) { func dmLogInitVerboseFct(level int) {
C.dm_log_init_verbose(C.int(level)) C.dm_log_init_verbose(C.int(level))
} }