Changeset 371 for Whitix/trunk/fs

Show
Ignore:
Timestamp:
04/30/08 13:55:17 (7 months ago)
Author:
mwhitworth
Message:

Add comments to ext3.h. Patch from Arshad Hussain <arshad.super@…>

Files:
1 modified

Legend:

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

    r1 r371  
    55#include <init.h> 
    66 
    7 /* TODO : Document all this */ 
    8  
    97struct Ext3SuperBlock 
    108{ 
    11         DWORD iNodesCount,blocksCount,reservedBlocks,freeBlocks,freeInodes,firstDataBlock,logBlockSize, 
    12         logFragSize,blocksPerGrp,fragsPerGrp,iNodesPerGrp,mountTime,writeTime; 
    13         WORD mntCount,maxMntCount,magic,state,errors,minorRevLevel; 
    14         DWORD lastCheck,checkInterval,creatorOs,revLevel; 
    15         WORD defResUid,defResGid; 
    16         DWORD firstINode; 
    17         WORD iNodeSize; 
    18         WORD blockGroupNr; 
    19         DWORD featureCompat,featureInCompat,featureRoCompat; 
    20         BYTE uuid[16]; 
    21         char volumeName[16]; 
    22         char lastMounted[64]; 
    23         DWORD algorithmUsageBitmap; 
    24         BYTE preallocBlocks,preallocDirBlocks; 
    25         WORD reservedGDescBlocks; 
    26         BYTE journalUuid[16]; 
    27         DWORD journalINum,journalDev,lastOrphan,hashSeed[4]; 
    28         BYTE defHasVersion; 
    29         BYTE reservedCharPad; 
     9         
     10        DWORD iNodesCount; /* Inodes Count */ 
     11        DWORD blocksCount; /* Blocks Count */ 
     12        DWORD reservedBlocks; /* Reserved Blocks Count */ 
     13        DWORD freeBlocks; /* Free Blocks Count */ 
     14        DWORD freeInodes; /* Free inode Count */ 
     15        DWORD firstDataBlock; /* First Data Block */ 
     16        DWORD logBlockSize; /* Block Size as a power of 2. The unit is 1024. Thus  
     17        0 == 1024 , 1 = 2048 , 2 = 4096*/ 
     18        DWORD logFragSize; /* Fragments are not yet implemented int ext3. So  
     19        logFragSize .equal. logBlockSize */ 
     20        DWORD blocksPerGrp; /* Number of Blocks in each block group */ 
     21        DWORD fragsPerGrp; /* Number of Fragments in each block group */ 
     22        DWORD iNodesPerGrp; /* Number of Inodes in each block group */ 
     23        DWORD mountTime; /* Mount Time */ 
     24        DWORD writeTime; /* Write Time */ 
     25        WORD mntCount; /* Mount count */ 
     26        WORD maxMntCount; /* Maximal mount count */ 
     27        WORD magic; /* Magic signature */ 
     28        WORD state; /* File system state. 0 = Currently Mounted or not clenaly mounted,  
     29        1 = clenaly unmounted , 2 = It has errors  */ 
     30        WORD errors; /* Behaviour when detecting errors */ 
     31        WORD minorRevLevel; /* minor revision level */ 
     32        DWORD lastCheck; /* time of last check */ 
     33        DWORD checkInterval; /* max. time between checks */ 
     34        DWORD creatorOs; /*  OS where FS was created */ 
     35        DWORD revLevel; /* Revision of the filesystem */ 
     36        WORD defResUid,defResGid; /* Default uid/gid for reserved blocks */ 
     37        DWORD firstINode; /* First non reserved Inode */ 
     38        WORD iNodeSize; /* size of inode structure */ 
     39        WORD blockGroupNr; /* block group # of this superblock */ 
     40        DWORD featureCompat,featureInCompat,featureRoCompat; /* feature set */ 
     41        BYTE uuid[16]; /* 128 bit uuid for the volume */ 
     42        char volumeName[16]; /* volume name */ 
     43        char lastMounted[64]; /* directory where last mounted */ 
     44        DWORD algorithmUsageBitmap; /* algorithm used for compression */ 
     45  
     46 /* 
     47        * Performance hints.  Directory preallocation should only 
     48        * happen if the EXT2_FEATURE_COMPAT_DIR_PREALLOC flag is on. 
     49        */ 
     50        BYTE preallocBlocks; /* # of blks try to preallocate */ 
     51        BYTE preallocDirBlocks; /* # of blks try to preallocate for dir */ 
     52        WORD reservedGDescBlocks; /* Per group table for online growth */ 
     53        /* 
     54         * Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set. 
     55         */ 
     56        BYTE journalUuid[16];/* uuid of journal superblock  */ 
     57        DWORD journalINum; /* inode number of journal file */ 
     58        DWORD journalDev; /* device number of journal file */ 
     59        DWORD lastOrphan;/* start of list of inodes to delete  */ 
     60        DWORD hashSeed[4]; /* HTREE hash seed */ 
     61        BYTE defHasVersion; /* Default hash version to use */ 
     62        BYTE reservedCharPad;   
    3063        WORD reservedWordPad; 
    31         DWORD defaultMountOpts,firstMetaBg; 
    32         DWORD reserved[190]; 
     64        DWORD defaultMountOpts; 
     65        DWORD firstMetaBg; /* First metablock group */ 
     66        DWORD reserved[190]; /* Padding to the end of the block */ 
    3367}PACKED; 
    3468 
     
    4579 
    4680/* On disk structures */ 
     81 
     82/*   
     83 * Each block group has its own group discriptor 
     84 */ 
    4785struct Ext3GroupDesc 
    4886{ 
    49         DWORD blockBitmap,iNodeBitmap,iNodeTable; 
    50         WORD freeBlocks,freeINodes,usedDirs,pad; 
    51         DWORD reserved[3]; 
     87        DWORD blockBitmap; // Block number of blkbitmap 
     88        DWORD iNodeBitmap; // Blk number of inode bitmap 
     89        DWORD iNodeTable; // Blk Number of first inode table block 
     90        WORD freeBlocks; // Number of free blocks in the group 
     91        WORD freeINodes; // Number of free inodes in the group 
     92        WORD usedDirs; // Number of directory in the group 
     93        WORD pad; //  Alignment to WORD 
     94        DWORD reserved[3]; // Null to pad out 24 bytes. 
    5295}PACKED; 
    5396 
    5497struct Ext3INode 
    5598{ 
    56         WORD mode,uid; 
    57         DWORD size,aTime,cTime,mTime,dTime; 
    58         WORD gid,linksCount; 
    59         DWORD blocksCount,flags,reserved; 
    60         DWORD blocks[15],version,fileAcl,dirAcl,fAddr; 
    61         BYTE frag,fsize; 
     99        WORD mode; // file type and access rights. 
     100        WORD uid; // Owner identifier 
     101        DWORD size;// file length in bytes  
     102        DWORD aTime;// time of last file access  
     103        DWORD cTime;// Time that inode last changed  
     104        DWORD mTime;// Time that file contents last changed  
     105        DWORD dTime;// Time of file deletion 
     106        WORD gid;// User group identifier  
     107        WORD linksCount; // Hard links count 
     108        DWORD blocksCount;// Number of data blocks in a file  
     109        DWORD flags;// File flags  
     110        DWORD reserved; // Reserved  
     111        DWORD blocks[15];// Pointer to data blocks  
     112        DWORD version;// File version when used by network filesystem 
     113        DWORD fileAcl;// file access control list  
     114        DWORD dirAcl;// directory access control list  
     115        DWORD fAddr; // Fragment address 
     116        BYTE frag;// fragment number  
     117        BYTE fsize; // fragment size 
    62118        WORD pad; 
    63119        DWORD reserved2[2]; 
    64120}PACKED; 
    65121 
     122/* 
     123 * DirEntry describes Directory, which are special kind of file 
     124 * which stores file names along with its inodes. 
     125 */ 
    66126struct Ext3DirEntry 
    67127{ 
    68         DWORD iNodeNum; 
    69         WORD recLen; 
    70         BYTE nameLen,fileType; 
    71         char name[255]; /* In practice, it's a lot less */ 
     128        DWORD iNodeNum; // Inode number 
     129        WORD recLen; // Directoy entry length 
     130        BYTE nameLen;// filename length 
     131        BYTE fileType; // file type 
     132        char name[255]; /* file name. In practice, it's a lot less */ 
    72133}PACKED; 
    73134 
     
    83144extern struct FileOps ext3FileOps; 
    84145 
    85 /* Defines for superblock stuff. At least the ReadVNode code doesn't look like lisp code anymore */ 
     146/*  
     147 * Defines for superblock stuff. At least the ReadVNode code doesn't look like lisp  
     148 * code anymore  
     149 */ 
    86150#define DESCS_PER_BLOCK(s) (BYTES_PER_SECTOR(s)/sizeof(struct Ext3GroupDesc)) 
    87151#define INODES_PER_BLOCK(s) (BYTES_PER_SECTOR(s)/sizeof(struct Ext3INode))