github.com/ttys3/engine@v17.12.1-ce-rc2+incompatible/pkg/devicemapper/devmapper_wrapper_deferred_remove.go (about)

     1  // +build linux,cgo,!libdm_no_deferred_remove
     2  
     3  package devicemapper
     4  
     5  // #include <libdevmapper.h>
     6  import "C"
     7  
     8  // LibraryDeferredRemovalSupport tells if the feature is enabled in the build
     9  const LibraryDeferredRemovalSupport = true
    10  
    11  func dmTaskDeferredRemoveFct(task *cdmTask) int {
    12  	return int(C.dm_task_deferred_remove((*C.struct_dm_task)(task)))
    13  }
    14  
    15  func dmTaskGetInfoWithDeferredFct(task *cdmTask, info *Info) int {
    16  	Cinfo := C.struct_dm_info{}
    17  	defer func() {
    18  		info.Exists = int(Cinfo.exists)
    19  		info.Suspended = int(Cinfo.suspended)
    20  		info.LiveTable = int(Cinfo.live_table)
    21  		info.InactiveTable = int(Cinfo.inactive_table)
    22  		info.OpenCount = int32(Cinfo.open_count)
    23  		info.EventNr = uint32(Cinfo.event_nr)
    24  		info.Major = uint32(Cinfo.major)
    25  		info.Minor = uint32(Cinfo.minor)
    26  		info.ReadOnly = int(Cinfo.read_only)
    27  		info.TargetCount = int32(Cinfo.target_count)
    28  		info.DeferredRemove = int(Cinfo.deferred_remove)
    29  	}()
    30  	return int(C.dm_task_get_info((*C.struct_dm_task)(task), &Cinfo))
    31  }