diff --git a/src/sys/ubixfs/dirCache.c b/src/sys/ubixfs/dirCache.c index df3f97f..8f225e1 100644 --- a/src/sys/ubixfs/dirCache.c +++ b/src/sys/ubixfs/dirCache.c @@ -35,11 +35,11 @@ static struct directoryEntry * -ubixfs_findName(struct directoryEntry * dirList, char * name) { - int i; +ubixfs_findName(struct directoryEntry * dirList, uInt32 size, char * name) { + unsigned int i; kprintf("in findname: %s\n", name); if (dirList == NULL || name == NULL) return NULL; - for (i = 0; dirList[i].fileName != NULL; i++) { + for (i = 0; i < (size / sizeof(struct directoryEntry)) ; i++) { if (strcmp(dirList[i].fileName, name) == 0) return &dirList[i]; } /* for */ return NULL; @@ -83,16 +83,18 @@ * name points to a null terminated directory name * if nextDir isn't null, then make sure that this dir is present */ -kprintf("nextdir: %s\n", nextDir); +kprintf("nextdir: %s -- dirName: %s\n", nextDir, dirName); if (*nextDir != '\0') { while (tmp != NULL) { -kprintf("looking at: %s\n", tmp->name); +kprintf("looking at: %s ... ", tmp->name); if (strcmp(tmp->name, dirName) == 0) { +kprintf("found %s\n", tmp->name); if ((*tmp->attributes & typeFile) == typeFile || tmp->fileListHead == NULL) { /* if we're here, then there are no subdirs cached to look through */ - dirList = ubixfs_findName((struct directoryEntry *)head->info,nextDir); + dirList = ubixfs_findName((struct directoryEntry *)head->info, + *head->size, nextDir); if (dirList == NULL) return NULL; kprintf("creating new node %s", dirList->fileName); tmp = ubixfs_cacheAdd(tmp, ubixfs_cacheNew(dirList->fileName)); @@ -103,7 +105,11 @@ tmp->startCluster = &dirList->startCluster; tmp->present = 0; return tmp; - } else return ubixfs_cacheFind(tmp->fileListHead, nextDir); + } else { + kprintf("descending and looking for: %s\n", nextDir); + return ubixfs_cacheFind(tmp->fileListHead, nextDir); + kprintf("you should never see this\n"); + } } /* if */ tmp = tmp->next; } /* while */ @@ -120,11 +126,13 @@ assert(tmp->name); /* don't forget to check to see if it's a directory */ if (strcmp(tmp->name, name) == 0) { +kprintf("bottom level returning %s\n", tmp->name); /* * we found the node. Move it to the front of the list * (if it isn't already) */ #if 0 + assert(tmp->parent); if (tmp != tmp->parent->fileListHead) { @@ -145,13 +153,14 @@ tmp = tmp->next; } /* while */ /* if we're here, then one level of the dir isn't cached */ - +kprintf("file/dir isn't cached!\n"); tmp = head->parent; assert(tmp); assert(tmp->info); - dirList = ubixfs_findName((struct directoryEntry *)tmp->info, name); + dirList = ubixfs_findName((struct directoryEntry *)tmp->info, + *tmp->size, name); if (dirList == NULL) return NULL; -kprintf("creating new node %s", dirList->fileName); +kprintf("creating new node/size %s/%d", dirList->fileName, dirList->size); tmp = ubixfs_cacheAdd(tmp, ubixfs_cacheNew(dirList->fileName)); tmp->attributes = &dirList->attributes; tmp->permissions = &dirList->permissions; @@ -242,6 +251,9 @@ /*** $Log$ + Revision 1.22 2004/07/27 04:05:20 flameshadow + chg: kinda fixed it. Added bunches of debug info + Revision 1.21 2004/07/25 22:21:52 flameshadow chg: re-enabled kprintf() in ubixfs_cacheFind() @@ -289,6 +301,9 @@ Revision 1.5 2004/07/20 19:21:30 reddawg You like leaving out $Log$ + You like leaving out Revision 1.22 2004/07/27 04:05:20 flameshadow + You like leaving out chg: kinda fixed it. Added bunches of debug info + You like leaving out You like leaving out Revision 1.21 2004/07/25 22:21:52 flameshadow You like leaving out chg: re-enabled kprintf() in ubixfs_cacheFind() You like leaving out diff --git a/src/sys/ubixfs/ubixfs.c b/src/sys/ubixfs/ubixfs.c index c1c6dab..e9645ae 100644 --- a/src/sys/ubixfs/ubixfs.c +++ b/src/sys/ubixfs/ubixfs.c @@ -50,7 +50,7 @@ //struct directoryEntry * dirEntry = NULL; struct ubixFSInfo *fsInfo = fd->mp->fsInfo; - //kprintf("openFileUbixFS(%s), cwd: %s\n", file, _current->oInfo.cwd); +kprintf("openFileUbixFS(%s), cwd: %s\n", file, _current->oInfo.cwd); if (fsInfo->dirCache == NULL) kprintf("dirCache is null!\n"); assert(fd); @@ -70,7 +70,6 @@ do { cacheNode = ubixfs_cacheFind(fsInfo->dirCache, file); -assert(cacheNode); if (cacheNode == NULL) return 0; if (cacheNode->present == 1) break; if (*cacheNode->size != 0 && cacheNode->info == NULL) { @@ -83,8 +82,8 @@ *cacheNode->size, *cacheNode->startCluster); cacheNode->present = 1; -kprintf("here\n"); } /* if */ +kprintf("looping in do while(1)\n"); } while(1); #if 0 /* @@ -565,6 +564,9 @@ /*** $Log$ + Revision 1.36 2004/07/27 04:05:20 flameshadow + chg: kinda fixed it. Added bunches of debug info + Revision 1.35 2004/07/26 19:15:49 reddawg test code, fixes and the like