- 1、本文档共9页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 5、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 6、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 7、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 8、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
UBIFS分析二重要结构体,结构体二维数组,二叉树结构体,二维结构体数组初始化,二进制文件结构体,结构体建立二维数组,二维结构体,结构体与二维指针,c读二进制结构体,结构体
UBIFS中的重要的结构体
用leeming的话来说,一个大的工程中,最最核心的往往是数据结构体的定义。所以看代码不急着看c文件,而是主要看document和h文件,来理解设计者的思路,这样才能走对路。
1. struct ubi_device
UBI中对于一个UBI设备的抽象是以struct ubi_device来定义,其中包括了该UBI设备的各种信息。
struct ubi_device {
struct cdev cdev;
struct device dev;
int ubi_num;//UBI设备的标号,在ubiattach用户程序时以-d选项来输入
char ubi_name[sizeof(UBI_NAME_STR)+5];//ubi设备的名称
int vol_count;//在该UBI设备中有多少个volume
struct ubi_volume *volumes[UBI_MAX_VOLUMES+UBI_INT_VOL_COUNT];
spinlock_t volumes_lock;
int ref_count;
int image_seq;
int rsvd_pebs;//保留的LEB数目
int avail_pebs;//可用的LEB数目
int beb_rsvd_pebs;//为坏块处理而保留的LEB数目
int beb_rsvd_level;//为坏块处理而保留的LEB的正常数目
int autoresize_vol_id;
int vtbl_slots;
int vtbl_size;//volume表的大小(bytes)
struct ubi_vtbl_record *vtbl;//内存中volume表的拷贝
struct mutex device_mutex;
int max_ec;//最大的erase counter
/* Note, mean_ec is not updated run-time - should be fixed */
int mean_ec;//平均erase counter
/* EBA sub-systems stuff */
unsigned long long global_sqnum;
spinlock_t ltree_lock;
struct rb_root ltree;
struct mutex alc_mutex;
/* Wear-leveling sub-systems stuff */
struct rb_root used;//一个红黑树,其中是已用的blcok
struct rb_root erroneous;// RB-tree of erroneous used physical eraseblocks
struct rb_root free;//红黑树的根,其中是没有用到的block
struct rb_root scrub;//需要擦除的blcok
struct list_head pq[UBI_PROT_QUEUE_LEN];
int pq_head;
spinlock_t wl_lock;
struct mutex move_mutex;
struct rw_semaphore work_sem;
int wl_scheduled;
struct ubi_wl_entry **lookuptbl;// a table to quickly find a struct ubi_wl_entry object for any physical eraseblock,,一个struct ubi_wl_entry类型的数组,以pnum为下标,记录该UBI设备的每一个block
struct ubi_wl_entry *move_from;// physical eraseblock from where the data is being moved
struct ubi_wl_entry *move_to;// physical eraseblock where the data is being moved to
int move_to_put;//标志位,用于标志目的LEB是否被put
struct list_head works;// list of pending works
int works_count;// count of pending works
struct task_struct *bgt_thread;//UBI的后台进程
int thread_enabled;
char bgt_name[sizeof(UBI_BGT_NAM
文档评论(0)