aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-08-16 19:41:00 +0200
committerJakob Unterwurzacher2020-08-16 19:41:00 +0200
commit58a2726977a1b1f92063a1e51c0769af71833e72 (patch)
tree2c2112205a27c48139fa3700fe093c84b3546e14
parent6f3cca2cdd0265fec4613023c58dfe3378b91b71 (diff)
v2api/reverse: implement Statfs
-rw-r--r--internal/fusefrontend_reverse/node.go14
-rw-r--r--internal/fusefrontend_reverse/node_api_check.go2
-rw-r--r--tests/matrix/matrix_test.go8
-rw-r--r--tests/reverse/correctness_test.go8
4 files changed, 31 insertions, 1 deletions
diff --git a/internal/fusefrontend_reverse/node.go b/internal/fusefrontend_reverse/node.go
index de1ee49..d7748f6 100644
--- a/internal/fusefrontend_reverse/node.go
+++ b/internal/fusefrontend_reverse/node.go
@@ -177,3 +177,17 @@ func (n *Node) Open(ctx context.Context, flags uint32) (fh fs.FileHandle, fuseFl
}
return
}
+
+// StatFs - FUSE call. Returns information about the filesystem.
+//
+// Symlink-safe because the path is ignored.
+func (n *Node) Statfs(ctx context.Context, out *fuse.StatfsOut) syscall.Errno {
+ p := n.rootNode().args.Cipherdir
+ var st syscall.Statfs_t
+ err := syscall.Statfs(p, &st)
+ if err != nil {
+ return fs.ToErrno(err)
+ }
+ out.FromStatfsT(&st)
+ return 0
+}
diff --git a/internal/fusefrontend_reverse/node_api_check.go b/internal/fusefrontend_reverse/node_api_check.go
index c7cb6aa..90b5bdd 100644
--- a/internal/fusefrontend_reverse/node_api_check.go
+++ b/internal/fusefrontend_reverse/node_api_check.go
@@ -10,9 +10,9 @@ var _ = (fs.NodeLookuper)((*Node)(nil))
var _ = (fs.NodeReaddirer)((*Node)(nil))
var _ = (fs.NodeReadlinker)((*Node)(nil))
var _ = (fs.NodeOpener)((*Node)(nil))
+var _ = (fs.NodeStatfser)((*Node)(nil))
/* TODO
-var _ = (fs.NodeStatfser)((*Node)(nil))
var _ = (fs.NodeGetxattrer)((*Node)(nil))
var _ = (fs.NodeListxattrer)((*Node)(nil))
*/
diff --git a/tests/matrix/matrix_test.go b/tests/matrix/matrix_test.go
index 2542844..5e536b3 100644
--- a/tests/matrix/matrix_test.go
+++ b/tests/matrix/matrix_test.go
@@ -873,3 +873,11 @@ func TestAccess(t *testing.T) {
t.Error("X_OK should have failed")
}
}
+
+func TestStatfs(t *testing.T) {
+ var st syscall.Statfs_t
+ syscall.Statfs(test_helpers.DefaultPlainDir, &st)
+ if st.Bsize == 0 {
+ t.Errorf("statfs reports size zero: %#v", st)
+ }
+}
diff --git a/tests/reverse/correctness_test.go b/tests/reverse/correctness_test.go
index 6b7ed5f..78c9c4b 100644
--- a/tests/reverse/correctness_test.go
+++ b/tests/reverse/correctness_test.go
@@ -249,3 +249,11 @@ func Test0100Dir(t *testing.T) {
}
fd.Close()
}
+
+func TestStatfs(t *testing.T) {
+ var st syscall.Statfs_t
+ syscall.Statfs(dirB, &st)
+ if st.Bsize == 0 {
+ t.Errorf("statfs reports size zero: %#v", st)
+ }
+}