github.com/ph/moby@v1.13.1/pkg/devicemapper/devmapper_wrapper_deferred_remove.go (about)

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