summaryrefslogtreecommitdiff
path: root/internal/fusefrontend/node_dir_ops.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-07-05 19:33:50 +0200
committerJakob Unterwurzacher2020-07-05 19:34:30 +0200
commitc22e78ee41f4c5a91429bb83c6be3e60b4c2a20f (patch)
treed4877bd95f2974d45d708245e80946a39bea6fd0 /internal/fusefrontend/node_dir_ops.go
parent1f4e554168a25151e0c21375921376fd2b6c53de (diff)
v2api: implement Opendir
Diffstat (limited to 'internal/fusefrontend/node_dir_ops.go')
-rw-r--r--internal/fusefrontend/node_dir_ops.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/internal/fusefrontend/node_dir_ops.go b/internal/fusefrontend/node_dir_ops.go
index 8aa79ba..32e5e86 100644
--- a/internal/fusefrontend/node_dir_ops.go
+++ b/internal/fusefrontend/node_dir_ops.go
@@ -348,3 +348,20 @@ retry:
}
return 0
}
+
+// Opendir is a FUSE call to check if the directory can be opened.
+func (n *Node) Opendir(ctx context.Context) (errno syscall.Errno) {
+ dirfd, cName, errno := n.prepareAtSyscall("")
+ if errno != 0 {
+ return
+ }
+ defer syscall.Close(dirfd)
+
+ // Open backing directory
+ fd, err := syscallcompat.Openat(dirfd, cName, syscall.O_RDONLY|syscall.O_DIRECTORY, 0)
+ if err != nil {
+ return fs.ToErrno(err)
+ }
+ syscall.Close(fd)
+ return 0
+}