diff --git a/src/sys/include/ubixfs/ubixfs.h b/src/sys/include/ubixfs/ubixfs.h index 80a4b2d..d72658b 100644 --- a/src/sys/include/ubixfs/ubixfs.h +++ b/src/sys/include/ubixfs/ubixfs.h @@ -132,9 +132,7 @@ struct cacheNode * dirCache; uInt32 batEntries; uInt32 rootDir; - - //UBU Root Dirt Cache Node Pointer - }; +}; /* ubixFSInfo */ int readFile(char *file); int writeFileByte(int ch,fileDescriptor *fd,long offset); @@ -162,6 +160,9 @@ /*** $Log$ + Revision 1.19 2004/07/27 12:02:01 reddawg + chg: fixed marks bug readFile did a lookup which is why it looked like it was loopping so much + Revision 1.18 2004/07/23 09:10:06 reddawg ubixfs: cleaned up some functions played with the caching a bit vfs: renamed a bunch of functions diff --git a/src/sys/ubixfs/dirCache.c b/src/sys/ubixfs/dirCache.c index 5e9d5da..6d9b790 100644 --- a/src/sys/ubixfs/dirCache.c +++ b/src/sys/ubixfs/dirCache.c @@ -184,7 +184,7 @@ tmp->startCluster = NULL; tmp->attributes = NULL; tmp->permissions = NULL; - tmp->name = (char *)kmalloc(strlen(name)); + tmp->name = (char *)kmalloc(strlen(name)+1); strcpy(tmp->name, name); return tmp; } /* ubixfs_cacheNew */ @@ -249,6 +249,9 @@ /*** $Log$ + Revision 1.27 2004/07/28 17:24:13 flameshadow + chg: no comment + Revision 1.26 2004/07/28 17:07:29 flameshadow chg: re-added moving cached nodes to the front of the list when found add: added an assert() in ubixfs.c @@ -312,6 +315,9 @@ Revision 1.5 2004/07/20 19:21:30 reddawg You like leaving out $Log$ + You like leaving out Revision 1.27 2004/07/28 17:24:13 flameshadow + You like leaving out chg: no comment + You like leaving out You like leaving out Revision 1.26 2004/07/28 17:07:29 flameshadow You like leaving out chg: re-added moving cached nodes to the front of the list when found You like leaving out add: added an assert() in ubixfs.c diff --git a/src/sys/ubixfs/directory.c b/src/sys/ubixfs/directory.c index 87d5e61..095e283 100644 --- a/src/sys/ubixfs/directory.c +++ b/src/sys/ubixfs/directory.c @@ -109,12 +109,15 @@ entry->size = UBIXFS_BLOCKSIZE_BYTES; entry->attributes = typeDirectory; entry->permissions = 0xEAA; - sprintf(entry->fileName,directory); + sprintf(entry->fileName, directory); //dir->attributes = typeDirectory; //sprintf(dir->fileName,"Test Entry"); - fd->mp->device->devInfo->write(fd->mp->device->devInfo->info,dir,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[block].realSector,blockSize); + fd->mp->device->devInfo->write(fd->mp->device->devInfo->info, + dir, + fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[block].realSector, + blockSize); addDirEntry(entry,fd); kfree(dir); kfree(entry); @@ -125,6 +128,11 @@ /*** $Log$ + Revision 1.10 2004/07/23 09:10:06 reddawg + ubixfs: cleaned up some functions played with the caching a bit + vfs: renamed a bunch of functions + cleaned up a few misc bugs + Revision 1.9 2004/07/16 20:17:29 flameshadow chg: broke the ufs stuff chg: changed vfsRegisterFS() to accept a fileSystem struct diff --git a/src/sys/ubixfs/ubixfs.c b/src/sys/ubixfs/ubixfs.c index 6cc3435..899b467 100644 --- a/src/sys/ubixfs/ubixfs.c +++ b/src/sys/ubixfs/ubixfs.c @@ -43,7 +43,7 @@ static int ubixfs_loadData(fileDescriptor *fd,char *data,uInt32 size,uInt32 batIndex); -static int openFileUbixFS(char *file, fileDescriptor *fd) { +static int openFileUbixFS(const char *file, fileDescriptor *fd) { //int x = 0; /* mji struct directoryEntry *dirEntry = (struct directoryEntry *)kmalloc(0x4000); */ struct cacheNode * cacheNode = NULL; @@ -61,28 +61,29 @@ assert(fsInfo); assert(fsInfo->dirCache); - do { - cacheNode = ubixfs_cacheFind(fsInfo->dirCache, file); - if (cacheNode == NULL) return 0; - if (cacheNode->present == 1) break; -assert(cacheNode->size); - if (*cacheNode->size != 0 && cacheNode->info == NULL) { - kprintf("caching name(size): %s(%d)\n", cacheNode->name, *cacheNode->size); - cacheNode->info = kmalloc(UBIXFS_ALIGN(*cacheNode->size)); - fd->size = *cacheNode->size; -assert(cacheNode->startCluster); - ubixfs_loadData(fd, - cacheNode->info, - *cacheNode->size, - *cacheNode->startCluster); - cacheNode->present = 1; - } /* if */ - } while(1); - -assert(cacheNode); - if (cacheNode == NULL) return 0; - if ((fd->mode & fileRead) == fileRead) { + do { + cacheNode = ubixfs_cacheFind(fsInfo->dirCache, file); + if (cacheNode == NULL) return 0; + if (cacheNode->present == 1) break; + assert(cacheNode->size); + if (*cacheNode->size != 0 && cacheNode->info == NULL) { + kprintf("caching name(size): %s(%d)\n",cacheNode->name, + *cacheNode->size); + cacheNode->info = kmalloc(UBIXFS_ALIGN(*cacheNode->size)); + fd->size = *cacheNode->size; + assert(cacheNode->startCluster); + ubixfs_loadData(fd, + cacheNode->info, + *cacheNode->size, + *cacheNode->startCluster); + cacheNode->present = 1; + } /* if */ + } while(1); + + assert(cacheNode); + if (cacheNode == NULL) return 0; /* this should be caught above */ + fd->start = *cacheNode->startCluster; fd->size = *cacheNode->size; fd->perms = *cacheNode->permissions; @@ -525,6 +526,10 @@ /*** $Log$ + Revision 1.40 2004/07/28 17:07:29 flameshadow + chg: re-added moving cached nodes to the front of the list when found + add: added an assert() in ubixfs.c + Revision 1.39 2004/07/27 19:24:31 flameshadow chg: reduced the number of debugging statements in the kernel.