::Node* TarFS::Directory::Lookup(const char* name, bool traverseLinks) { TarFS::Entry* entry = LookupEntry(name); if (!entry) return NULL; Node* node = entry->ToNode(); if (traverseLinks) { if (S_ISLNK(node->Type())) { Symlink* symlink = static_cast<Symlink*>(node); int fd = open_from(this, symlink->LinkPath(), O_RDONLY); if (fd >= 0) { node = get_node_from(fd); close(fd); } } } if (node) node->Acquire(); return node; }
status_t TarFS::Directory::GetNextNode(void* _cookie, Node** _node) { EntryIterator* iterator = (EntryIterator*)_cookie; TarFS::Entry* entry = iterator->Next(); if (entry != NULL) { *_node = entry->ToNode(); return B_OK; } return B_ENTRY_NOT_FOUND; }
::Node* TarFS::Directory::LookupDontTraverse(const char* name) { TarFS::Entry* entry = LookupEntry(name); if (!entry) return NULL; Node* node = entry->ToNode(); if (node) node->Acquire(); return node; }