MCPcopy
hub / github.com/git-lfs/git-lfs / callDuplicateExtentsToFile

Function callDuplicateExtentsToFile

tools/util_windows.go:135–157  ·  view source on GitHub ↗

call FSCTL_DUPLICATE_EXTENTS_TO_FILE IOCTL see https://docs.microsoft.com/en-us/windows/win32/api/winioctl/ni-winioctl-fsctl_duplicate_extents_to_file memo: Overflow (cloneRegionSize is greater than file ends) is safe and just ignored by windows.

(dst, src *os.File, offset int64, cloneRegionSize int64)

Source from the content-addressed store, hash-verified

133//
134// memo: Overflow (cloneRegionSize is greater than file ends) is safe and just ignored by windows.
135func callDuplicateExtentsToFile(dst, src *os.File, offset int64, cloneRegionSize int64) (err error) {
136 var (
137 bytesReturned uint32
138 overlapped windows.Overlapped
139 )
140
141 request := duplicateExtentsData{
142 FileHandle: windows.Handle(src.Fd()),
143 SourceFileOffset: offset,
144 TargetFileOffset: offset,
145 ByteCount: cloneRegionSize,
146 }
147
148 return windows.DeviceIoControl(
149 windows.Handle(dst.Fd()),
150 fsctlDuplicateExtentsToFile,
151 (*byte)(unsafe.Pointer(&request)),
152 uint32(unsafe.Sizeof(request)),
153 (*byte)(unsafe.Pointer(nil)), // = nullptr
154 0,
155 &bytesReturned,
156 &overlapped)
157}
158
159func roundUp(value, base int64) int64 {
160 mod := value % base

Callers 1

CloneFileFunction · 0.85

Calls 2

FdMethod · 0.65
PointerMethod · 0.45

Tested by

no test coverage detected