Which is Yaffs2's on flash spare structure? For yaffs1, yaffs_spare is the actual on-flash spare structure struct yaffs_spare { u8 tb1; u8 tb0; //前四个字节表示yaffs_tag信息 u8 tb2; u8 tb3; u8 page_status; //一个字节作为删除标记 /* set to 0 to delete the chunk */ u8 block_status; //一个字节作为坏块标记位,非0xff表示坏块 u8 tb4; //中间两个字节表示yaffs_tag信息 u8 tb5; u8 ecc1[3]; //数组,三个字节存放相应chunk的后256字节ECC校验结果 u8 tb6; //接着又两个字节的yaffs_tag信息 u8 tb7; u8 ecc2[3]; //数组,三个字节存放相应chunk的前256字节的ECC校验结果 }; the following two, yaffs_tags and yaffs_packed_tags1 are the logical structure,why there are two ,they are nearly the same? struct yaffs_tags { u32 chunk_id:20; //20位用来表示chunk_id u32 serial_number:2; //2位用来表示序列号 u32 n_bytes_lsb:10; //10位用来表示该页内有效的字节数 u32 obj_id:18; //18位用来表示obj_id,唯一标识一个对象 u32 ecc:12; //yaffs_tags本身的ECC校验和 u32 n_bytes_msb:2; //还有两位未使用,保持为1 }; struct yaffs_packed_tags1 { u32 chunk_id:20;//20位的chunkID u32 serial_number:2;//2位的serial num序列号 u32 n_bytes:10;//10位表示有效字节数 u32 obj_id:18;//18位表示objID u32 ecc:12;//12位表示ECC校验值 u32 deleted:1;//1位的删除标记 u32 unused_stuff:1;//1位,未使用 unsigned should_be_ff;//为全1 }; For yaffs2, yaffs_packed_tags2_tags_only and yaffs_packed_tags are only the tags of yaffs2, not the whole yaffs2 spare, So whtat's the real on-flash yaffs2's spare structure? struct yaffs_packed_tags2_tags_only { unsigned seq_number;//顺序号 unsigned obj_id;//对象ID unsigned chunk_id;//chunkID unsigned n_bytes;//字节数 }; struct yaffs_packed_tags2 { struct yaffs_packed_tags2_tags_only t;//tags标签 struct yaffs_ecc_other ecc;//ECC校验值,12字节,存储的是上面的tags标签的ECC校验值 }; 979746084@qq.com