diff options
author | Russ Cox <rsc@swtch.com> | 2008-06-01 08:47:06 -0400 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2008-06-01 08:47:06 -0400 |
commit | d29f5ece8b534180076e2859dcc014b3c36b00cf (patch) | |
tree | bac4e14296a0a1fdfaf5009957e2541ad4fe1c65 /src/libdiskfs | |
parent | df1ee4e1af9340a8207535c5009ec289bf1ecda1 (diff) | |
download | plan9port-d29f5ece8b534180076e2859dcc014b3c36b00cf.tar.gz plan9port-d29f5ece8b534180076e2859dcc014b3c36b00cf.tar.bz2 plan9port-d29f5ece8b534180076e2859dcc014b3c36b00cf.zip |
libdiskfs: ext2 revision 1 tweaks (Fazlul Shahriar)
Diffstat (limited to 'src/libdiskfs')
-rw-r--r-- | src/libdiskfs/ext2.c | 13 | ||||
-rw-r--r-- | src/libdiskfs/ext2.h | 12 |
2 files changed, 17 insertions, 8 deletions
diff --git a/src/libdiskfs/ext2.c b/src/libdiskfs/ext2.c index afd95222..b55f1eb3 100644 --- a/src/libdiskfs/ext2.c +++ b/src/libdiskfs/ext2.c @@ -275,7 +275,11 @@ ext2sync(Fsys *fsys) / super.blockspergroup; fs->inospergroup = super.inospergroup; fs->blockspergroup = super.blockspergroup; - fs->inosperblock = fs->blocksize / InodeSize; + if(super.revlevel >= 1) + fs->inosize = super.inosize; + else + fs->inosize = 128; + fs->inosperblock = fs->blocksize / fs->inosize; if(fs->blocksize == SBOFF) fs->groupaddr = 2; else @@ -336,7 +340,7 @@ handle2ino(Ext2 *fs, Nfs3Handle *h, u32int *pinum, Inode *ino) addr = g.inodeaddr + ioff/fs->inosperblock; if((b = diskread(fs->disk, fs->blocksize, (u64int)addr*fs->blocksize)) == nil) return Nfs3ErrIo; - parseinode(ino, b->data+InodeSize*(ioff%fs->inosperblock)); + parseinode(ino, b->data+fs->inosize*(ioff%fs->inosperblock)); blockput(b); return Nfs3Ok; } @@ -875,5 +879,8 @@ parsesuper(Super *s, uchar *p) s->revlevel = l32(p+76); s->defresuid = l16(p+80); s->defresgid = l16(p+82); - /* 940 byte reserved */ + s->firstino = l32(p+84); + s->inosize = l32(p+88); + s->blockgroupnr = l16(p+60); + /* 932 byte reserved */ } diff --git a/src/libdiskfs/ext2.h b/src/libdiskfs/ext2.h index 6109974d..7ddd400a 100644 --- a/src/libdiskfs/ext2.h +++ b/src/libdiskfs/ext2.h @@ -80,7 +80,12 @@ struct Super u32int revlevel; /* Revision level */ u16int defresuid; /* Default uid for reserved blocks */ u16int defresgid; /* Default gid for reserved blocks */ - u32int reserved[235]; /* Padding to the end of the block */ + + /* the following are only available with revlevel = 1 */ + u32int firstino; /* First non-reserved inode */ + u16int inosize; /* size of inode structure */ + u16int blockgroupnr; /* block group # of this super block */ + u32int reserved[233]; /* Padding to the end of the block */ }; /* @@ -122,10 +127,6 @@ struct Inode u32int diracl; /* Directory ACL or high size bits */ u32int faddr; /* Fragment address */ }; -enum -{ - InodeSize = 128 -}; /* * Directory entry @@ -153,6 +154,7 @@ struct Ext2 uint inospergroup; uint blockspergroup; uint inosperblock; + uint inosize; uint groupaddr; uint descperblock; uint firstblock; |