Geek OS 学习之pfat 文件系统
来源:互联网 发布:如何做域名cname解析 编辑:程序博客网 时间:2024/05/16 17:13
GeekOS中的pfat文件系统。
结构如下。
假设建立了一个10M的磁盘文件disk.img
每个block为512B
0 block :引导扇区
1 block~n block: fat表,fat表中每个fat项存储的是一个块号,每个fat项4B,共可索引到0~2^32号块。fat表的大小根据磁盘文件而定,计算方式:(磁盘文件大小/512) * 4,fat表的作用是以链表的方式指示文件的数据块号。
n block~m block: 根目录区,大小根据用户写入的文件数目而定,根目录区中的每个条目指示了文件的信息如文件名,起始块号,文件大小。
m block~10M/512 block:数据区,用于存储文件数据。
主要的两个数据结构。
typedef struct {
int magic; /* id to tell the type of filesystem */
int fileAllocationOffset; /* where is the file allocation table */ /*fat表在整个磁盘中的偏移, 单位为块*/
int fileAllocationLength; /* length of allocation table */ /*fat表的大小,单位为块*/
int rootDirectoryOffset; /* offset in sectors of root directory */ /*根目录偏移, 通常在FAT表的后面*/
int rootDirectoryCount; /* number of items in the directory */ /*根目录中的条目数*/
short setupStart; /* first sector of secondary loader */
short setupSize; /* size in sectors of secondary loader */
short kernelStart; /* first sector of kernel to run */
short kernelSize; /* size in sectors of kernel to run */
} bootSector;
/* 根目录中的条目结构*/
typedef struct {
char fileName[8+4]; /* 文件名 */
/* attribute bits */
char readOnly:1;
char hidden:1;
char systemFile:1;
char volumeLabel:1;
char directory:1;
short time;
short date;
int firstBlock; /* 文件的开始簇号 */
int fileSize; /* 文件的大小 */
} directoryEntry;
bootSector结构是引导扇区的格式,共28B。
directoryEntry则是根目录区每个条目的结构,每个条目28B。
pfat是一个只读的文件系统,文件在建立文件系统的时候就写进去了。
- Geek OS 学习之pfat 文件系统
- OS学习之文件系统
- OS学习笔记六:文件系统
- OS--文件系统
- Solaris学习之文件系统
- OS学习之设备管理
- GEEK极客之我见
- php5学习笔记之文件系统
- Linux之文件系统命令学习
- Python学习之OS库
- 【OS学习】之 Process API
- Python学习之os模块
- Python--小甲鱼学习笔记--第30课:文件系统(os、os.path)
- GEEK学习笔记— —Linux常用命令
- Symbian OS 文件系统
- python--OS模块,文件系统
- Linux学习之文件系统与文件系统的压缩与打包
- os 学习日记之 os x yosemite 安装win7 双系统
- 中华人民共和国道路交通安全法 (2)
- 如何设置root用户的密码以使root用户生效
- 线程安全总结1
- 如何支持root直接登录
- linux下IPTABLES配置详解
- Geek OS 学习之pfat 文件系统
- 怎样通过pppoe拨号上网
- VLC播放画质延迟改善方法
- 杭电 1241
- 驾驶证扣分
- Comparator和Comparable在排序中的应用
- 怎样在Windows中制作u盘linux操作系统
- “虚拟运营商”巨头维珍带来的“移动通信转售业务”经验
- hibernate一对一双向主键关联_Annotation