Changeset 810

Show
Ignore:
Timestamp:
07/15/08 10:35:33 (1 month ago)
Author:
mwhitworth
Message:

Optimize, cleanup, fix case where '..' points to root directory.

Location:
Whitix/branches/fs/fs/fat
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • Whitix/branches/fs/fs/fat/Makefile

    r703 r810  
    44 
    55build: $(MODULES) 
    6         ld $(LD_R_FLAGS) $(MODULES) -o fat.sys 
     6        ld $(LD_R_FLAGS) $(MODULES) -o fatfs.sys 
     7         
     8modules_install: 
     9        cp fatfs.sys ../../CdRoot/System/Modules/Filesystems 
    710 
    811include $(DEPTH)make.inc 
  • Whitix/branches/fs/fs/fat/fat.h

    r747 r810  
    4040#define ATTR_EXT                (ATTR_RDONLY | ATTR_HIDDEN | ATTR_SYSTEM | ATTR_LABEL) 
    4141 
    42 #define FAT_DOT ".          " 
    43 #define FAT_DOTDOT "..         " 
     42#define FAT_DOT         ".          " 
     43#define FAT_DOTDOT      "..         " 
    4444 
    4545#define FAT_ISREGULAR(attr) (!((attr) & ATTR_LABEL) && !((attr) & ATTR_DIR)) 
  • Whitix/branches/fs/fs/fat/super.c

    r705 r810  
    2929struct SuperBlockOps fatSbOps= 
    3030{ 
    31         .allocVNode = NULL, 
    3231        .readVNode = FatReadVNode, 
    3332        .writeVNode = FatWriteVNode, 
  • Whitix/branches/fs/fs/fat/vnode.c

    r747 r810  
    196196        DWORD startCluster=0,gpCluster; 
    197197 
     198        /* Is this case ever reached? */ 
    198199        if (dir->id == FAT_ROOT_ID) 
    199200                return FAT_ROOT_ID; 
     
    206207 
    207208        /* Is the root directory then */ 
    208         if (!startCluster) 
     209        if (startCluster == FatGetSbPriv(dir->superBlock)->rootDirStart) 
    209210                return FAT_ROOT_ID; 
    210211 
     
    621622        dirEntry->fileSize=size; 
    622623 
    623         /* Write the directory entry out */ 
    624         BlockWrite(dir->superBlock->sDevice,buffer); 
    625         BlockFree(buffer); 
    626  
    627624        /* Add the '..' entry */ 
    628625        err=FatAddShortName(*retVal,FAT_DOTDOT,-1,&vNum,ATTR_DIR); 
     
    630627                return err; 
    631628 
    632         buffer=BlockRead(dir->superBlock->sDevice,VNUM_TO_SECTOR(vNum)); 
    633629        dirEntry=(struct FatDirEntry*)(buffer->data+VNUM_TO_OFFSET(vNum)*sizeof(struct FatDirEntry)); 
    634630        dirEntry->startClusterHigh=FatGetPriv(dir)->startCluster >> 16; 
     
    637633 
    638634        /* Write the directory entry out */ 
    639         BlockWrite(dir->superBlock->sDevice,buffer); 
    640         BlockFree(buffer); 
     635        BlockWrite(dir->superBlock->sDevice, buffer); 
     636        BufferRelease(buffer); 
    641637 
    642638        return 0;