added stuff for ext4

This commit is contained in:
Om Raheja 2024-08-18 14:50:11 -04:00
parent b11bfe8ed6
commit 09425c76cf

View File

@ -14,3 +14,28 @@ Below that, we have a struct called `ext2fs_vfsops` which just contains values t
At this point, we should see where in the mounting process ext4 fails. Create an ext4 filesystem using qemu and mount it; make sure that the virtual machine manager marks it as a readonly filesystem before mounting it to ensure that it doesn't get corrupted (at least, not yet).
Finally, on line 106 we have the `ext2fs_mountroot` function. This is where the bulk of our analysis will start.
```c
struct m_ext2fs *fs;
struct mount *mp;
struct proc *p = curproc; /* XXX */
struct ufsmount *ump;
int error;
/*
* Get vnodes for swapdev and rootdev.
*/
if (bdevvp(swapdev, &swapdev_vp) || bdevvp(rootdev, &rootvp))
panic("ext2fs_mountroot: can't setup bdevvp's");
```
So here we have to figure out what exactly the bdevvp function is.
From the OpenBSD man page:
> bdevvp() will create a vnode for a block device, and is used for the root device and swap areas, among other things.
I guess our question starts at, what exactly is a virtual node? It's nothing more than "an abstract ayer on top of a more concrete filesystem." (Wikipedia).
Meaning nothing more than what we have to do in order for there to be no difference when we run `ls`, `cd`, `rm`, `mkdir`, etc. Abstractions are necessary.