During this past week, I've been working a bit on my SoC project; only a bit because I had to prepare the slides for the NetBSD presentation I'm giving tomorrow at Partyzip@. Fortunately, from now on I won't have anything else to do, so I'll be able to devote all my time to tmpfs :-)
So... here is a little status report: I started the week reading the I/O chapter from the Design and Implementation of the 4.4BSD Operating System. It was a really interesting read, as I could understand some common concepts in detail.
After that, I started creating a extremely simple skeleton for my new file system. Before doing that, I was tempted to copy a whole existing file system, such as ptyfs, to later modify its code to suit my needs. But I quickly threw away this idea because this could hide some of the learning process.
So I started with some empty files defining the basic structures for tmpfs: a mount structure and a vnode structure. I set all of its members to useless/NULL functions. After that, I got the kernel to build with the code inside it, but it failed miserably to boot (NULL pointers to functions are not good).
To fix this, I had to define some VFS hooks, such as the vfs_init one. This solved the panics during boot, but obviously, more panics appeared while trying to mount the file system using a simple mount_tmpfs(8) utility. I did the same process: define empty functions for the affected operations rather than using NULL pointers. And I could call mount(2) without a crash.
The next logical step was to fill the mount functions with something useful; I based the code structure on the one I read in ptyfs; however, I still doubt about its correctness (it surely lacks stuff).
Now, I can mount the file system (to the point that it appears as mounted when running mount(8)). However, any sync(2) operation causes a crash, surely because of the lack of other VFS hooks.
The task next week will be to continue this process, filling functions as needed and possibly starting real work on the file system itself (i.e., how to store the files and directories into memory, etc.).
All the above is explained in detail, although with very compact sentences, into the notes I'm taking.
Oh BTW, Monotone's CVS gateway has caused me some trouble, such as pushing only half of the revisions... I had to finish the process manually, and worst of all, I don't know why it happened. Next time, I'll try to do a manual test before the real operation on a local CVS repository (if I can get one)...