github.com/jingleWang/moby@v1.13.1/pkg/loopback/loop_wrapper.go (about) 1 // +build linux 2 3 package loopback 4 5 /* 6 #include <linux/loop.h> // FIXME: present only for defines, maybe we can remove it? 7 8 #ifndef LOOP_CTL_GET_FREE 9 #define LOOP_CTL_GET_FREE 0x4C82 10 #endif 11 12 #ifndef LO_FLAGS_PARTSCAN 13 #define LO_FLAGS_PARTSCAN 8 14 #endif 15 16 */ 17 import "C" 18 19 type loopInfo64 struct { 20 loDevice uint64 /* ioctl r/o */ 21 loInode uint64 /* ioctl r/o */ 22 loRdevice uint64 /* ioctl r/o */ 23 loOffset uint64 24 loSizelimit uint64 /* bytes, 0 == max available */ 25 loNumber uint32 /* ioctl r/o */ 26 loEncryptType uint32 27 loEncryptKeySize uint32 /* ioctl w/o */ 28 loFlags uint32 /* ioctl r/o */ 29 loFileName [LoNameSize]uint8 30 loCryptName [LoNameSize]uint8 31 loEncryptKey [LoKeySize]uint8 /* ioctl w/o */ 32 loInit [2]uint64 33 } 34 35 // IOCTL consts 36 const ( 37 LoopSetFd = C.LOOP_SET_FD 38 LoopCtlGetFree = C.LOOP_CTL_GET_FREE 39 LoopGetStatus64 = C.LOOP_GET_STATUS64 40 LoopSetStatus64 = C.LOOP_SET_STATUS64 41 LoopClrFd = C.LOOP_CLR_FD 42 LoopSetCapacity = C.LOOP_SET_CAPACITY 43 ) 44 45 // LOOP consts. 46 const ( 47 LoFlagsAutoClear = C.LO_FLAGS_AUTOCLEAR 48 LoFlagsReadOnly = C.LO_FLAGS_READ_ONLY 49 LoFlagsPartScan = C.LO_FLAGS_PARTSCAN 50 LoKeySize = C.LO_KEY_SIZE 51 LoNameSize = C.LO_NAME_SIZE 52 )