# Annotated Xiafs

These are the annotated sources for the kernel module for the xiafs filesystem, based on the modern-xiafs sources for Linux 3.12.1.

Filesystem hacking is, in my experience, the kind of thing that’s hard to understand if you don’t already know all about it. I did the xiafs port in the first place to learn more about how they worked, but I found there wasn’t a whole lot out there to help the novice filesystem hacker along so I had to slog through a lot of it on my own. It’s a fine way to learn, but it can be frustrating. Xiafs itself is not particularly practical on a modern system, but it’s simple enough to understand and illustrate how filesystems work while also being complicated enough that it’s not totally worthless as a real world example. (People did use this as a filesystem for real work once, after all.)

Below are links to each of the C files that make up the xiafs filesystem, annotated in (perhaps excessive) detail explaining what’s happening and why every step of the way. A lot of what’s discussed is applicable to other filesystems. My hope is that this makes filesystem kernel modules a little less frightening and mysterious, and might help anyone else down the road who wants to learn more about filesystem hacking.

Each of the annotated source files has a pull down menu in the upper right hand corner with links to the other files.

This annotation was generated with docco, which ended up working quite well for this because only // C++-style comments were converted into annotation, while /* C style comments */ were left alone. Another invaluable resource while working on this annotation was this Linux Cross Reference, for double checking what different kernel bits actually did. The Wikipedia articles on Unix filesystems, inodes, and inode pointer structures are good reading too, along with Design and Implementation of the Second Extended Filesystem and The Second Extended File System.

Comments, suggestions, and improvements (especially anything I got too horribly wrong) are always welcome. You can leave a comment here, or email me at jbingham -at- that gmail place.