问题1:
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_do_sync_fs':
fs/yaffs2/yaffs_vfs.c:2205:2: error: 'struct super_block' has no member named 's_dirt'fs/yaffs2/yaffs_vfs.c:2216:8: error: 'struct super_block' has no member named 's_dirt'
fs/yaffs2/yaffs_vfs.c:2218:5: error: 'struct super_block' has no member named 's_dirt'
解决:在include/linux/fs.h文件中找到 struct super_block,在这个结构中加入变量s_dirt这个变量是额外加的,用来判断dirt or clean
问题2:
fs/yaffs2/yaffs_vfs.c:480:2: error: unknown field 'write_super' specified in initializer
fs/yaffs2/yaffs_vfs.c:480:2: warning: initialization from incompatible pointer type
解决:在include/linux/fs.h文件中找到struct super_operations 结构体,在其中加入write_super函数指针,
void (*write_super)(struct super_block *);
问题3:
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_evict_inode':
fs/yaffs2/yaffs_vfs.c:875:2: error: implicit declaration of function 'end_writeback'
解决:出现这种错误一般是没有包含相应的头文件,所以搜索这个函数,发现在fs文件夹下的inode.c中,所以在include/linux/fs.h中声明这个函数
extern void end_writeback(struct inode *);
问题4:
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_mtd_put_super':
fs/yaffs2/yaffs_vfs.c:2514:9: error: 'struct mtd_info' has no member named 'sync'
fs/yaffs2/yaffs_vfs.c:2515:6: error: 'struct mtd_info' has no member named 'sync'
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_internal_read_super':
fs/yaffs2/yaffs_vfs.c:2702:2: error: 'struct mtd_info' has no member named 'erase'
fs/yaffs2/yaffs_vfs.c:2703:2: error: 'struct mtd_info' has no member named 'read'
fs/yaffs2/yaffs_vfs.c:2704:2: error: 'struct mtd_info' has no member named 'write'
fs/yaffs2/yaffs_vfs.c:2705:2: error: 'struct mtd_info' has no member named 'read_oob'
fs/yaffs2/yaffs_vfs.c:2706:2: error: 'struct mtd_info' has no member named 'write_oob'
fs/yaffs2/yaffs_vfs.c:2707:2: error: 'struct mtd_info' has no member named 'block_isbad'
fs/yaffs2/yaffs_vfs.c:2708:2: error: 'struct mtd_info' has no member named 'block_markbad'
fs/yaffs2/yaffs_vfs.c:2732:11: error: 'struct mtd_info' has no member named 'erase'
fs/yaffs2/yaffs_vfs.c:2733:11: error: 'struct mtd_info' has no member named 'block_isbad'
fs/yaffs2/yaffs_vfs.c:2734:11: error: 'struct mtd_info' has no member named 'block_markbad'
fs/yaffs2/yaffs_vfs.c:2734:34: error: 'struct mtd_info' has no member named 'read'
fs/yaffs2/yaffs_vfs.c:2734:48: error: 'struct mtd_info' has no member named 'write'
fs/yaffs2/yaffs_vfs.c:2736:11: error: 'struct mtd_info' has no member named 'read_oob'
fs/yaffs2/yaffs_vfs.c:2736:29: error: 'struct mtd_info' has no member named 'write_oob'
fs/yaffs2/yaffs_vfs.c:2757:11: error: 'struct mtd_info' has no member named 'erase'
fs/yaffs2/yaffs_vfs.c:2757:26: error: 'struct mtd_info' has no member named 'read'
fs/yaffs2/yaffs_vfs.c:2757:40: error: 'struct mtd_info' has no member named 'write'
fs/yaffs2/yaffs_vfs.c:2759:11: error: 'struct mtd_info' has no member named 'read_oob'
fs/yaffs2/yaffs_vfs.c:2759:29: error: 'struct mtd_info' has no member named 'write_oob'
解决:
搜索 struct mtd_info结构体,发现在include/linux/mtd/mtd.h中,有这个结构体的定义
struct mtd_info {
u_char type;
uint32_t flags;
uint64_t size; // Total size of the MTD
........................
/*
* Do not call via these pointers, use corresponding mtd_*()
* wrappers instead.
*/
int (*_erase) (struct mtd_info *mtd, struct erase_info *instr);
int (*_point) (struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, void **virt, resource_size_t *phys);
int (*_unpoint) (struct mtd_info *mtd, loff_t from, size_t len);
unsigned long (*_get_unmapped_area) (struct mtd_info *mtd,
unsigned long len,
unsigned long offset,
unsigned long flags);
int (*_read) (struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, u_char *buf);
int (*_write) (struct mtd_info *mtd, loff_t to, size_t len,
size_t *retlen, const u_char *buf);
int (*_panic_write) (struct mtd_info *mtd, loff_t to, size_t len,
size_t *retlen, const u_char *buf);
int (*_read_oob) (struct mtd_info *mtd, loff_t from,
struct mtd_oob_ops *ops);
............................
}
发现这个结构体里的操作函数,都以_为开头,
/*
* Do not call via these pointers, use corresponding mtd_*()
* wrappers instead.
*/
不要通过指针调用这些函数,要用mtd_*()结构,,所以,这个问题就可以解决了,把出错部分都换为这里定义的就可以了
if (mtd->sync)
mtd->sync(mtd);
修改为if (mtd->_sync)
mtd_sync(mtd);
其他的类似,这里不一一列出了
问题5:
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_internal_read_super':
fs/yaffs2/yaffs_vfs.c:2967:2: error: implicit declaration of function 'd_alloc_root'
解决:
在内核中搜索d_alloc_root这个函数,发现这个函数没有,有的只是在注释中,这个函数名被其他的取代了,被d_alloc_root函数取代了,所以把出错部分的函数名改过来就行