|
![](static/image/common/ico_lz.png)
楼主 |
发表于 2013-8-16 17:46:21
|
显示全部楼层
lkm_unication 发表于 2013-8-16 08:42 ![](static/image/common/back.gif)
这个不懂,这需要深入yaffs2才能明白。
我跟踪了一下cp的时候的读函数过程如下:
int yaffs_file_rd(struct yaffs_obj *in, u8 * buffer, loff_t offset, int n_bytes)
|
static int yaffs_rd_data_obj(struct yaffs_obj *in, int inode_chunk, u8 * buffer)
|
int nand_chunk = yaffs_find_chunk_in_file(in, inode_chunk, NULL);
所有有问题的文件,这个nand_chunk都是不正确的。
int yaffs_find_chunk_in_file(struct yaffs_obj *in, int inode_chunk,
struct yaffs_ext_tags *tags)
{
/*Get the Tnode, then get the level 0 offset chunk offset */
struct yaffs_tnode *tn;
int the_chunk = -1;
struct yaffs_ext_tags local_tags;
int ret_val = -1;
struct yaffs_dev *dev = in->my_dev;
if (!tags) {
/* Passed a NULL, so use our own tags space */
tags = &local_tags;
}
tn = yaffs_find_tnode_0(dev, &in->variant.file_variant, inode_chunk);
//有的时候在这就跳出了,这块主要涉及就是in->variant.file_variant这个结构体,还不知道是写入有问题还是读出有问题
if (!tn)
return ret_val;
the_chunk = yaffs_get_group_base(dev, tn, inode_chunk);
ret_val = yaffs_find_chunk_in_group(dev, the_chunk, tags, in->obj_id,
inode_chunk);
//有的时候这地方返回0,这块还没分析。
return ret_val;
}
struct yaffs_file_var {
loff_t file_size;
loff_t scanned_size;
loff_t shrink_size;
int top_level;
struct yaffs_tnode *top;//这个结构是干什么用的?
};
|
|