rtems 文件系统(7)

上一次说了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_point_node : 包含了所有必要的信息来获取文件系统安装的目录。这个元素包含内存,该内存在path evaluation
文件系统是分配,包含了挂载点的目录。当文件系统被mt_fs_root识别为未被挂载的,可以允许这部分内存通过unmount收回

mt_fs_root包含所有必要的信息来识别安装文件系统的root。用户不允许通过一般代码获取这个node,但是它被用于识别挂载的文件系统,这是开始evaluation of pathname的地方。

fs_info:可被挂载的文件系统获取,用来识别应用于文件系统实例的唯一的thing,它是一个location。例如IMFS就用这个空间来提供node的识别(对于文件系统的每个实例都是唯一的)

dev:文件系统所在的device

其他的手册上没有描述,暂时先不考虑,只是理解,后续再回来仔细修改。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值