diff options
author | Jakob Unterwurzacher | 2020-07-05 19:33:50 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2020-07-05 19:34:30 +0200 |
commit | c22e78ee41f4c5a91429bb83c6be3e60b4c2a20f (patch) | |
tree | d4877bd95f2974d45d708245e80946a39bea6fd0 /internal/fusefrontend/node_dir_ops.go | |
parent | 1f4e554168a25151e0c21375921376fd2b6c53de (diff) |
v2api: implement Opendir
Diffstat (limited to 'internal/fusefrontend/node_dir_ops.go')
-rw-r--r-- | internal/fusefrontend/node_dir_ops.go | 17 |
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 +} |