46 lines
1.4 KiB
Markdown
46 lines
1.4 KiB
Markdown
# Void Filesystem
|
|
|
|
Just a dummy filesystem for learning.
|
|
|
|
## Virtual Filesystem (VFS)
|
|
|
|
Linux VFS allows us to write customize filesystem. The filesystem must be able to mount, other operations such as file read/write or folder creation/deletion can be customized.
|
|
|
|
A filesystem can be virtual, without a backed-up device. This is the case for, I guess, network file descriptors. For filesystem with a backed-up device, usually a block device, the underlying block device can be accessed by sb_bread to read a block.
|
|
|
|
Internally, a filesystem must provide a superblock, that will be used as a pointer to read files.
|
|
|
|
When a file is read, the inode of the file entry can be accessed. If we also keep the internal data of the file in `inode->i_private`, we can fetch that to read the file system through `sb_read(inode->sb)`.
|
|
|
|
## Run
|
|
|
|
```
|
|
sudo make voidfs
|
|
sudo insmod voidfs.ko
|
|
|
|
# create a dummy file block device
|
|
dd if=/dev/zero of=dummy.iso bs=4096 count=1
|
|
mkdir -p drive
|
|
sudo mount -t voidfs -o loop dummy.iso drive
|
|
sudo ls drive
|
|
sudo cat drive/dummyfile
|
|
```
|
|
|
|
## Goal
|
|
|
|
- Fully working filesystem
|
|
- Read from block device
|
|
- Encrypted filesystem
|
|
|
|
## Design
|
|
|
|
TO BE UPDATED
|
|
|
|
## References
|
|
|
|
[simplefs](https://github.com/sysprog21/simplefs)
|
|
|
|
[Linux Kernel Labs - File system drivers](https://linux-kernel-labs.github.io/refs/heads/master/labs/filesystems_part1.html)
|
|
|
|
[Linux Kernel Documentation](https://docs.kernel.org/filesystems/vfs.html)
|