diff --git a/src/sys/include/ubixfs/dirCache.h b/src/sys/include/ubixfs/dirCache.h index c5d41ee..759b607 100644 --- a/src/sys/include/ubixfs/dirCache.h +++ b/src/sys/include/ubixfs/dirCache.h @@ -8,8 +8,8 @@ struct cacheNode * prev; struct cacheNode * next; struct cacheNode * parent; - struct cacheNode * subDirsHead; - struct cacheNode * subDirsTail; + struct cacheNode * fileListHead; + struct cacheNode * fileListTail; void * info; uInt16 attributes; int dirListEntryCount; diff --git a/src/sys/ubixfs/dirCache.c b/src/sys/ubixfs/dirCache.c index 75ea023..269f8ee 100644 --- a/src/sys/ubixfs/dirCache.c +++ b/src/sys/ubixfs/dirCache.c @@ -73,19 +73,24 @@ if (*nextDir != '\0') { while (tmp != NULL) { if (strcmp(tmp->name, dirName) == 0) - return ubixfs_cacheFind(tmp->subDirsHead, nextDir); + return ubixfs_cacheFind(tmp->fileListHead, nextDir); tmp = tmp->next; } /* while */ + /* if we're here, then one level of the dir isn't cached */ + 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) { +kprintf("creating new node %s\n", dirList[i].fileName); tmp = ubixfs_cacheAdd(tmp, ubixfs_cacheNew(dirList[i].fileName)); tmp->attributes = dirList[i].attributes; + return tmp; } /* if */ } /* for */ + return NULL; } /* if */ @@ -102,18 +107,18 @@ * (if it isn't already) */ assert(tmp->parent); - if (tmp != tmp->parent->subDirsHead) { + if (tmp != tmp->parent->fileListHead) { /* if we're the tail, point the tail to our prev */ - if (tmp == tmp->parent->subDirsTail) { - tmp->parent->subDirsTail = tmp->prev; + if (tmp == tmp->parent->fileListTail) { + tmp->parent->fileListTail = tmp->prev; } /* if */ if (tmp->next != NULL) tmp->next->prev = tmp->prev; if (tmp->prev != NULL) tmp->prev->next = tmp->next; - tmp->next = tmp->parent->subDirsHead; + tmp->next = tmp->parent->fileListHead; tmp->prev = NULL; - tmp->parent->subDirsHead = tmp; + tmp->parent->fileListHead = tmp; } /* if */ return tmp; } /* if */ @@ -128,7 +133,7 @@ struct cacheNode * tmp = kmalloc(sizeof(struct cacheNode)); assert(tmp); tmp->parent = tmp; - tmp->prev = tmp->next = tmp->subDirsHead = tmp->subDirsTail = NULL; + tmp->prev = tmp->next = tmp->fileListHead = tmp->fileListTail = NULL; tmp->info = NULL; tmp->dirListEntryCount = tmp->dirty = tmp->dirBlock = 0; tmp->attributes = 0; @@ -153,8 +158,8 @@ * the following commented out ``if'' statement is redundant, since it * will be caught with the above checks */ - /* if (tmp->subDirsHead != NULL) */ - ubixfs_cacheDelete(&tmp->subDirsHead); + /* if (tmp->fileListHead != NULL) */ + ubixfs_cacheDelete(&tmp->fileListHead); kfree(tmp->info); kfree(tmp->name); @@ -183,20 +188,24 @@ assert(node); newNode->parent = node; - newNode->next = node->subDirsHead; + newNode->next = node->fileListHead; newNode->prev = NULL; - if (node->subDirsHead == NULL) - node->subDirsTail = newNode; + if (node->fileListHead == NULL) + node->fileListTail = newNode; else - node->subDirsHead->prev = newNode; + node->fileListHead->prev = newNode; - node->subDirsHead = newNode; - tmp = node->subDirsHead; + node->fileListHead = newNode; + tmp = node->fileListHead; return tmp; } /* ubixfs_cacheAdd */ /*** $Log$ + Revision 1.11 2004/07/21 22:12:22 flameshadow + add: attributes tag in cacheNode + add: setting of attributes in ubixfx_cacheNew() and ubixfs_cacheFind() + Revision 1.10 2004/07/21 22:07:18 flameshadow chg: renamed caching functions (again) @@ -209,6 +218,10 @@ Revision 1.5 2004/07/20 19:21:30 reddawg You like leaving out $Log$ + You like leaving out Revision 1.11 2004/07/21 22:12:22 flameshadow + You like leaving out add: attributes tag in cacheNode + You like leaving out add: setting of attributes in ubixfx_cacheNew() and ubixfs_cacheFind() + You like leaving out You like leaving out Revision 1.10 2004/07/21 22:07:18 flameshadow You like leaving out chg: renamed caching functions (again) You like leaving out