- The example can only be used to study. It can not work as tools. The author has no reponsibilty to your file & device damage.
- The code has been tested in linux-4.4.
- If you met some errors, please contact QQ 934367813 or QQ group 479198558.
Makefilefile ownKDIRvariable. Please make sure it is configured to your kenel header directory.
KDIR := ~/compile/linux-4.4
- Jump to the source dir. Excute
make buildcommand to compile the module. Then, make sure there existslyfs.komodule file.
- Excute
make mount. It willinsmod, and mountoutput/disk.imgtooutput/point.output/disk.imghas been formated, it contains some files. Of course, you can runmkfs.lyfsto format the img file. Excutetouchto create file.
- Now you can operate the mounted file system as you want. Excute
echoto write some string into one file and excutecatto read the file.
- Now, you can unmount the file system and remove the module from your system.
super_block:
every_block is 4KB.
super_block has 4KB.
first meta is root. it has no parent and name.
meta_area is from 4KB.
partion_size [4B]
meta_area size = .
block_area index.
meta_area:
file name has 16 char. [16B]
is file or dentry. [1B]
block_area index. [4B]
parent meta_are index.[4B]
16 child meta_are index. [4B * 16]
data_area:
file_size. [4B]
....
next block index [4B]
----------------------------------------------------------------------
| | | | | |
| super_block | meta_bitmap | meta_area | data_bitmap | data_area |
| | | | | |
----------------------------------------------------------------------





