Skip to content

Commit c81fb7f

Browse files
committed
Merge pull request moby#10197 from vbatts/vbatts-dm_cookie_support
devicemapper: API for cookie support
2 parents e04cc93 + cb81ed3 commit c81fb7f

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

pkg/devicemapper/devmapper.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,13 @@ func UdevSetSyncSupport(enable bool) bool {
339339
return UdevSyncSupported()
340340
}
341341

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+
342349
// Useful helper for cleanup
343350
func RemoveDevice(name string) error {
344351
log.Debugf("[devmapper] RemoveDevice START(%s)", name)

pkg/devicemapper/devmapper_wrapper.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ var (
110110
DmUdevWait = dmUdevWaitFct
111111
DmUdevSetSyncSupport = dmUdevSetSyncSupportFct
112112
DmUdevGetSyncSupport = dmUdevGetSyncSupportFct
113+
DmCookieSupported = dmCookieSupportedFct
113114
LogWithErrnoInit = logWithErrnoInitFct
114115
)
115116

@@ -246,6 +247,10 @@ func dmUdevWaitFct(cookie uint) int {
246247
return int(C.dm_udev_wait(C.uint32_t(cookie)))
247248
}
248249

250+
func dmCookieSupportedFct() int {
251+
return int(C.dm_cookie_supported())
252+
}
253+
249254
func dmLogInitVerboseFct(level int) {
250255
C.dm_log_init_verbose(C.int(level))
251256
}

0 commit comments

Comments
 (0)