v2api: implement Opendir
This commit is contained in:
parent
1f4e554168
commit
c22e78ee41
@ -14,3 +14,4 @@ var _ = (fs.NodeRmdirer)((*Node)(nil))
|
||||
var _ = (fs.NodeUnlinker)((*Node)(nil))
|
||||
var _ = (fs.NodeReadlinker)((*Node)(nil))
|
||||
var _ = (fs.NodeOpener)((*Node)(nil))
|
||||
var _ = (fs.NodeOpendirer)((*Node)(nil))
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user