Ian McDonnell, I used unsigned char's in place of the unsigned int's in struct yaffs_ECCOther, It works! Thanks again for help!!! Index: yaffs_ecc.h =================================================================== --- yaffs_ecc.h £¨ÐÞ¶©°æ 100£© +++ yaffs_ecc.h £¨¹¤×÷¿½±´£© @@ -32,8 +32,8 @@ typedef struct { unsigned char colParity; - unsigned lineParity; - unsigned lineParityPrime; + unsigned char lineParity; + unsigned char lineParityPrime; } yaffs_ECCOther; void yaffs_ECCCalculate(const unsigned char *data, unsigned char *ecc); 2007/7/5, ian@brightstareng.com : > On Thursday 05 July 2007 00:32, He Yong wrote: > > sorry, I made a mistake. the yaffs2's mini-ecc actually only > > checks the 16 bytes of ext tags (struct > > yaffs_PackedTags2TagsPart). > Yes, I call the tags ecc the "mini-ECC", it is not the main ECC > that covers the user's data. It protects the integrity of the > tags data. > > > and generates 9 bytes of parity > > code (struct yaffs_ECCOther). but the sizeof(struct > > yaffs_ECCOther) = 12 byte, simply because the struct is 4-byte > > aligned, I made a little change to save 3 bytes for other > > usage (like mtd bad block mark). > > Did you try using unsigned char's in place of the unsigned int's > in struct yaffs_ECCOther, see > http://balloonboard.org/lurker/message/20070702.161336.5e273493.en.html > > It should be easy to reduce struct yaffs_PackedTags2 to just 20 > bytes: 4 ints + 3 chars + 1 alignment byte -- so only 19 bytes > of real data. This should work without any introducing any > functional differences. The code in yaffs_packedtags2.c uses > sizeof(struct) for the length so I do not think there is any need > to change the i/o code if you can work with 20-byte tags. > > -imcd > -- Best Regards! He Yong School of Information Security, Shanghai Jiaotong University, Dong cuan Road #800, Minhang, Shanghai, P.R.China