RTEMS 文件系统设计指南

RTEMS 文件系统设计指南

filesystem.RTEMS文件系统设计指南.双语.V20131224.pdf
RTEMS 的filesystem文档的原创翻译。

目录

前言 15
1  路径名评估 19
1.1  路径名评估处理程序 19
1.2  在路径评估期间穿越挂载点 19
1.3  rtems_filesystem_location_info_t结构 20
2  系统初始化 23
2.1  基础文件系统 24
2.1.1  基础文件系统的挂载 25
3  挂载和卸载文件系统 27
3.1  挂载点 27
3.2  挂载表链 27
3.3  在挂载时添加条目到链表 29
3.4  卸载时从链表移除条目 30
4  系统调用开发说明 31
4.1  access 32
4.2  chdir 32
4.3  chmod 34
4.4  chown 34
4.5  close 35
4.6  closedir 37
4.7  dup()未实现 38
4.8  dup2()未实现 38
4.9 fchmod 39
4.10  fcntl() 40
4.11  fdatasync 41
4.12  fpathconf 42
4.13  fstat 44
4.14  ioctl 46
4.15  link 47
4.16  lseek 48
4.17  mkdir 50
4.18  mkfifo 50
4.19  mknod 51
4.20  mount 53
4.21  open 56
4.22  opendir 57
4.23  pathconf 58
4.24  read 59
4.25  readdir 60
4.26  unmount 61
4.27  eval 62
4.28  getdentsc 62
5  文件系统实现的要求 65
5.1  总则 65
5.2  文件和目录移除约束 67
5.3  API分层 67
5.3.1  通用系统调用到文件系统特定的函数的映射 67
5.3.2  通过文件控制块rtems_libio_t结构访问文件/设备/目录 69
5.3.3  通过rtems _filesystem_location_info_t结构访问文件/目录函数 72
5.4  操作表 72
5.4.1  文件系统处理程序表函数 73
5.4.1.1  evalpath处理程序 74
5.4.1.2  evalformake处理程序 74
5.4.1.3  link处理函数 75
5.4.1.4  unlink处理程序 76
5.4.1.5  node_type处理程序 76
5.4.1.6  mknod处理程序 77
5.4.1.7  rmnod处理程序 77
5.4.1.8  chown处理程序 78
5.4.1.9  freenod处理程序 78
5.4.1.10  mount处理程序 79
5.4.1.11  fsmount_me处理程序 79
5.4.1.12  unmount处理程序 83
5.4.1.13  fsunmount_me处理程序 83
5.4.1.14  utime处理程序 83
5.4.1.15  eval_link处理程序 84
5.4.1.16  symlink处理程序 84
5.4.2  文件处理程序表函数 85
5.4.2.1  open处理程序 85
5.4.2.2  close处理程序 86
5.4.2.3  read处理程序 86
5.4.2.4  write处理程序 87
5.4.2.5  ioctl处理程序 87
5.4.2.6  lseek处理程序 88
5.4.2.7  fstat处理程序 88
5.4.2.8  fchmod处理程序 89
5.4.2.9  ftruncate处理程序 90
5.4.2.10  fpathconf处理程序 90
5.4.2.11  fsync处理程序 91
5.4.2.12  fdatasync处理程序 91
5.4.2.13  fcntl处理程序 92
6  内存文件系统 93
6.1  IMFS每节点数据结构 93
6.2  杂项IMFS信息 97
6.3  与IMFS相关联的内存 97
6.3.1  IMFS节点移除约束 97
6.3.2  IMFS一般内务注意事项 97
6.4  IMFS操作表 98
6.4.1  IMFS文件系统处理程序表函数 98
6.4.1.1  IMFS_evalpath() 99
6.4.1.2  IMFS_evalformake() 99
6.4.1.3  IMFS_link() 100
6.4.1.4  IMFS_unlink() 101
6.4.1.5  IMFS_node_type() 102
6.4.1.6  IMFS_mknod() 103
6.4.1.7  IMFS_rmnod() 104
6.4.1.8  IMFS_chown() 104
6.4.1.9  IMFS_freenod() 105
6.4.1.10  IMFS_freenodinfo() 106
6.4.1.11  IMFS_mount() 106
6.4.1.12  IMFS_fsmount_me() 107
6.4.1.13  IMFS_unmount() 111
6.4.1.14  IMFS_fsunmount() 111
6.4.1.15  IMFS_utime() 112
6.4.1.16  IMFS_eval_link() 113
6.4.2  常规文件处理程序表函数 113
6.4.2.1  常规文件的memfile_open() 114
6.4.2.2  常规文件的memfile_close() 114
6.4.2.3  常规文件的memfile_read() 115
6.4.2.4  常规文件的memfile_write() 116
6.4.2.5  常规文件的memfile_ioctl() 117
6.4.2.6  常规文件的memfile_lseek() 117
6.4.2.7  常规文件的IMFS_stat() 118
6.4.2.8  常规文件的IMFS_fchmod() 119
6.4.2.9  常规文件的memfile_ftruncate() 120
6.4.2.10  常规文件无pathconf() 121
6.4.2.11  常规文件无fsync() 121
6.4.2.12  常规文件的IMFS_fdatasync() 122
6.4.3  目录处理程序表函数 122
6.4.3.1  目录的IMFS_dir_open() 123
6.4.3.2  目录的IMFS_dir_close() 124
6.4.3.3  目录的IMFS_dir_read() 124
6.4.3.4  目录无write() 125
6.4.3.5  目录无ioctl() 125
6.4.3.6  目录的IMFS_dir_lseek() 126
6.4.3.7  目录的IMFS_dir_fstat() 127
6.4.3.8  目录的IMFS_fchmod() 128
6.4.3.9  目录无ftruncate() 129
6.4.3.10  目录无fpathconf() 129
6.4.3.11  目录无fsync() 130
6.4.3.12  目录的IMFS_fdatasync() 130
6.4.4  设备处理程序表函数 131
6.4.4.1  设备的device_open() 131
6.4.4.2  设备的device_close() 132
6.4.4.3  设备的device_read() 133
6.4.4.4  设备的device_write() 134
6.4.4.5  设备的device_ioctl() 135
6.4.4.6  设备的device_lseek() 136
6.4.4.7  设备的IMFS_stat() 136
6.4.4.8  设备的IMFS_fchmod() 138
6.4.4.9  设备无ftruncate() 139
6.4.4.10  设备无fpathconf() 139
6.4.4.11  设备无fsync() 140
6.4.4.12  设备无fdatasync() 140
7  微型内存文件系统 143
8  简单FTP客户端文件系统 145
命令和变量索引 147
概念索引 149

1  Pathname Evaluation
1  路径名评估

This chapter describes the pathname evaluation process for the RTEMS Filesystem Infrastructure.
本章介绍了RTEMS文件系统基础架构的路径名评估过程。

XXX Include graphic of the path evaluation process
XXX包括路径评估过程的图形

1.1 Pathname Evaluation Handlers
1.1  路径名评估处理程序
There are two pathname evaluation routines. The handler patheval() is called to find, verify privileges on and return information on a node that exists. The handler evalformake() is called to find, verify permissions, and return information on a node that is to become a parent. Additionally, evalformake() returns a pointer to the start of the name of the new node to be created.
有两个路径名评估例程。调用处理程序patheval(),对存在的节点上的信息进行查找、验证权限并返回信息。调用处理程序evalformake(),对要成为父节点的节点上的信息进行查找、验证权限并返回信息。此外,evalformake()返回一个指向新创建的节点的名称开头的指针。

Pathname evaluation is specific to a filesystem. Each filesystem is required to provide both a patheval() and an evalformake() routine. Both of these routines gets a name to evaluate and a node indicating where to start the evaluation.
路径名评估特定于文件系统。要求每个文件系统都提供patheval()和evalformake()例程。这两个例程都获得一个要评估的名称和一个表示从哪里开始评估的节点。

1.2  Crossing a Mount Point During Path Evaluation
1.2  在路径评估期间穿越挂载点
If the filesystem supports the mount command, the evaluate routines must handle crossing the mountpoint. The evaluate routine should evaluate the name upto the first directory node where the new filesystem is mounted. The filesystem may process terminator characters prior to calling the evaluate routine for the new filesystem. A pointer to the portion of the name which has not been evaluated along with the root node of the new file system ( gotten from the mount table entry ) is passed to the correct mounted filesystem evaluate routine.
如果文件系统支持挂载命令,评估例程必须处理穿越的挂载点。评估例程应评估该名称直到挂载的新文件系统所处的第一个目录节点。文件系统可能在调用新文件系统的评估例程之前处理终止符。指向名称的尚未评估部分的指针与新文件系统的根节点(从挂载表项获得)一起被传递给正确挂载的文件系统的评估例程。

1.3  The rtems_filesystem_location_info_t Structure
1.3  rtems_filesystem_location_info_t结构
The rtems_filesystem_location_info_t structure contains all information necessary for identification of a node.
rtems_filesystem_location_info_t结构包含识别节点所必需的所有信息。

The generic rtems filesystem code defines two global_rtems_filesystem_location_info_t structures, the rtems_filesystem_root and the rtems_filesystem_current. Both are initially defined to be the root node of the base filesystem. Once the chdir command is correctly used the rtems_filesystem_current is set to the location specified by the command.
一般的RTEMS文件系统代码定义了两个global_rtems_filesystem_location_info_t结构,the rtems_filesystem_root和the rtems_filesystem_current。两个结构最初都被定义为基础文件系统的根节点。一旦正确地使用chdir命令,rtems_filesystem_current就被设置为该命令指定的位置。

The filesystem generic code peeks at the first character in the name to be evaluated. If this character is a valid seperator, the rtems_filesystem_root is used as the node to start the evaluation with. Otherwise, the rtems_filesystem_current node is used as the node to start evaluating with. Therefore, a valid rtems_filesystem_location_info_t is given to the evaluate routine to start evaluation with. The evaluate routines are then responsible for making any changes necessary to this structure to correspond to the name being parsed.
文件系统的通用代码查看被评估的名称中的第一个字符。如果该字符是有效的分隔符,则rtems_filesystem_root用作开始评估的节点,否则,rtems_filesystem_current节点用作开始评估的节点。因此,rtems_filesystem_location_info_t被赋给评估例程以开始评估。然后评估例程负责作出此结构对应于被解析的名称所必需的任何改变。

struct rtems_filesystem_location_info_tt {
    void *node_access;
    rtems_filesystem_file_handlers_r *handlers;
    rtems_filesystem_operations_table *ops;
    rtems_filesystem_mount_table_entry_t *mt_entry;
};

node_access This element is filesystem specific. A filesystem can define and store any information necessary to identify a node at this location. This element is normally filled in by the filesystem’s evaluate routine. For the filesystem’s root node, the filesystem’s initilization routine should fill this in, and it should remain valid until the instance of the filesystem is unmounted.
node_access 此元素是文件系统特定的。文件系统可以定义和存储识别在此位置的节点所必需的任何信息。此元素通常由文件系统评估例程填充。对于文件系统的根节点,文件系统初始化例程应填充此元素,它应保持有效,直到卸载该文件系统的实例。

handlers This element is defined as a set of routines that may change within a given filesystem based upon node type. For example a directory and a memory file may have to completely different read routines. This element is set to an initialization state defined by the mount table, and may be set to the desired state by the evaluation routines.
handlers 此元素被定义为一组例程,可以在给定的文件系统内根据节点类型更改。例如一个目录和一个内存文件可能会有完全不同的读取例程。此元素被设置为由挂载表定义的初始化状态,并可能被设置为评价例程所期望的状态。

ops This element is defined as a set of routines that remain static for the filesystem. This element identifies entry points into the filesystem to the generic code.
ops 此元素被定义为一组例程,对于该文件系统保持不变。此元素识别通用代码的进入文件系统的入口点。

mt_entry This element identifies the mount table entry for this instance of the filesystem.
mt_entry 此元素识别此文件系统实例的挂载表项。
 
全文下载地址:http://download.csdn.net/detail/zhumaill/7019609

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值