func (constor *Constor) Lookup(header *fuse.InHeader, name string, out *fuse.EntryOut) fuse.Status { var stat syscall.Stat_t if len(name) > 255 { constor.error("name too long : %s", name) return fuse.Status(syscall.ENAMETOOLONG) } li := -1 parent := constor.inodemap.findInodePtr(header.NodeId) if parent == nil { constor.error("Unable to find parent inode : %d", header.NodeId) return fuse.ENOENT } constor.log("%s(%s)", parent.id, name) id, err := constor.getid(-1, parent.id, name) if err != nil { // logging this error will produce too many logs as there will be too many // lookps on non-existant files return fuse.ToStatus(err) } inode := constor.inodemap.findInodeId(id) if inode != nil { li = inode.layer } else { li = constor.getLayer(id) } if li == -1 { constor.error("Unable to find inode for %s(%s) id %s", parent.id, name, id) return fuse.ENOENT } err = constor.Lstat(li, id, &stat) if err != nil { constor.error("Unable to Lstat inode for %s(%s) id %s", parent.id, name, id) return fuse.ToStatus(err) } if inode == nil { inode = NewInode(constor, id) inode.layer = li constor.inodemap.hashInode(inode) } else { inode.lookup() } attr := (*fuse.Attr)(&out.Attr) attr.FromStat(&stat) out.NodeId = uint64(uintptr(unsafe.Pointer(inode))) out.Ino = attr.Ino out.EntryValid = 1000 out.AttrValid = 1000 constor.log("%s", id) return fuse.OK }