UBIFS中的重要的结构体 用leeming的话来说,一个大的工程中,最最核心的往往是数据结构体的定义。所以看代码不急着看c文件,而是主要看document和h文件,来理解设计者的思路,这样才能走对路。 UBI中对于一个UBI设备的抽象是以structubi_device来定义,其中包括了该UBI设备的各种信息。个人收集整理勿做商业用途structubi_device{ structcdevcdev; structdevicedev; intubi_num;//UBI设备的标号,在ubiattach用户程序时以-d选项来输入 charubi_name[sizeof(UBI_NAME_STR)+5];//ubi设备的名称 intvol_count;//在该UBI设备中有多少个volume structubi_volume*volumes[UBI_MAX_VOLUMES+UBI_INT_VOL_COUNT];个人收集整理勿做商业用途 spinlock_tvolumes_lock; intref_count; intimage_seq; intrsvd_pebs;//保留的LEB数目 intavail_pebs;//可用的LEB数目 intbeb_rsvd_pebs;//为坏块处理而保留的LEB数目 intbeb_rsvd_level;//为坏块处理而保留的LEB的正常数目 intautoresize_vol_id; intvtbl_slots; intvtbl_size;//volume表的大小(bytes) structubi_vtbl_record*vtbl;//内存中volume表的拷贝 structmutexdevice_mutex; intmax_ec;//最大的erasecounter /*Note,mean_ecisnotupdatedrun-time-shouldbefixed*/个人收集整理勿做商业用途 intmean_ec;//平均erasecounter /*EBAsub-system'sstuff*/ unsignedlonglongglobal_sqnum; spinlock_tltree_lock; structrb_rootltree; structmutexalc_mutex; /*Wear-levelingsub-system'sstuff*/ structrb_rootused;//一个红黑树,其中是已用的blcok structrb_rooterroneous;//RB-treeoferroneoususedphysicaleraseblocks个人收集整理勿做商业用途 structrb_rootfree;//红黑树的根,其中是没有用到的block structrb_rootscrub;//需要擦除的blcok structlist_headpq[UBI_PROT_QUEUE_LEN]; intpq_head; spinlock_twl_lock; structmutexmove_mutex; structrw_semaphorework_sem; intwl_scheduled; structubi_wl_entry**lookuptbl;//atabletoquicklyfin
UBIS分析:重要结构体 来自淘豆网m.daumloan.com转载请标明出处.