,我在想,如果我要加入ntfs怎么办?/if ISFAT12dpbp REG UBYTE FAR fbp0 FAR fbp1 struct buffer FAR bp1 unsigned cluster cluster2 / form an index so that we can read the block as a / / byte array //idx上面操作得到的在簇里面的第几个扇区 fat12文件系统一个簇=一个扇区 第n个fat目录项: n为偶数:低四位3n/2,高四位3n/21 n为奇数:低四位 一个簇=??? 一个扇区=512字节 一个fat表项=12位=1.5位 idx是在原有的簇的基础上还要移动几个扇区的索引 一个buffer的大小就是一个扇区的大小 / idx / 2 / Test to see if the cluster straddles the block. If / / it does get the next block and use both to form the / / the FAT word. Otherwise just point to the next / / block.测试这个簇是否跨越了这个块,如果是这样的话,得到下个块, 用这两个簇形成一个fat字 //sizeofb_buffer512BPRIampgtPRI-gt/ fbp0 ampbp-gtb_bufferidx / pointer to next byte will be overwritten if not valid //如果是跨越的话,就是越界的访问了吧我的意思没有意思的访问/ fbp1 fbp0 1/如果这时候是跨越了的话,那么就要读下一个块,那么fbp1是无效的,而是需要重新赋值//因为是必须要读2个字节的,idx只是开始字节地址/ if idx gt unsigneddpbp-gtdpb_secsize - 1 / blockio.c LRU logic ensures that bp bp1 这话我还没懂,希望懂的人能解释下/ bp1 getFATblockdpbp unsignedclussec 1 if bp1 0 return 1 / the only error code possible here //我看到现在只要看过READ_CLUSTER/ if unsignedCluster2 READ_CLUSTER bp1-gtb_flag BFR_DIRTY BFR_VALID /fbp1指向下个byte/ fbp1 ampbp1-gtb_buffer0 /fbp1只是unsigned char阿?总共也就8位的,左移8位还有吗??//高高低低原则/ cluster fbp0 fbp1 ltlt 8 unsigned res cluster / Now to unpack the contents of the FAT entry. Odd and / / even bytes are packed differently. //如果要寻找的idx是奇数的话,则要/ if Cluster1 amp 0x01 cluster gtgt 4 cluster amp 0x0fff/因为我只要看获取一个空闲fat,所以我就看到了这里 当fat项是0时候,说明是空闲的 / if unsignedCluster2 READ_CLUSTER if cluster gt MASK12 return LONG_LAST_CLUSTER if cluster BAD12 return LONG_BAD return cluster /如果不是在寻找空闲的fat那么可以计算空闲的fat/ if cluster FREE wasfree cluster res / Cluster2 may be set to LONG_LAST_CLUSTER 0x0FFFFFFFUL or 0xFFFF / / -- please dont remove this mask / cluster2 unsignedCluster2 amp 0x0fff / Now pack the value in / if Cluster1 amp 0x01 cluster amp 0x000f cluster2 ltlt 4 else cluster amp 0xf000 cluster cluster2 fbp0 UBYTEcluster fbp1 UBYTEcluster gtgt 8else .
上一篇:
入门第1讲
下一篇:
秋天是疼痛的