Changeset 807

Show
Ignore:
Timestamp:
07/15/08 09:25:26 (2 months ago)
Author:
mwhitworth
Message:

Add to Ext3CreateINode function, add to Ext3BlockRead function.

Location:
Whitix/branches/fs/fs/ext3
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • Whitix/branches/fs/fs/ext3/ext3.h

    r783 r807  
    192192int Ext3ReadDir(struct File* file,void* dirEntries); 
    193193int Ext3BlockMap(struct VNode* vNode, DWORD block, int flags); 
    194 struct Buffer* Ext3BlockRead(struct VNode* vNode,int block); 
     194struct Buffer* Ext3BlockRead(struct VNode* vNode,int block, int create); 
    195195int Ext3Create(struct VNode** retVal,struct VNode* dir,char* name,int nameLength); 
    196196int Ext3Truncate(struct VNode* vNode, int size); 
     197int Ext3MkDir(struct VNode** retVal,struct VNode* dir,char* name,int nameLength); 
     198struct VNode* Ext3CreateINode(struct JournalHandle* handle, struct VNode* dir, int isDir); 
    197199 
    198200int Ext3FileWrite(struct File* file,BYTE* buffer,DWORD len); 
  • Whitix/branches/fs/fs/ext3/ialloc.c

    r781 r807  
    3535} 
    3636  
    37 struct VNode* Ext3CreateINode(struct JournalHandle* handle, struct VNode* dir) 
     37struct VNode* Ext3CreateINode(struct JournalHandle* handle, struct VNode* dir, int isDir) 
    3838{ 
    3939        DWORD groupNo; 
     
    4747        struct VNode* vNode; 
    4848         
    49         /* What happens when a directory is to be created? */ 
     49        if (isDir) 
     50        { 
     51                int avgFree=sbInfo->super->freeInodes/sbInfo->groupCount; 
     52                 
     53                for (i=0; i<sbInfo->groupCount; i++) 
     54                { 
     55                        desc=Ext3GetGroupDesc(superBlock, i, &groupBuffer); 
     56                         
     57                        if (desc && desc->freeINodes && desc->freeINodes >= avgFree) 
     58                        { 
     59                                groupNo=i; 
     60                                break; 
     61                        } 
     62                } 
     63        }else{ 
     64                /* TODO: May have to search other groups. */ 
     65                groupNo=EXT3_INFO(dir)->blockGroup; 
    5066         
    51         groupNo=EXT3_INFO(dir)->blockGroup; 
    52          
    53         desc=Ext3GetGroupDesc(superBlock, groupNo, &groupBuffer); 
     67                desc=Ext3GetGroupDesc(superBlock, groupNo, &groupBuffer); 
    5468 
    55         if (!desc->freeINodes) 
    56         { 
    57                 KePrint("Need to allocate!\n"); 
    58                 cli(); hlt(); 
     69                if (!desc->freeINodes) 
     70                { 
     71                        KePrint("Need to allocate!\n"); 
     72                        cli(); hlt(); 
     73                } 
    5974        } 
    6075         
     
    112127        vNode->vNodeOps=&ext3VNodeOps; 
    113128        vNode->fileOps=&ext3FileOps; 
    114         vNode->mode=VFS_ATTR_WRITE | VFS_ATTR_READ | VFS_ATTR_FILE; 
     129 
     130        vNode->mode=VFS_ATTR_WRITE | VFS_ATTR_READ; 
     131                 
     132        if (isDir) 
     133                vNode->mode |= VFS_ATTR_DIR; 
     134        else 
     135                vNode->mode |= VFS_ATTR_FILE; 
     136                 
    115137        vNode->extraInfo=iNodeInfo; 
    116138         
  • Whitix/branches/fs/fs/ext3/super.c

    r784 r807  
    3737        .create = Ext3Create, 
    3838        .truncate = Ext3Truncate, 
     39        .mkDir = Ext3MkDir, 
    3940}; 
    4041