分类: 嵌入式
2009-10-30 15:13:25
yaffs_PackTags2()
當我們去compile yaffs2/utils/mkyaffs2image.c 會有error:
mkyaffs2image.c:185: error: too few arguments to function ‘yaffs_PackTags2’宣告在yaffs2/yaffs_packedtags2.h:
void yaffs_PackTags2(yaffs_Device *dev, yaffs_PackedTags2 *pt, const yaffs_ExtendedTags *t);
而yaffs2/utils/mkyaffs2image.c在write_chunk()呼叫他:
static int write_chunk(__u8 *data, __u32 objId, __u32 chunkId, __u32 nBytes){
...
yaffs_PackTags2(&pt,&t);
...
}
yaffs2/yaffs_packedtags2.h並沒定義
void yaffs_PackTags2(yaffs_PackedTags2 *pt, const yaffs_ExtendedTags *t);yaffs_PackTags2() 定義在yaffs2/yaffs_packedtags2.c:
void yaffs_PackTags2(yaffs_Device *dev, yaffs_PackedTags2 *pt, const yaffs_ExtendedTags *t)
{
yaffs_PackTags2TagsPart(&pt->t, t);
if(!dev->noTagsECC)
yaffs_ECCCalculateOther((unsigned char *)&pt->t,
sizeof(yaffs_PackedTags2TagsPart),
&pt->ecc);
}
所以yaffs_Device *dev是用來判斷dev->noTagsECC是否被assign 1,查看yaffs_fs.c
static struct super_block *yaffs_internal_read_super(int yaffsVersion,
struct super_block *sb,
void *data, int silent)
{
....
#ifdef CONFIG_YAFFS_DISABLE_TAGS_ECC
dev->noTagsECC = 1;
#endif
....
}
內定CONFIG_YAFFS_DISABLE_TAGS_ECC不會被定義,所以dev->noTagsECC為0
所以我們在:
1. yaffs2/yaffs_packedtags2.h加入下一行:
void yaffs_PackTags2_without_dev(yaffs_PackedTags2 *pt, const yaffs_ExtendedTags *t);
2. yaffs2/yaffs_packedtags2.c加入:
void yaffs_PackTags2_without_dev(yaffs_PackedTags2 *pt, const yaffs_ExtendedTags *t){
yaffs_PackTags2TagsPart(&pt->t, t);
yaffs_ECCCalculateOther((unsigned char *)&pt->t,
sizeof(yaffs_PackedTags2TagsPart),
&pt->ecc);
}
3.改yaffs2/utils/mkyaffs2image.c的write_chunk()
static int write_chunk(__u8 *data, __u32 objId, __u32 chunkId, __u32 nBytes){
...
yaffs_PackTags2_without_dev(&pt,&t);
...
}