forked from TrueCloudLab/rclone
lib/file: add Implemented constants
This commit is contained in:
parent
919a180ad2
commit
5cb2a2fa3c
3 changed files with 24 additions and 0 deletions
|
@ -4,11 +4,19 @@ package file
|
||||||
|
|
||||||
import "os"
|
import "os"
|
||||||
|
|
||||||
|
// PreallocateImplemented is a constant indicating whether the
|
||||||
|
// implementation of Preallocate actually does anything.
|
||||||
|
const PreallocateImplemented = false
|
||||||
|
|
||||||
// PreAllocate the file for performance reasons
|
// PreAllocate the file for performance reasons
|
||||||
func PreAllocate(size int64, out *os.File) error {
|
func PreAllocate(size int64, out *os.File) error {
|
||||||
return nil
|
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
|
// SetSparse makes the file be a sparse file
|
||||||
func SetSparse(out *os.File) error {
|
func SetSparse(out *os.File) error {
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -18,6 +18,10 @@ var (
|
||||||
fallocFlagsIndex int32
|
fallocFlagsIndex int32
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// PreallocateImplemented is a constant indicating whether the
|
||||||
|
// implementation of Preallocate actually does anything.
|
||||||
|
const PreallocateImplemented = true
|
||||||
|
|
||||||
// PreAllocate the file for performance reasons
|
// PreAllocate the file for performance reasons
|
||||||
func PreAllocate(size int64, out *os.File) error {
|
func PreAllocate(size int64, out *os.File) error {
|
||||||
if size <= 0 {
|
if size <= 0 {
|
||||||
|
@ -45,6 +49,10 @@ again:
|
||||||
return err
|
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
|
// SetSparse makes the file be a sparse file
|
||||||
func SetSparse(out *os.File) error {
|
func SetSparse(out *os.File) error {
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -32,6 +32,10 @@ type ioStatusBlock struct {
|
||||||
Status, Information uintptr
|
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
|
// PreAllocate the file for performance reasons
|
||||||
func PreAllocate(size int64, out *os.File) error {
|
func PreAllocate(size int64, out *os.File) error {
|
||||||
if size <= 0 {
|
if size <= 0 {
|
||||||
|
@ -82,6 +86,10 @@ const (
|
||||||
FSCTL_SET_SPARSE = 0x000900c4
|
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
|
// SetSparse makes the file be a sparse file
|
||||||
func SetSparse(out *os.File) error {
|
func SetSparse(out *os.File) error {
|
||||||
err := syscall.DeviceIoControl(syscall.Handle(out.Fd()), FSCTL_SET_SPARSE, nil, 0, nil, 0, nil, nil)
|
err := syscall.DeviceIoControl(syscall.Handle(out.Fd()), FSCTL_SET_SPARSE, nil, 0, nil, 0, nil, nil)
|
||||||
|
|
Loading…
Reference in a new issue