sparse_windows.go 307 Bytes
Newer Older
1
2
3
4
5
6
7
8
package server

import (
	"os"

	"golang.org/x/sys/windows"
)

9
10
11
func setSparse(file *os.File) {
	// exFat (and other FS types) don't support sparse files, so ignore errors
	windows.DeviceIoControl( //nolint:errcheck
12
13
14
15
16
17
		windows.Handle(file.Fd()), windows.FSCTL_SET_SPARSE,
		nil, 0,
		nil, 0,
		nil, nil,
	)
}