Author: bonefish Date: 2010-02-26 23:13:18 +0100 (Fri, 26 Feb 2010) New Revision: 35625 Changeset: http://dev.haiku-os.org/changeset/35625/haiku Modified: haiku/trunk/src/system/kernel/fs/EntryCache.cpp haiku/trunk/src/system/kernel/fs/EntryCache.h Log: Added DebugReverseLookup() method to reverse-lookup directory and entry name for a given vnode (for debugging purposes). Modified: haiku/trunk/src/system/kernel/fs/EntryCache.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/EntryCache.cpp 2010-02-26 14:55:31 UTC (rev 35624) +++ haiku/trunk/src/system/kernel/fs/EntryCache.cpp 2010-02-26 22:13:18 UTC (rev 35625) @@ -204,6 +204,22 @@ } +const char* +EntryCache::DebugReverseLookup(ino_t nodeID, ino_t& _dirID) +{ + for (EntryTable::Iterator it = fEntries.GetIterator(); + EntryCacheEntry* entry = it.Next();) { + if (nodeID == entry->node_id && strcmp(entry->name, ".") != 0 + && strcmp(entry->name, "..") != 0) { + _dirID = entry->dir_id; + return entry->name; + } + } + + return NULL; +} + + void EntryCache::_AddEntryToCurrentGeneration(EntryCacheEntry* entry) { Modified: haiku/trunk/src/system/kernel/fs/EntryCache.h =================================================================== --- haiku/trunk/src/system/kernel/fs/EntryCache.h 2010-02-26 14:55:31 UTC (rev 35624) +++ haiku/trunk/src/system/kernel/fs/EntryCache.h 2010-02-26 22:13:18 UTC (rev 35625) @@ -94,6 +94,8 @@ bool Lookup(ino_t dirID, const char* name, ino_t& nodeID); + const char* DebugReverseLookup(ino_t nodeID, ino_t& _dirID); + private: static const int32 kGenerationCount = 8;