unsigned int firstDataBlock = 0;
unsigned int blocksPerGroup = 0;
unsigned int clustersPerGroup = 0;
+ unsigned short descSize = 0;
runtime::File device(source);
if (!device.exists())
device.lseek(ODE_SUPERBLOCK_OFFSET + 36, SEEK_SET);
device.read(&clustersPerGroup, 4);
+ // read descSize
+ device.lseek(ODE_SUPERBLOCK_OFFSET + 0xFE, SEEK_SET);
+ device.read(&descSize, 2);
+ if (descSize < ODE_EXT2_MIN_DESC_SIZE) {
+ descSize = ODE_EXT2_MIN_DESC_SIZE;
+ }
+
unsigned int groupDescCount = divCeilSafely(totalBlockCount - firstDataBlock, blocksPerGroup);
int blockNbytes = clustersPerGroup / 8;
// read group_desc
- unsigned int descPerBlock = blockSize / ODE_EXT2_MIN_DESC_SIZE;
+ unsigned int descPerBlock = blockSize / descSize;
unsigned int descBlockCount = divCeilSafely(groupDescCount, descPerBlock);
// read first meta block
}
for (unsigned int i = 0; i < groupDescCount; i++) {
- unsigned int blk = (((struct odeExtGroupDesc *)(((unsigned char *)(group_desc.data())) + i * ODE_EXT2_MIN_DESC_SIZE))->blockBitmap);
+ unsigned int blk = (((struct odeExtGroupDesc *)(((unsigned char *)(group_desc.data())) + i * descSize))->blockBitmap);
try {
data block_bitmap(blockSize);