diff --git a/src/sys/ubixfs/ubixfs.c b/src/sys/ubixfs/ubixfs.c index c6f040a..0436731 100644 --- a/src/sys/ubixfs/ubixfs.c +++ b/src/sys/ubixfs/ubixfs.c @@ -28,6 +28,7 @@ *****************************************************************************************/ #include +#include #include #include #include @@ -106,6 +107,19 @@ fsInfo->blockAllocationTable, mp->diskLabel->partitions[mp->partition].pOffset, mp->diskLabel->partitions[mp->partition].pBatSize); + +/* mji */ + fsInfo->dirCache = ubixfs_dirCacheNew("/"); + assert(fsInfo->dirCache); +/* mji */ + fsInfo->dirCache->dirList = kmalloc(0x4000); /* allocate root dir */ +kprintf("\ncaching root dir\n"); + mp->device->devInfo->read(mp->device->devInfo->info, + fsInfo->dirCache->dirList, + fsInfo->rootDir, + 0x4000 / 512); + +/* mji */ //UBU dircache the ubixfs fs info struct fsInfo ->(pointer to) your rootdir thing like fsInfo->rootDirCache=ubifs_dirCacheNode(blah); kprintf(" Offset: [%i], Partition: [%i]\n", mp->diskLabel->partitions[mp->partition].pOffset,mp->partition); @@ -124,7 +138,9 @@ openFileUbixFS(char *file, fileDescriptor *fd) { int x = 0; /*mji long offsets, size; */ - struct directoryEntry *dirEntry = (struct directoryEntry *)kmalloc(0x4000); +/* mji struct directoryEntry *dirEntry = (struct directoryEntry *)kmalloc(0x4000); */ + struct cacheNode * rootDirCacheNode = NULL; + struct directoryEntry * dirEntry = NULL; struct ubixFSInfo *fsInfo = fd->mp->fsInfo; assert(fd); @@ -133,11 +149,16 @@ assert(fd->mp->device->devInfo); assert(fd->mp->device->devInfo->read); + if (file[0] == '/' && file[1] != '\0') file++; - + rootDirCacheNode = ubixfs_dirCacheFind(fsInfo->dirCache, "/"); + assert(rootDirCacheNode); + dirEntry = rootDirCacheNode->dirList; +/* mji fd->mp->device->devInfo->read(fd->mp->device->devInfo->info, dirEntry, (fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[fsInfo->rootDir].realSector),(0x4000/512)); + mji */ if ((fd->mode & fileRead) == fileRead) { for (x=0;x<(0x4000/sizeof(struct directoryEntry));x++) { if ((int)!strcmp(dirEntry[x].fileName,file)) { @@ -170,12 +191,12 @@ fd->start = dirEntry[x].startCluster; fd->dirBlock = 0x0; fd->mp->device->devInfo->write(fd->mp->device->devInfo->info,dirEntry,(fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[fsInfo->rootDir].realSector),8); - kfree(dirEntry); +/* kfree(dirEntry); */ return(0x1); } } } - kfree(dirEntry); +/* mji kfree(dirEntry); */ return(0); } @@ -405,6 +426,9 @@ /*** $Log$ + Revision 1.20 2004/07/20 19:36:49 reddawg + UBU Tags + Revision 1.19 2004/07/20 18:09:37 flameshadow add: directory caching related stuff