diff --git a/src/sys/ubixfs/dirCache.c b/src/sys/ubixfs/dirCache.c index 8e0fc27..c064eca 100644 --- a/src/sys/ubixfs/dirCache.c +++ b/src/sys/ubixfs/dirCache.c @@ -37,10 +37,11 @@ struct cacheNode * ubixfs_dirCacheFind(struct cacheNode * head, char * name) { struct cacheNode * tmp = head; - unsigned int i; + struct directoryEntry * dirList = NULL; + unsigned int i = 0x0; char dirName[256]; char * nextDir = NULL; - + if (name == NULL || head == NULL) return NULL; if (*name == '\0') return NULL; @@ -75,7 +76,15 @@ return ubixfs_dirCacheFind(tmp->subDirsHead, nextDir); tmp = tmp->next; } /* while */ + tmp = tmp->parent; + assert(tmp->info); /* if we're here, then one level of the dir isn't cached */ + dirList = (struct directoryEntry *)tmp->info; + for (i = 0; i < tmp->dirListEntryCount; i++) { + if (strcmp(dirList[i].fileName, nextDir) != 0) { + ubixfs_dirCacheAdd(tmp, ubixfs_dirCacheNew(dirList[i].fileName)); + } /* if */ + } /* for */ return NULL; } /* if */