上一次说了base file system,那么理解了首先要有一个base file system,这个文件系统就是IMFS,有了这个base file system以后才能挂载其他的文件系统。我最后希望能够挂载一个flash的文件系统,但是现在还是不知道该怎么做?
那么阅读手册中挂载mount和解除挂载unmount
挂载点的概念
1:挂载点必须是一个目录。可以有文件和其他目录在它下面
2:任务比如有read/write/execute的权限,否则挂载尝试将被拒绝
3:只有一个文件系统可以挂载到一个单独的挂载点。
4:挂载完成后,挂载点名字可以作为挂载文件系统的root的引用。
mount table chain 是一个动态list结构,描述了mounted filesystem在文件系统层级结构中的具体位置。在base file system初始化的时候这个链表初始化为空。mount操作将add entry到mount table chain中。反之,unmount移除 entry
struct rtems_filesystem_mount_table_entry_tt {
rtems_chain_node mt_node;
void *fs_info;
const rtems_filesystem_operations_table *ops;
const void *immutable_fs_info;
rtems_chain_control location_chain;
rtems_filesystem_global_location_t *mt_point_node;
rtems_filesystem_global_location_t *mt_fs_root;
bool mounted;
bool writeable;
const rtems_filesystem_limits_and_options_t *pathconf_limits_and_options;
/*
* The target or mount point of the file system.
*/
const char *target;
/*
* The type of filesystem or the name of the filesystem.
*/
const char *type;
/*
* When someone adds a mounted filesystem on a real device,
* this will need to be used.
*
* The lower layers can manage how this is managed. Leave as a
* string.
*/
char *dev;
/**
* The task that initiated the unmount process. After unmount process
* completion this task will be notified via the transient event.
*
* @see ClassicEventTransient.
*/
rtems_id unmount_task;
};
mount table chain中存储的条目(entry)的结构如上面所示,
mt_node:链表的节点。
mt_fs_root包含所有必要的信息来识别安装文件系统的root。用户不允许通过一般代码获取这个node,但是它被用于识别挂载的文件系统,这是开始evaluation of pathname的地方。
fs_info:可被挂载的文件系统获取,用来识别应用于文件系统实例的唯一的thing,它是一个location。例如IMFS就用这个空间来提供node的识别(对于文件系统的每个实例都是唯一的)
dev:文件系统所在的device
其他的手册上没有描述,暂时先不考虑,只是理解,后续再回来仔细修改。