fn lookup()

in src/fs.rs [310:338]


    fn lookup(&mut self, _req: &Request, parent: Inode, name: &OsStr, reply: ReplyEntry) {
        debug!("lookup(parent={}, name={})", parent, name.to_str().unwrap());

        if let Some(dir_ent) = self.directory_map.read().unwrap().get(&parent) {
            // TODO(boulos): Is this the full name, or just the portion? (I believe just portion)
            let search_name = name.to_str().unwrap().to_string();
            for child_pair in dir_ent.entries.iter() {
                trace!(
                    "  Is search target '{}' == dir_entry '{}'?",
                    search_name,
                    child_pair.0
                );
                if child_pair.0 == search_name {
                    if let Some(attr) = self.inode_to_attr.read().unwrap().get(&child_pair.1) {
                        // Found it! Return the info for the inode.
                        debug!(
                            "  Found it! search target '{}' is inode {}",
                            child_pair.0, child_pair.1
                        );
                        reply.entry(&TTL_30s, &attr, 0);
                        return;
                    }
                }
            }
            debug!("  Never found  '{}'", search_name);
        }

        reply.error(ENOENT);
    }