base file system的理解
通过跟踪源代码 ,rtems_filesystem_initialize跟踪下去。发现手册上写的都可以理解了
• Initialization of mount table chain control structure 建立一个链表的mount结构
• Allocation of ajnode structure that will server as the root node of the ‘In Memory Filesystem’ 在IMFS_initialize_support中定义了该结构
• Initialization of the allocated jnodewith the appropriate OPS, directory handlers and pathconf limits and options. 通过confdefs中定义的ops去初始化这个jnode中的ops
• Allocation of a memory region for filesystem specific global management variables 在 register_root_file_system后半部分
• Creation of first mount table entry for the base filesystem
• Initialization of the first mount table chain entry to indicate that the mount point is NULL and the mounted filesystem is the base file system
rtems初始化时安装了ram based 的文件系统作为base file system。文件系统树的根目录被认为是目录结构的逻辑根。 /dev作为I/O设备目录被创建。
基于ram的文件系统,文件和目录节点都是简单的分配内存块。数据也被存储在内存块中。当系统关闭或者重启,文件都会丢失。
base file system作为安装文件系统的开始点。比如non- volatile memory, flash memory and IDE hard disk drives。
其他类型的文件系统将在挂载到base file system的挂载点上或者挂载到附属于base file system的其他系统上。
base file system被安装为IMFS,使用标准的mount函数。mount point是null。标志着操作系统下注册的第一个文件系统,并进行该文件系统的一些初始化。假如需要不同的文件系统作为base file system。那么需要修改base_fs.c
一旦base file system的root建立起来。它就记录为base file system的挂载点。device被集成到base file system。对于每个配置到系统的设备,都有一个设备注册过程。设备注册产生一个唯一的dev_t handle,有major和minor device number。除此之外,每个设备的配置信息包含一个text string代表设备在file system中的路径。一个文件系统的node被创建,这个node关联具体的设备注册路径。其他的文件系统可以被安装,但是安装在base file system的点上(directory mount points)