From e00427dcc615cb199295dac999d7566cd38c3fb2 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys <hanwen@google.com> Date: Mon, 25 Feb 2013 16:04:50 +0100 Subject: [PATCH] Move LoopbackFile.Allocate to linux specific code. --- fuse/files.go | 10 ---------- fuse/files_linux.go | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 fuse/files_linux.go diff --git a/fuse/files.go b/fuse/files.go index cf74f50..96287ea 100644 --- a/fuse/files.go +++ b/fuse/files.go @@ -193,16 +193,6 @@ func (f *LoopbackFile) GetAttr(a *Attr) Status { return OK } -func (f *LoopbackFile) Allocate(off uint64, sz uint64, mode uint32) Status { - f.lock.Lock() - err := syscall.Fallocate(int(f.File.Fd()), mode, int64(off), int64(sz)) - f.lock.Unlock() - if err != nil { - return ToStatus(err) - } - return OK -} - //////////////////////////////////////////////////////////////// // ReadOnlyFile is a wrapper that denies writable operations diff --git a/fuse/files_linux.go b/fuse/files_linux.go new file mode 100644 index 0000000..75709f2 --- /dev/null +++ b/fuse/files_linux.go @@ -0,0 +1,15 @@ +package fuse + +import ( + "syscall" +) + +func (f *LoopbackFile) Allocate(off uint64, sz uint64, mode uint32) Status { + f.lock.Lock() + err := syscall.Fallocate(int(f.File.Fd()), mode, int64(off), int64(sz)) + f.lock.Unlock() + if err != nil { + return ToStatus(err) + } + return OK +} -- 2.30.9