v2api/reverse: implement Statfs

This commit is contained in:
Jakob Unterwurzacher 2020-08-16 19:41:00 +02:00
parent 6f3cca2cdd
commit 58a2726977
4 changed files with 31 additions and 1 deletions

View File

@ -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
}

View File

@ -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))
*/

View File

@ -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)
}
}

View File

@ -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)
}
}