diff --git a/lib/file/preallocate_other.go b/lib/file/preallocate_other.go index 5eae4ceab..87b01799e 100644 --- a/lib/file/preallocate_other.go +++ b/lib/file/preallocate_other.go @@ -4,11 +4,19 @@ package file import "os" +// PreallocateImplemented is a constant indicating whether the +// implementation of Preallocate actually does anything. +const PreallocateImplemented = false + // PreAllocate the file for performance reasons func PreAllocate(size int64, out *os.File) error { return nil } +// SetSparseImplemented is a constant indicating whether the +// implementation of SetSparse actually does anything. +const SetSparseImplemented = false + // SetSparse makes the file be a sparse file func SetSparse(out *os.File) error { return nil diff --git a/lib/file/preallocate_unix.go b/lib/file/preallocate_unix.go index 0bdd25ee5..8c3df5238 100644 --- a/lib/file/preallocate_unix.go +++ b/lib/file/preallocate_unix.go @@ -18,6 +18,10 @@ var ( fallocFlagsIndex int32 ) +// PreallocateImplemented is a constant indicating whether the +// implementation of Preallocate actually does anything. +const PreallocateImplemented = true + // PreAllocate the file for performance reasons func PreAllocate(size int64, out *os.File) error { if size <= 0 { @@ -45,6 +49,10 @@ again: return err } +// SetSparseImplemented is a constant indicating whether the +// implementation of SetSparse actually does anything. +const SetSparseImplemented = false + // SetSparse makes the file be a sparse file func SetSparse(out *os.File) error { return nil diff --git a/lib/file/preallocate_windows.go b/lib/file/preallocate_windows.go index f956536f7..f238c5c73 100644 --- a/lib/file/preallocate_windows.go +++ b/lib/file/preallocate_windows.go @@ -32,6 +32,10 @@ type ioStatusBlock struct { Status, Information uintptr } +// PreallocateImplemented is a constant indicating whether the +// implementation of Preallocate actually does anything. +const PreallocateImplemented = true + // PreAllocate the file for performance reasons func PreAllocate(size int64, out *os.File) error { if size <= 0 { @@ -82,6 +86,10 @@ const ( FSCTL_SET_SPARSE = 0x000900c4 ) +// SetSparseImplemented is a constant indicating whether the +// implementation of SetSparse actually does anything. +const SetSparseImplemented = true + // SetSparse makes the file be a sparse file func SetSparse(out *os.File) error { err := syscall.DeviceIoControl(syscall.Handle(out.Fd()), FSCTL_SET_SPARSE, nil, 0, nil, 0, nil, nil)