aboutsummaryrefslogtreecommitdiff
path: root/internal/syscallcompat/getdents_other.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2017-08-13 21:13:44 +0200
committerJakob Unterwurzacher2017-08-15 19:03:57 +0200
commite50a6a57e57bc3cc925ba9a6e7f4dc1da4da3c84 (patch)
tree79df16efd4d2474502a0e5116a4ee9599a33daee /internal/syscallcompat/getdents_other.go
parentaffb1c2f6617d66bdc9fda41b017e0de000c3691 (diff)
syscallcompat: implement Getdents()
The Readdir function provided by os is inherently slow because it calls Lstat on all files. Getdents gives us all the information we need, but does not have a proper wrapper in the stdlib. Implement the "Getdents()" wrapper function that calls syscall.Getdents() and parses the returned byte blob to a fuse.DirEntry slice.
Diffstat (limited to 'internal/syscallcompat/getdents_other.go')
-rw-r--r--internal/syscallcompat/getdents_other.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/internal/syscallcompat/getdents_other.go b/internal/syscallcompat/getdents_other.go
new file mode 100644
index 0000000..4ef5b8f
--- /dev/null
+++ b/internal/syscallcompat/getdents_other.go
@@ -0,0 +1,17 @@
+// +build !linux
+
+package syscallcompat
+
+import (
+ "log"
+
+ "github.com/hanwen/go-fuse/fuse"
+)
+
+// HaveGetdents is true if we have a working implementation of Getdents
+const HaveGetdents = false
+
+func Getdents(dir string) ([]fuse.DirEntry, error) {
+ log.Panic("only implemented on Linux")
+ return nil, nil
+}