bAlex
驱动牛犊
驱动牛犊
  • 注册日期2010-12-04
  • 最后登录2011-05-10
  • 粉丝0
  • 关注0
  • 积分3分
  • 威望21点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:1712回复:0

寒江独钓Ramdisk中fatEntries的计算方法

楼主#
更多 发布于:2011-02-24 12:15
现在在学习寒江独钓中虚拟磁盘这一章,在随书的例子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;
    }
为何要做修正呢
游客

返回顶部