阅读:1755回复:0
寒江独钓Ramdisk中fatEntries的计算方法
现在在学习寒江独钓中虚拟磁盘这一章,在随书的例子Ramdisk中
关于fatEtries是这样计算的 fatEntries = (bootSector->bsSectors - bootSector->bsResSectors - bootSector->bsRootDirEnts / DIR_ENTRIES_PER_SECTOR) / bootSector->bsSecPerClus + 2; if (fatEntries > 4087) { fatType = 16; //修正 fatSectorCnt = (fatEntries * 2 + 511) / 512; fatEntries = fatEntries + fatSectorCnt; fatSectorCnt = (fatEntries * 2 + 511) / 512; } else { fatType = 12; fatSectorCnt = (((fatEntries * 3 + 1) / 2) + 511) / 512; fatEntries = fatEntries + fatSectorCnt; fatSectorCnt = (((fatEntries * 3 + 1) / 2) + 511) / 512; } 为何要做修正呢 |
|