github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/pkg/devicemapper/devmapper_wrapper_dynamic_deferred_remove.go (about)

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