func (n *pathInode) GetAttr(out *fuse.Attr, file nodefs.File, context *fuse.Context) (code fuse.Status) { var fi *fuse.Attr if file == nil { // called on a deleted files. file = n.Inode().AnyFile() } if file != nil { code = file.GetAttr(out) } if file == nil || code == fuse.ENOSYS || code == fuse.EBADF { fi, code = n.fs.GetAttr(n.GetPath(), context) } if fi != nil { n.setClientInode(fi.Ino) } if fi != nil && !fi.IsDir() && fi.Nlink == 0 { fi.Nlink = 1 } if fi != nil { *out = *fi } return code }
func (n *pathInode) findChild(fi *fuse.Attr, name string, fullPath string) (out *pathInode) { if fi.Ino > 0 { unlock := n.RLockTree() v := n.pathFs.clientInodeMap[fi.Ino] if len(v) > 0 { out = v[0].node if fi.Nlink == 1 { log.Println("Found linked inode, but Nlink == 1", fullPath) } } unlock() } if out == nil { out = n.createChild(name, fi.IsDir()) out.clientInode = fi.Ino n.addChild(name, out) } else { // should add 'out' as a child to n ? } return out }