前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Yaffs_checkptrw

Yaffs_checkptrw

作者头像
瓜大三哥
发布2018-02-24 17:09:37
6640
发布2018-02-24 17:09:37
举报
文章被收录于专栏:瓜大三哥瓜大三哥瓜大三哥
1.static int apply_chunk_offset(struct yaffs_dev *dev, int chunk)
{return chunk - dev->chunk_offset;}//得到chunk偏移量
2.static int apply_block_offset(struct yaffs_dev *dev, int block)
{return block - dev->block_offset;}//得到block偏移量
3.static void yaffs2_checkpt_init_chunk_hdr(struct yaffs_dev *dev)
memcpy(dev->checkpt_buffer, &hdr, sizeof(hdr));//初始化校验缓冲区
4.static int yaffs2_checkpt_check_chunk_hdr(struct yaffs_dev *dev)//检测校验区的chunk的校验位
5.static int yaffs2_checkpt_space_ok(struct yaffs_dev *dev)
int blocks_avail = dev->n_erased_blocks - dev->param.n_reserved_blocks;//检测是否有空闲块,如果没有返回0,否则返回1
6.static int yaffs_checkpt_erase(struct yaffs_dev *dev)
7.static void yaffs2_checkpt_find_erased_block(struct yaffs_dev *dev)//检查是或否找到可擦除的块
8.static void yaffs2_checkpt_find_block(struct yaffs_dev *dev)//检查块是否被找到
9.int yaffs2_checkpt_open(struct yaffs_dev *dev, int writing)//检测是否可以写,如果不可以返回0,否则返回擦除状态
if (writing) {
memset(dev->checkpt_buffer, 0, dev->data_bytes_per_chunk);
yaffs2_checkpt_init_chunk_hdr(dev);
return yaffs_checkpt_erase(dev);
10.int yaffs2_get_checkpt_sum(struct yaffs_dev *dev, u32 * sum)//懂不起
{
u32 composite_sum;composite_sum = (dev->checkpt_sum << 8) | (dev->checkpt_xor & 0xff);
*sum = composite_sum;
return 1;
}
11.static int yaffs2_checkpt_flush_buffer(struct yaffs_dev *dev)//检验是否流进buffer缓冲
12.int yaffs2_checkpt_wr(struct yaffs_dev *dev, const void *data, int n_bytes)
if (!dev->checkpt_buffer)return 0;
if (!dev->checkpt_open_write)return -1;
Else return i;
如果缓冲区满则返回0,打开写失败返回-1,其他情况返回失败时候的字节号
13.int yaffs2_checkpt_rd(struct yaffs_dev *dev, void *data, int n_bytes)//类似于写
14.int yaffs_checkpt_close(struct yaffs_dev *dev)
if (dev->checkpt_buffer)
return 1;
else
return 0;
15.int yaffs2_checkpt_invalidate_stream(struct yaffs_dev *dev)
return yaffs_checkpt_erase(dev);
本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2016-05-26,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 瓜大三哥 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档